Merge pull request #4088 from LazeMSS/bugfix/webcamControlBug

This commit is contained in:
Gina Häußge authored and GitHub committed 2021-04-13 15:47:17 +02:00
commit 33c3166e0b
1 file changed
+11 -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,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();