Handle stream having something other than an img as it's display

This commit is contained in:
Isaac Connor 2021-03-23 13:53:45 -04:00
parent 37a8f007c8
commit 1c8a850acf
1 changed files with 13 additions and 2 deletions

View File

@ -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];
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;