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 {
background-color: #222222;
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 {
background-color: #222222;
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 {
background-color: #222222;
height: 1.5em;

View File

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

View File

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