diff --git a/web/js/MonitorStream.js b/web/js/MonitorStream.js index 437ee6ce62..4c7a203844 100644 --- a/web/js/MonitorStream.js +++ b/web/js/MonitorStream.js @@ -300,6 +300,7 @@ function MonitorStream(monitorData) { this.streamListenerBind(); $j('#volumeControls').show(); + if (typeof observerMontage !== 'undefined') observerMontage.observe(stream); return; } else { alert("ZM_GO2RTC_PATH is empty. Go to Options->System and set ZM_GO2RTC_PATH accordingly."); diff --git a/web/skins/classic/views/js/montage.js b/web/skins/classic/views/js/montage.js index 1da54d55f7..5a31749f03 100644 --- a/web/skins/classic/views/js/montage.js +++ b/web/skins/classic/views/js/montage.js @@ -811,28 +811,9 @@ function initPage() { changeMonitorStatusPosition(); zmPanZoom.init(); - // Creating a ResizeObserver Instance - const observer = new ResizeObserver((objResizes) => { - const blockContent = document.getElementById('content'); - const currentScrollBbarExists = blockContent.scrollHeight > blockContent.clientHeight; - if (scrollBbarExists === null) { - scrollBbarExists = currentScrollBbarExists; - } - if (currentScrollBbarExists != scrollBbarExists) { - scrollBbarExists = currentScrollBbarExists; - return; - } - objResizes.forEach((obj) => { - const id = stringToNumber(obj.target.id); - if (mode != EDITING && !changedMonitors.includes(id)) { - changedMonitors.push(id); - } - }); - }); - // Registering an observer on an element $j('[id ^= "liveStream"]').each(function() { - observer.observe(this); + observerMontage.observe(this); }); //You can immediately call startMonitors() here, but in this case the height of the monitor will initially be minimal, and then become normal, but this is not pretty. @@ -1200,6 +1181,25 @@ function changeMonitorStatusPosition() { setCookie('zmMonitorStatusPositionSelected', monitorStatusPosition); } +// Creating a ResizeObserver Instance +const observerMontage = new ResizeObserver((objResizes) => { + const blockContent = document.getElementById('content'); + const currentScrollBbarExists = blockContent.scrollHeight > blockContent.clientHeight; + if (scrollBbarExists === null) { + scrollBbarExists = currentScrollBbarExists; + } + if (currentScrollBbarExists != scrollBbarExists) { + scrollBbarExists = currentScrollBbarExists; + return; + } + objResizes.forEach((obj) => { + const id = stringToNumber(obj.target.id); + if (mode != EDITING && !changedMonitors.includes(id)) { + changedMonitors.push(id); + } + }); +}); + // Kick everything off $j(window).on('load', () => initPage());