diff --git a/src/octoprint/static/js/app/viewmodels/control.js b/src/octoprint/static/js/app/viewmodels/control.js index 850fa0848..bcd597b73 100644 --- a/src/octoprint/static/js/app/viewmodels/control.js +++ b/src/octoprint/static/js/app/viewmodels/control.js @@ -513,6 +513,11 @@ $(function () { clearTimeout(self.webcamDisableTimeout); } + // IF disabled then we dont need to do anything + if (self.settings.webcam_webcamEnabled() == false) { + return; + } + // Determine stream type and switch to corresponding webcam. var streamType = determineWebcamStreamType(self.settings.webcam_streamUrl()); if (streamType == "mjpg") { @@ -707,7 +712,12 @@ $(function () { self._switchToHlsWebcam = function () { var video = document.getElementById("webcam_hls"); - if (video.canPlayType("application/vnd.apple.mpegurl")) { + // Check for native playback options: https://developer.mozilla.org/en-US/docs/Web/API/HTMLMediaElement/canPlayType + if ( + video != null && + typeof video.canPlayType != undefined && + video.canPlayType("application/vnd.apple.mpegurl") == "probably" + ) { video.src = self.settings.webcam_streamUrl(); } else if (Hls.isSupported()) { var hls = new Hls();