From 1c8a850acfcd2ea8e12f964dac4e39e13297f47d Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 23 Mar 2021 13:53:45 -0400 Subject: [PATCH] Handle stream having something other than an img as it's display --- web/js/MonitorStream.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/web/js/MonitorStream.js b/web/js/MonitorStream.js index bcf9321b2..a10d90008 100644 --- a/web/js/MonitorStream.js +++ b/web/js/MonitorStream.js @@ -17,11 +17,22 @@ function MonitorStream(monitorData) { this.refresh = monitorData.refresh; this.start = function(delay) { // Step 1 make sure we are streaming instead of a static image - var stream = $j('#liveStream'+this.id)[0]; - if ( ! stream ) { + var stream = $j('#liveStream'+this.id); + if (!stream.length) { console.log('No live stream'); return; } + stream = stream[0]; + if ( !stream ) { + console.log('No live stream'); + return; + } + if ( !stream.src ) { + // Website Monitors won't have an img tag + console.log('No src for #liveStream'+this.id); + console.log(stream); + return; + } src = stream.src.replace(/mode=single/i, 'mode=jpeg'); if ( -1 == src.search('connkey') ) { src += '&connkey='+this.connKey;