Skip to content

Commit

Permalink
Bugfix: 27 + 28
Browse files Browse the repository at this point in the history
Top of expanded webcam view is behind fixed top navbar #27
Errors in Console when stream URL is empty #28
  • Loading branch information
LazeMSS committed Dec 13, 2020
1 parent 92ca150 commit 68083b7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
2 changes: 1 addition & 1 deletion octoprint_uicustomizer/static/css/uicustomizer.css
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ body.UICResponsiveMode select{
left: 50%;
transform: translate(-50%, -50%);
width: calc(100% - 200px);
z-index: 1000;
z-index: 1045;
background: rgba(255,255,255,0.66);
border: 2px solid rgba(0,0,0,0.5);
border-radius: 4px; padding: 8px;
Expand Down
19 changes: 16 additions & 3 deletions octoprint_uicustomizer/static/js/uicustomizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,8 @@ $(function() {

// ------------------------------------------------------------------------------------------------------------------------
self.set_addWebCamZoom = function(enable){
if (!enable){
var streamURL = self.settings.webcam_streamUrl();
if (!enable || (self.settings.webcam_webcamEnabled() == false || streamURL == "")){
$('div.UICWebCamClick').remove();
return true;
}
Expand Down Expand Up @@ -382,7 +383,6 @@ $(function() {
// HLS handling
var hlsCam = false;
var containers = ['#webcam_container','#IUCWebcamContainer > div'];
var streamURL = self.settings.webcam_streamUrl();
if (/.m3u8/i.test(streamURL)){
hlsCam = true;
containers = ['#webcam_hls_container','#IUCWebcamContainer > div'];
Expand Down Expand Up @@ -541,10 +541,20 @@ $(function() {
$('#UICWebCamWidget').remove();
return true;
}

// Cleanup
$('#IUCWebcamContainer > div').html('');
var hlsCam = false;
var streamURL = self.settings.webcam_streamUrl();

// Not configured - then do nothing
if (self.settings.webcam_webcamEnabled() == false || streamURL == ""){
OctoPrint.coreui.viewmodels.controlViewModel.onWebcamLoaded = self.onWebCamOrg;
OctoPrint.coreui.viewmodels.controlViewModel.onWebcamErrored = self.onWebCamErrorOrg;
$('#IUCWebcamContainer > div').append('<div class="nowebcam text-center"><i class="fas fa-question"></i> <span>Webcam not configured&hellip;</span></div>');
return true;
}

// BROKEN due to loading/changes not triggering at the right time: || (typeof OctoPrint.coreui.viewmodels.controlViewModel.webcamHlsEnabled == "function" && OctoPrint.coreui.viewmodels.controlViewModel.webcamHlsEnabled()
if (/.m3u8/i.test(streamURL)){
self.logToConsole("HLS WebCam detected: " + streamURL);
Expand Down Expand Up @@ -679,7 +689,10 @@ $(function() {

}else{
$('#webcam_hls_container').hide();
$('#webcam_hls')[0].pause();
// Pause if present
if ($('#webcam_hls').length){
$('#webcam_hls')[0].pause();
}
$('#UICWebCamWidget').addClass('UICWebcam');
// Remove old just in case
OctoPrint.coreui.viewmodels.controlViewModel.onWebcamErrored = self.onWebCamErrorOrg;
Expand Down

0 comments on commit 68083b7

Please sign in to comment.