diff --git a/web/skins/classic/views/event.php b/web/skins/classic/views/event.php index 12fd62c20..bc8fa324e 100644 --- a/web/skins/classic/views/event.php +++ b/web/skins/classic/views/event.php @@ -38,6 +38,8 @@ $Monitor = $Event->Monitor(); if (isset($_REQUEST['rate'])) { $rate = validInt($_REQUEST['rate']); +} else if ( isset($_COOKIE['zmEventRate']) ) { + $rate = $_COOKIE['zmEventRate']; } else { $rate = reScale(RATE_BASE, $Monitor->DefaultRate(), ZM_WEB_DEFAULT_RATE); } diff --git a/web/skins/classic/views/js/event.js b/web/skins/classic/views/js/event.js index 7f46936a9..9981b1458 100644 --- a/web/skins/classic/views/js/event.js +++ b/web/skins/classic/views/js/event.js @@ -235,6 +235,7 @@ function getCmdResponse( respObj, respText ) { streamPause( ); } else { $j('#rateValue').html(streamStatus.rate); + Cookie.write('zmEventRate', streamStatus.rate*100, {duration: 10*365}); streamPlay( ); } $j('#progressValue').html(secsToTime(parseInt(streamStatus.progress))); @@ -303,8 +304,10 @@ function playClicked( ) { } function vjsPlay() { //catches if we change mode programatically - stopFastRev(); + if ( intervalRewind ) + stopFastRev(); $j('#rateValue').html(vid.playbackRate()); + Cookie.write('zmEventRate', vid.playbackRate(), {duration: 10*365}); streamPlay(); } @@ -331,6 +334,7 @@ function streamFastFwd( action ) { if ( rates.indexOf(vid.playbackRate()*100)-1 == -1 ) setButtonState($('fastFwdBtn'), 'unavail'); $j('#rateValue').html(vid.playbackRate()); + Cookie.write('zmEventRate', vid.playbackRate()*100, {duration: 10*365}); } else { streamReq.send(streamParms+"&command="+CMD_FASTFWD); } @@ -359,6 +363,7 @@ function streamSlowRev( action ) { function stopFastRev() { clearInterval(intervalRewind); vid.playbackRate(1); + Cookie.write('zmEventRate', vid.playbackRate()*100, {duration: 10*365}); revSpeed = .5; } @@ -369,13 +374,14 @@ function streamFastRev( action ) { setButtonState( $('slowFwdBtn'), 'unavail' ); setButtonState( $('slowRevBtn'), 'unavail' ); setButtonState( $('fastRevBtn'), 'active' ); - if ( vid ) { //There is no reverse play with mp4. Set the speed to 0 and manualy set the time back. + if ( vid ) { //There is no reverse play with mp4. Set the speed to 0 and manually set the time back. revSpeed = rates[rates.indexOf(revSpeed*100)-1]/100; if ( rates.indexOf(revSpeed*100) == 0 ) { setButtonState( $('fastRevBtn'), 'unavail' ); } clearInterval(intervalRewind); $j('#rateValue').html(-revSpeed); + Cookie.write('zmEventRate', vid.playbackRate()*100, {duration: 10*365}); intervalRewind = setInterval(function() { if (vid.currentTime() <= 0) { clearInterval(intervalRewind); @@ -997,8 +1003,13 @@ function initPage() { vid.on('pause', vjsPause); vid.on('click', function(event){handleClick(event);}); vid.on('timeupdate', function (){$j('#progressValue').html(secsToTime(Math.floor(vid.currentTime())))}); + + if ( rate > 1 ) { + // rate should be 100 = 1x, etc. + vid.playbackRate(rate/100); + } } else { - progressBarNav (); + progressBarNav(); streamCmdTimer = streamQuery.delay( 250 ); if ( canStreamNative ) { var imageFeed = $('imageFeed'); diff --git a/web/skins/classic/views/js/event.js.php b/web/skins/classic/views/js/event.js.php index b1924a752..8783bbe06 100644 --- a/web/skins/classic/views/js/event.js.php +++ b/web/skins/classic/views/js/event.js.php @@ -41,6 +41,7 @@ var filterQuery = ''; var rates = ; +var rate = ''; // really only used when setting up initial playback rate. var scale = ""; var LabelFormat = "LabelFormat())?>";