Skip to content

Commit

Permalink
Fix for loading of webcam stream - #80
Browse files Browse the repository at this point in the history
  • Loading branch information
sco01 committed Oct 12, 2019
1 parent aa144c0 commit 608fe81
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
15 changes: 11 additions & 4 deletions octoprint_dashboard/static/js/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ $(function () {

//Dashboard backend vars
self.getEta = ko.observable();
self.embedUrl = ko.observable("");
//self.embedUrl = ko.observable("");
self.extrudedFilament = ko.observable(0.00);
self.layerProgressString = ko.observable(0);
self.layerProgressBarString = ko.observable("0%");
Expand Down Expand Up @@ -265,10 +265,17 @@ $(function () {
};

self.embedUrl = function () {
if (self.settingsViewModel.settings.webcam && self.settingsViewModel.settings.plugins.dashboard.showWebCam) {
return self.settingsViewModel.settings.webcam.streamUrl() + "?" + new Date().getTime();
if (self.settingsViewModel.settings.webcam && self.settingsViewModel.settings.plugins.dashboard.showWebCam() == true) {
console.log("Dashboard: Enabling Webcam");
//$("#dashboard_webcam_image").attr("src", "self.settingsViewModel.settings.webcam.streamUrl() + '?' + new Date().getTime()");
return self.settingsViewModel.settings.webcam.streamUrl() + '?' + new Date().getTime();
}
else return "";
else if (self.settingsViewModel.settings.plugins.dashboard.showWebCam() == false) {
console.log("Dashboard: Disabling Webcam");
$("#dashboard_webcam_image").attr("src", "");
return "";
}
else return;
};

self.getEta = function (seconds) {
Expand Down
2 changes: 1 addition & 1 deletion octoprint_dashboard/templates/dashboard_settings.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
</label>
</div>
<div >
<label class="checkbox">{{ _('Show Temp Sensor Info from Enclosure Plugin') }}
<label class="checkbox">{{ _('Show Temp Sensor Info from Enclosure Plugin (Experimental)') }}
<input type="checkbox" data-bind="checked: settings.plugins.dashboard.showSensorInfo">
</label>
</div>
Expand Down
4 changes: 2 additions & 2 deletions octoprint_dashboard/templates/dashboard_tab.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -237,12 +237,12 @@
<br />
</div>

<!-- Webcam-->
<!-- Webcam -->
<div id="dashboard_webcam_container" data-bind="visible: settingsViewModel.settings.plugins.dashboard.showWebCam()">
<div id="webcam_rotator" data-bind="css: { webcam_rotated: settingsViewModel.settings.webcam.rotate90(), webcam_unrotated: !settingsViewModel.settings.webcam.rotate90() }">
<div class="webcam_fixed_ratio" data-bind="css: controlViewModel.webcamRatioClass">
<div class="webcam_fixed_ratio_inner">
<img id="dashboard_webcam_image" data-bind="css: { flipH: settingsViewModel.settings.webcam.flipH(), flipV: settingsViewModel.settings.webcam.flipV()}, attr: {src: embedUrl()}"/>
<img id="dashboard_webcam_image" data-bind="css: { flipH: settingsViewModel.settings.webcam.flipH(), flipV: settingsViewModel.settings.webcam.flipV()}, getWebcamUrl, attr: {src: embedUrl()}"/>
</div>
</div>
</div>
Expand Down

0 comments on commit 608fe81

Please sign in to comment.