progressBar conversion
Convert progressBar to jquery and imporove granularity and performancepull/2077/head
parent
005190ab44
commit
3a4a7ada41
|
@ -176,22 +176,14 @@ span.noneCue {
|
||||||
|
|
||||||
#progressBar {
|
#progressBar {
|
||||||
position: relative;
|
position: relative;
|
||||||
border: 1px solid #666666;
|
top: -1.5em;
|
||||||
height: 15px;
|
height: 1.5em;
|
||||||
margin: 0 auto;
|
margin: 0 auto -1.5em auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#progressBar .progressBox {
|
#progressBar .progressBox {
|
||||||
position: absolute;
|
height: 1.5em;
|
||||||
top: 0px;
|
background: rgba(170, 170, 170, .7);
|
||||||
left: 0px;
|
|
||||||
height: 15px;
|
|
||||||
background: #eeeeee;
|
|
||||||
border-left: 1px solid #999999;
|
|
||||||
}
|
|
||||||
|
|
||||||
#progressBar .complete {
|
|
||||||
background: #aaaaaa;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#eventStills {
|
#eventStills {
|
||||||
|
|
|
@ -159,22 +159,14 @@ span.noneCue {
|
||||||
|
|
||||||
#progressBar {
|
#progressBar {
|
||||||
position: relative;
|
position: relative;
|
||||||
border: 1px solid #666666;
|
top: -1.5em;
|
||||||
height: 15px;
|
height: 1.5em;
|
||||||
margin: 0 auto;
|
margin: 0 auto -1.5em auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#progressBar .progressBox {
|
#progressBar .progressBox {
|
||||||
position: absolute;
|
height: 1.5em;
|
||||||
top: 0px;
|
background: rgba(170, 170, 170, .7);
|
||||||
left: 0px;
|
|
||||||
height: 15px;
|
|
||||||
background: #eeeeee;
|
|
||||||
border-left: 1px solid #999999;
|
|
||||||
}
|
|
||||||
|
|
||||||
#progressBar .complete {
|
|
||||||
background: #aaaaaa;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#eventStills {
|
#eventStills {
|
||||||
|
|
|
@ -170,22 +170,14 @@ span.noneCue {
|
||||||
|
|
||||||
#progressBar {
|
#progressBar {
|
||||||
position: relative;
|
position: relative;
|
||||||
border: 1px solid #666666;
|
top: -1.5em;
|
||||||
height: 15px;
|
height: 1.5em;
|
||||||
margin: 0 auto;
|
margin: 0 auto -1.5em auto;
|
||||||
}
|
}
|
||||||
|
|
||||||
#progressBar .progressBox {
|
#progressBar .progressBox {
|
||||||
position: absolute;
|
height: 1.5em;
|
||||||
top: 0px;
|
background: rgba(170, 170, 170, .7);
|
||||||
left: 0px;
|
|
||||||
height: 15px;
|
|
||||||
background: #eeeeee;
|
|
||||||
border-left: 1px solid #999999;
|
|
||||||
}
|
|
||||||
|
|
||||||
#progressBar .complete {
|
|
||||||
background: #aaaaaa;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#eventStills {
|
#eventStills {
|
||||||
|
|
|
@ -85,10 +85,6 @@ parseSort();
|
||||||
parseFilter( $_REQUEST['filter'] );
|
parseFilter( $_REQUEST['filter'] );
|
||||||
$filterQuery = $_REQUEST['filter']['query'];
|
$filterQuery = $_REQUEST['filter']['query'];
|
||||||
|
|
||||||
$panelSections = 40;
|
|
||||||
$panelSectionWidth = (int)ceil(reScale($Event->Width(),$scale)/$panelSections);
|
|
||||||
$panelWidth = ($panelSections*$panelSectionWidth-1);
|
|
||||||
|
|
||||||
$connkey = generateConnKey();
|
$connkey = generateConnKey();
|
||||||
|
|
||||||
$focusWindow = true;
|
$focusWindow = true;
|
||||||
|
@ -195,6 +191,10 @@ if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
|
||||||
}
|
}
|
||||||
} // end if stream method
|
} // end if stream method
|
||||||
?>
|
?>
|
||||||
|
<div id="alarmCueJpeg" class="alarmCue" style="width: <?php echo reScale($Event->Width(), $scale);?>px;"></div>
|
||||||
|
<div id="progressBar" style="width: <?php echo reScale($Event->Width(), $scale);?>px;">
|
||||||
|
<div class="progressBox" id="progressBox" title="" style="width: 0%;"></div>
|
||||||
|
</div><!--progressBar-->
|
||||||
<p id="dvrControls" class="dvrControls">
|
<p id="dvrControls" class="dvrControls">
|
||||||
<input type="button" value="<+" id="prevBtn" title="<?php echo translate('Prev') ?>" class="inactive" onclick="streamPrev( true );"/>
|
<input type="button" value="<+" id="prevBtn" title="<?php echo translate('Prev') ?>" class="inactive" onclick="streamPrev( true );"/>
|
||||||
<input type="button" value="<<" id="fastRevBtn" title="<?php echo translate('Rewind') ?>" class="inactive" disabled="disabled" onclick="streamFastRev( true );"/>
|
<input type="button" value="<<" id="fastRevBtn" title="<?php echo translate('Rewind') ?>" class="inactive" disabled="disabled" onclick="streamFastRev( true );"/>
|
||||||
|
@ -212,12 +212,6 @@ if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
|
||||||
<span id="progress"><?php echo translate('Progress') ?>: <span id="progressValue"></span>s</span>
|
<span id="progress"><?php echo translate('Progress') ?>: <span id="progressValue"></span>s</span>
|
||||||
<span id="zoom"><?php echo translate('Zoom') ?>: <span id="zoomValue"></span>x</span>
|
<span id="zoom"><?php echo translate('Zoom') ?>: <span id="zoomValue"></span>x</span>
|
||||||
</div>
|
</div>
|
||||||
<div id="progressBar" class="invisible">
|
|
||||||
<?php for ( $i = 0; $i < $panelSections; $i++ ) { ?>
|
|
||||||
<div class="progressBox" id="progressBox<?php echo $i ?>" title=""></div>
|
|
||||||
<?php } ?>
|
|
||||||
</div><!--progressBar-->
|
|
||||||
<div id="alarmCueJpeg" class="alarmCue" style="width: <?php echo reScale($Event->Width(), $scale);?>px;"></div>
|
|
||||||
</div><!--imageFeed-->
|
</div><!--imageFeed-->
|
||||||
</div>
|
</div>
|
||||||
<?php } /*end if !DefaultVideo*/ ?>
|
<?php } /*end if !DefaultVideo*/ ?>
|
||||||
|
|
|
@ -216,7 +216,7 @@ function getCmdResponse( respObj, respText ) {
|
||||||
streamImg.src = streamImg.src.replace( /auth=\w+/i, 'auth='+streamStatus.auth );
|
streamImg.src = streamImg.src.replace( /auth=\w+/i, 'auth='+streamStatus.auth );
|
||||||
} // end if haev a new auth hash
|
} // end if haev a new auth hash
|
||||||
|
|
||||||
streamCmdTimer = streamQuery.delay( streamTimeout );
|
streamCmdTimer = streamQuery.delay( streamTimeout ); //Timeout is refresh rate for progressBox and time display
|
||||||
}
|
}
|
||||||
|
|
||||||
var streamReq = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'chain', onSuccess: getCmdResponse } );
|
var streamReq = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'chain', onSuccess: getCmdResponse } );
|
||||||
|
@ -800,57 +800,30 @@ function videoEvent() {
|
||||||
createPopup( '?view=video&eid='+eventData.Id, 'zmVideo', 'video', eventData.Width, eventData.Height );
|
createPopup( '?view=video&eid='+eventData.Id, 'zmVideo', 'video', eventData.Width, eventData.Height );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called on each event load, because each event can be a different length.
|
// Called on each event load because each event can be a different width
|
||||||
function drawProgressBar() {
|
function drawProgressBar() {
|
||||||
// Make it invisible so we don't see the update happen
|
var barWidth = (eventData.Width * $j('#scale').val()) / SCALE_BASE;
|
||||||
$('progressBar').addClass( 'invisible' );
|
$j('#progressBar').css( 'width', barWidth );
|
||||||
var barWidth = 0;
|
|
||||||
var cells = $('progressBar').getElements( 'div' );
|
|
||||||
var cells_length = cells.length;
|
|
||||||
var cellWidth = parseInt( ((eventData.Width * $j('#scale').val()) / SCALE_BASE) / cells_length );
|
|
||||||
|
|
||||||
for ( var index = 0; index < cells_length; index += 1 ) {
|
|
||||||
var cell = $( cells[index] );
|
|
||||||
function test (cell, index) {
|
|
||||||
if ( index == 0 )
|
|
||||||
cell.setStyles( { 'left': barWidth, 'width': cellWidth, 'borderLeft': 0 } );
|
|
||||||
else
|
|
||||||
cell.setStyles( { 'left': barWidth, 'width': cellWidth } );
|
|
||||||
|
|
||||||
var offset = parseInt( (index*eventData.Length)/cells_length );
|
|
||||||
cell.setProperty( 'title', '+'+secsToTime(offset)+'s' );
|
|
||||||
cell.removeEvents( 'click' );
|
|
||||||
cell.addEvent( 'click', function() { streamSeek( offset ); } );
|
|
||||||
barWidth += cell.getCoordinates().width;
|
|
||||||
}
|
|
||||||
test (cell, index);
|
|
||||||
}
|
|
||||||
$('progressBar').setStyle( 'width', barWidth );
|
|
||||||
$('progressBar').removeClass( 'invisible' );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Changes the colour of the cells making up the completed progress bar
|
// Shows current stream progress.
|
||||||
function updateProgressBar() {
|
function updateProgressBar() {
|
||||||
if ( ! ( eventData && streamStatus ) ) {
|
if ( ! ( eventData && streamStatus ) ) {
|
||||||
return;
|
return;
|
||||||
} // end if ! eventData && streamStatus
|
} // end if ! eventData && streamStatus
|
||||||
var cells = $('progressBar').getElements( 'div' );
|
var curWidth = (streamStatus.progress / parseFloat(eventData.Length)) * 100;
|
||||||
var cells_length = cells.length;
|
$j("#progressBox").css('width', curWidth + '%');
|
||||||
var completeIndex = parseInt(((cells_length+1)*streamStatus.progress)/eventData.Length);
|
|
||||||
for ( var index = 0; index < cells_length; index += 1 ) {
|
|
||||||
var cell = $( cells[index] );
|
|
||||||
if ( index < completeIndex ) {
|
|
||||||
if ( !cell.hasClass( 'complete' ) ) {
|
|
||||||
cell.addClass( 'complete' );
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if ( cell.hasClass( 'complete' ) ) {
|
|
||||||
cell.removeClass( 'complete' );
|
|
||||||
}
|
|
||||||
} // end if
|
|
||||||
} // end function
|
|
||||||
} // end function updateProgressBar()
|
} // end function updateProgressBar()
|
||||||
|
|
||||||
|
// Handles seeking when clicking on the progress bar.
|
||||||
|
function progressBarSeek (){
|
||||||
|
$j('#progressBar').click(function(e){
|
||||||
|
var x = e.pageX - $j(this).offset().left;
|
||||||
|
var seekTime = (x / $j('#progressBar').width()) * parseFloat(eventData.Length);
|
||||||
|
streamSeek (seekTime);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function handleClick( event ) {
|
function handleClick( event ) {
|
||||||
var target = event.target;
|
var target = event.target;
|
||||||
var x = event.page.x - $(target).getLeft();
|
var x = event.page.x - $(target).getLeft();
|
||||||
|
@ -982,6 +955,7 @@ function initPage() {
|
||||||
window.videoobj.load();
|
window.videoobj.load();
|
||||||
streamPlay(); */
|
streamPlay(); */
|
||||||
} else {
|
} else {
|
||||||
|
progressBarSeek ();
|
||||||
streamCmdTimer = streamQuery.delay( 250 );
|
streamCmdTimer = streamQuery.delay( 250 );
|
||||||
eventQuery.pass( eventData.Id ).delay( 500 );
|
eventQuery.pass( eventData.Id ).delay( 500 );
|
||||||
initialAlarmCues(eventData.Id); //call ajax+renderAlarmCues for nph-zms.
|
initialAlarmCues(eventData.Id); //call ajax+renderAlarmCues for nph-zms.
|
||||||
|
|
Loading…
Reference in New Issue