Improved error handling and missing check for disable webcam

This commit is contained in:
LazeMSS committed 2021-04-09 23:30:30 +02:00
1 parent 07c4630d12
commit d25a9f94b8
1 file changed
+7 -1
@@ -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,8 @@ $(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();