diff --git a/web/ajax/stream.php b/web/ajax/stream.php index 5e9798011..637c43dc9 100644 --- a/web/ajax/stream.php +++ b/web/ajax/stream.php @@ -106,8 +106,9 @@ switch ( $data['type'] ) $data = unpack( "ltype/imonitor/istate/dfps/ilevel/irate/ddelay/izoom/Cdelayed/Cpaused/Cenabled/Cforced", $msg ); $data['fps'] = sprintf( "%.2f", $data['fps'] ); $data['rate'] /= RATE_BASE; - $data['delay'] = sprintf( "%.2f", $data['delay'] ); - $data['zoom'] = sprintf( "%.1f", $data['zoom']/SCALE_BASE ); + $data['delay'] = round( $data['delay'], 2 ); + $data['zoom'] = round( $data['zoom']/SCALE_BASE, 1 ); + $data['auth'] = generateAuthHash( ZM_AUTH_HASH_IPS ); ajaxResponse( array( 'status'=>$data ) ); break; } @@ -116,7 +117,8 @@ switch ( $data['type'] ) $data = unpack( "ltype/ievent/iprogress/irate/izoom/Cpaused", $msg ); //$data['progress'] = sprintf( "%.2f", $data['progress'] ); $data['rate'] /= RATE_BASE; - $data['zoom'] = sprintf( "%.1f", $data['zoom']/SCALE_BASE ); + $data['zoom'] = round( $data['zoom']/SCALE_BASE, 1 ); + $data['auth'] = generateAuthHash( ZM_AUTH_HASH_IPS ); ajaxResponse( array( 'status'=>$data ) ); break; } diff --git a/web/skins/classic/views/js/event.js b/web/skins/classic/views/js/event.js index a1b2a2e55..b02d91742 100644 --- a/web/skins/classic/views/js/event.js +++ b/web/skins/classic/views/js/event.js @@ -73,6 +73,13 @@ function getCmdResponse( respObj, respText ) updateProgressBar(); + if ( streamStatus.auth ) { + // Try to reload the image stream. + var streamImg = document.getElementById('evtStream'); + if ( streamImg ) + streamImg.src = streamImg.src.replace( /auth=\w+/i, 'auth='+streamStatus.auth ); + } // end if haev a new auth hash + streamCmdTimer = streamQuery.delay( streamTimeout ); } diff --git a/web/skins/classic/views/js/montage.js b/web/skins/classic/views/js/montage.js index a6c459760..ab86399c6 100644 --- a/web/skins/classic/views/js/montage.js +++ b/web/skins/classic/views/js/montage.js @@ -87,6 +87,12 @@ function Monitor( index, monitorData ) $('alarmSound').addClass( 'hidden' ); } } + if ( this.status.auth ) { + // Try to reload the image stream. + if ( stream ) + stream.src = stream.src.replace( /auth=\w+/i, 'auth='+this.status.auth ); + console.log("Changed auth to " + this.status.auth ); + } // end if haev a new auth hash } else { diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index 264a4b65f..91c699d36 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -209,6 +209,12 @@ function getStreamCmdResponse( respObj, respText ) } $('enableDisableAlarms').removeClass( 'hidden' ); } + if ( streamStatus.auth ) { + // Try to reload the image stream. + var streamImg = document.getElementById('liveStream'); + if ( streamImg ) + streamImg.src = streamImg.src.replace( /auth=\w+/i, 'auth='+streamStatus.auth ); + } // end if haev a new auth hash } else { checkStreamForErrors("getStreamCmdResponse",respObj);//log them