diff --git a/octoprint_multicam/__init__.py b/octoprint_multicam/__init__.py index 4759824..f5117b7 100644 --- a/octoprint_multicam/__init__.py +++ b/octoprint_multicam/__init__.py @@ -42,7 +42,7 @@ def get_classic_webcam_status(self): return flask.jsonify(enabled=self.isClassicWebcamEnabled()) def isClassicWebcamEnabled(self): - plugin = self._plugin_manager.get_plugin("classicwebcam") + plugin = self._plugin_manager.get_plugin("classicwebcam",True) return plugin is not None def get_settings_version(self): diff --git a/octoprint_multicam/static/css/multicam.css b/octoprint_multicam/static/css/multicam.css index a805e95..695c0ec 100644 --- a/octoprint_multicam/static/css/multicam.css +++ b/octoprint_multicam/static/css/multicam.css @@ -72,6 +72,10 @@ .webcam_video_container .webcam_unrotated { width: 100%; position: relative; +} + +#control .webcam_img_container, +#control .webcam_video_container .webcam_unrotated{ min-height: 300px; } diff --git a/octoprint_multicam/static/js/multicam.js b/octoprint_multicam/static/js/multicam.js index 5b15160..4cb6842 100644 --- a/octoprint_multicam/static/js/multicam.js +++ b/octoprint_multicam/static/js/multicam.js @@ -48,7 +48,9 @@ $(function () { let webcams = ko.toJS(self.settings.multicam_profiles) self.webcams = [] self.surfaces = [] - + if ($("#webcam-group").children().length == 0 || !OctoPrint.coreui.viewmodels.settingsViewModel.webcam_webcamEnabled()){ + return false; + } for (const child of document.getElementById("webcam-group").children) { if (child.id.startsWith("webcam_plugin_multicam")) { // We can use this surface, take next webcam and bind @@ -95,7 +97,7 @@ $(function () { } if (parsed.protocol === "webrtc:" || parsed.protocol === "webrtcs:") { - console.log("DEBUGG Webcam stream type: webrtc") + // console.log("DEBUGG Webcam stream type: webrtc") return "webrtc"; } @@ -103,13 +105,13 @@ $(function () { if (lastDotPosition !== -1) { var extension = parsed.pathname.substring(lastDotPosition + 1); if (extension.toLowerCase() === "m3u8") { - console.log("DEBUGG Webcam stream type: hls") + // console.log("DEBUGG Webcam stream type: hls") return "hls"; } } // By default, 'mjpg' is the stream type. - console.log("DEBUGG Webcam stream type: mjpg") + // console.log("DEBUGG Webcam stream type: mjpg") return "mjpg"; }; @@ -165,10 +167,10 @@ $(function () { typeof video.canPlayType != undefined && video.canPlayType("application/vnd.apple.mpegurl") == "probably" ) { - console.log("DEBUGG Using native HLS playback") + // console.log("DEBUGG Using native HLS playback") video.src = self.streamUrlEscaped(); } else if (Hls.isSupported()) { - console.log("DEBUGG Using HLS.js playback") + // console.log("DEBUGG Using HLS.js playback") self.hls = new Hls(); self.hls.loadSource(self.WebCamSettings.streamUrlEscaped()); self.hls.attachMedia(video); @@ -293,7 +295,7 @@ $(function () { } self.WebCamSettings.webcam_flipH(webcam[1].flipH) self.WebCamSettings.webcam_flipV(webcam[1].flipV) - console.log("Loading webcam: ", webcam[1].URL) + //console.log("Loading webcam: ", webcam[1].URL) self.WebCamSettings.streamUrl(webcam[1].URL) @@ -336,12 +338,12 @@ $(function () { }; self.launchWebcamPictureInPicture = function () { - console.log("DEBUGG launchWebcamPictureInPicture",self._getActiveWebcamVideoElement()) + // console.log("DEBUGG launchWebcamPictureInPicture",self._getActiveWebcamVideoElement()) self._getActiveWebcamVideoElement().requestPictureInPicture(); }; self.launchWebcamFullscreen = function () { - console.log("DEBUGG launchWebcamPictureInPicture",self._getActiveWebcamVideoElement()) + // console.log("DEBUGG launchWebcamPictureInPicture",self._getActiveWebcamVideoElement()) self._getActiveWebcamVideoElement().requestFullscreen(); }; diff --git a/octoprint_multicam/static/js/multicam_settings.js b/octoprint_multicam/static/js/multicam_settings.js index d9a22c2..4f9e4e9 100644 --- a/octoprint_multicam/static/js/multicam_settings.js +++ b/octoprint_multicam/static/js/multicam_settings.js @@ -73,7 +73,7 @@ $(function () { url: "/plugin/multicam/classicwebcamstatus", type: "GET", success: function (response) { - self.isClassicWebcamEnabled = response.enabled; + self.isClassicWebcamEnabled(response.enabled); //console.log("DEBUGGG isClassicWebcamEnabled", self.isClassicWebcamEnabled) //TODO: Inform the user that the classic webcam is enabled and they should consider disabling it diff --git a/octoprint_multicam/templates/multicam_settings.jinja2 b/octoprint_multicam/templates/multicam_settings.jinja2 index 6ee3fb3..2d88837 100644 --- a/octoprint_multicam/templates/multicam_settings.jinja2 +++ b/octoprint_multicam/templates/multicam_settings.jinja2 @@ -1,9 +1,12 @@

{{ _('Multicam Profiles') }}

-