replayAll fixes

replayAll now handles end of events gracefully.  Fixed bug where back to back continuous events or events that overlap would cause it to try to countdown all of epoch time.
This commit is contained in:
digital-gnome 2017-10-11 20:24:39 -04:00
parent 798b4838bd
commit 067f8a8089
5 changed files with 47 additions and 15 deletions

View File

@ -1,3 +1,11 @@
.vjsMessage {
font-size: 2em;
line-height: 1.5;
color: white;
background-color: black;
display: inline-block;
}
.alarmCue { .alarmCue {
background-color: #222222; background-color: #222222;
height: 1.5em; height: 1.5em;

View File

@ -1,3 +1,11 @@
.vjsMessage {
font-size: 2em;
line-height: 1.5;
color: white;
background-color: black;
display: inline-block;
}
.alarmCue { .alarmCue {
background-color: #222222; background-color: #222222;
height: 1.5em; height: 1.5em;

View File

@ -1,3 +1,11 @@
.vjsMessage {
font-size: 2em;
line-height: 1.5;
color: white;
background-color: black;
display: inline-block;
}
.alarmCue { .alarmCue {
background-color: #222222; background-color: #222222;
height: 1.5em; height: 1.5em;

View File

@ -172,10 +172,9 @@ if ( $Event->DefaultVideo() ) {
vjsReplay(<?php echo (strtotime($Event->StartTime()) + $Event->Length())*1000 ?>); vjsReplay(<?php echo (strtotime($Event->StartTime()) + $Event->Length())*1000 ?>);
</script> </script>
<p id="replayAllCountDown"></p> <p id="dvrControls" class="dvrControls">
<p id="dvrControlsVjs" class="dvrControls"> <input type="button" value="&lt;+" id="prevBtn" title="<?php echo translate('Prev') ?>" class="inactive" onclick="streamPrev( true );"/>
<input type="button" value="&lt;+" id="prevBtnVjs" title="<?php echo translate('Prev') ?>" class="inactive" onclick="streamPrev( true );"/> <input type="button" value="+&gt;" id="nextBtn" title="<?php echo translate('Next') ?>" class="inactive" onclick="streamNext( true );"/>
<input type="button" value="+&gt;" id="nextBtnVjs" title="<?php echo translate('Next') ?>" class="inactive" onclick="streamNext( true );"/>
</p> </p>
<?php <?php

View File

@ -11,17 +11,26 @@ function vjsReplay(endTime) {
player.play(); player.play();
break; break;
case 'all': case 'all':
// nextEventStartTime.getTime() is a mootools workaround, highjacks Date.parse if (nextEventId == 0) {
var gapDuration = (new Date().getTime()) + (nextEventStartTime.getTime() - endTime); $j("#videoobj").html('<p class="vjsMessage">No more events</p>');
} else {
var nextStartTime = nextEventStartTime.getTime(); //nextEventStartTime.getTime() is a mootools workaround, highjacks Date.parse
if (nextStartTime <= endTime) {
streamNext( true );
return;
}
$j("#videoobj").html('<p class="vjsMessage"></p>');
var gapDuration = (new Date().getTime()) + (nextStartTime - endTime);
var x = setInterval(function() { var x = setInterval(function() {
var now = new Date().getTime(); var now = new Date().getTime();
var remainder = new Date(Math.round(gapDuration - now)).toISOString().substr(11,8);; var remainder = new Date(Math.round(gapDuration - now)).toISOString().substr(11,8);
$j("#replayAllCountDown").html(remainder + " to next event."); $j(".vjsMessage").html(remainder + ' to next event.');
if (remainder < 0) { if (remainder < 0) {
clearInterval(x); clearInterval(x);
streamNext( true ); streamNext( true );
} }
}, 1000); }, 1000);
}
break; break;
case 'gapless': case 'gapless':
streamNext( true ); streamNext( true );