fix streamImg loading when using applet. Also don't alter actParms as it is not a global.

This commit is contained in:
Isaac Connor 2020-03-20 11:06:01 -04:00
parent 5fe1452a1a
commit ecaaae90f3
1 changed files with 23 additions and 16 deletions

View File

@ -54,7 +54,7 @@ function changeScale() {
streamImg.src = streamImg.src.replace(/scale=\d+/i, 'scale='+(scale== 'auto' ? autoScale : scale));
} else {
console.error('No element found for liveStream.');
console.error('No element found for liveStream'+monitorId);
}
}
@ -239,7 +239,6 @@ function getStreamCmdResponse(respObj, respText) {
streamCmdParms = streamCmdParms.replace(/auth=\w+/i, 'auth='+streamStatus.auth);
statusCmdParms = statusCmdParms.replace(/auth=\w+/i, 'auth='+streamStatus.auth);
eventCmdParms = eventCmdParms.replace(/auth=\w+/i, 'auth='+streamStatus.auth);
actParms = actParms.replace(/auth=\w+/i, 'auth='+streamStatus.auth);
controlParms = controlParms.replace(/auth=\w+/i, 'auth='+streamStatus.auth);
} // end if have a new auth hash
} // end if respObj.status
@ -722,10 +721,14 @@ function handleClick( event ) {
function appletRefresh() {
if ( streamStatus && (!streamStatus.paused && !streamStatus.delayed) ) {
var streamImg = $('liveStream');
var streamImg = $('liveStream'+monitorId);
if ( streamImg ) {
var parent = streamImg.getParent();
streamImg.dispose();
streamImg.inject( parent );
} else {
console.error("Nothing found for liveStream"+monitorId);
}
if ( appletRefreshTime ) {
appletRefresh.delay( appletRefreshTime*1000 );
}
@ -767,7 +770,7 @@ function reloadWebSite() {
function initPage() {
if ( monitorType != 'WebSite' ) {
if ( streamMode == "single" ) {
if ( streamMode == 'single' ) {
statusCmdTimer = statusCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
watchdogCheck.pass('status').periodical(statusRefreshTimeout*2);
} else {
@ -778,12 +781,15 @@ function initPage() {
eventCmdTimer = eventCmdQuery.delay( (Math.random()+0.1)*statusRefreshTimeout );
watchdogCheck.pass('event').periodical(eventsRefreshTimeout*2);
if ( canStreamNative || streamMode == "single" ) {
if ( canStreamNative || (streamMode == 'single') ) {
var streamImg = $('imageFeed').getElement('img');
if ( !streamImg ) {
streamImg = $('imageFeed').getElement('object');
}
if ( streamMode == "single" ) {
if ( !streamImg ) {
console.error('No streamImg found for imageFeed');
} else {
if ( streamMode == 'single' ) {
streamImg.addEvent('click', fetchImage.pass(streamImg));
fetchImage.pass(streamImg).periodical(imageRefreshTimeout);
} else {
@ -791,7 +797,8 @@ function initPage() {
handleClick(event);
});
}
}
} // end if have streamImg
} // streamMode native or single
if ( refreshApplet && appletRefreshTime ) {
appletRefresh.delay(appletRefreshTime*1000);