work on fixing event view
parent
07ae6b6aa2
commit
cf9fa78ca3
|
@ -1243,7 +1243,14 @@ bool EventStream::sendFrame( int delta_us ) {
|
|||
static struct stat filestat;
|
||||
FILE *fdj = NULL;
|
||||
|
||||
if ( monitor->GetOptSaveJPEGs() & 1) {
|
||||
snprintf( filepath, sizeof(filepath), Event::capture_file_format, event_data->path, curr_frame_id );
|
||||
} else if ( monitor->GetOptSaveJPEGs() & 2 ) {
|
||||
snprintf( filepath, sizeof(filepath), Event::analyse_file_format, event_data->path, curr_frame_id );
|
||||
} else {
|
||||
Fatal("JPEGS not saved.zms is not capable of streaming jpegs from mp4 yet");
|
||||
return false;
|
||||
}
|
||||
|
||||
#if HAVE_LIBAVCODEC
|
||||
if ( type == STREAM_MPEG ) {
|
||||
|
|
|
@ -76,7 +76,6 @@ Storage::Storage( unsigned int p_id ) {
|
|||
Debug(1,"No id passed to Storage constructor. Using default path %s instead", path );
|
||||
strcpy(name, "Default");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Storage::~Storage() {
|
||||
|
|
|
@ -18,9 +18,8 @@
|
|||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
|
||||
if ( !canView( 'Events' ) )
|
||||
{
|
||||
$view = "error";
|
||||
if ( !canView( 'Events' ) ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -117,8 +116,7 @@ xhtmlHeaders(__FILE__, translate('Event') );
|
|||
<div id="menuBar2">
|
||||
<div id="closeWindow"><a href="#" onclick="closeWindow();"><?php echo translate('Close') ?></a></div>
|
||||
<?php
|
||||
if ( canEdit( 'Events' ) )
|
||||
{
|
||||
if ( canEdit( 'Events' ) ) {
|
||||
?>
|
||||
<div id="deleteEvent"><a href="#" onclick="deleteEvent()"><?php echo translate('Delete') ?></a></div>
|
||||
<div id="editEvent"><a href="#" onclick="editEvent()"><?php echo translate('Edit') ?></a></div>
|
||||
|
@ -126,13 +124,11 @@ if ( canEdit( 'Events' ) )
|
|||
<div id="unarchiveEvent" class="hidden"><a href="#" onclick="unarchiveEvent()"><?php echo translate('Unarchive') ?></a></div>
|
||||
<?php
|
||||
}
|
||||
if ( canView( 'Events' ) )
|
||||
{
|
||||
if ( canView( 'Events' ) ) {
|
||||
?>
|
||||
<div id="framesEvent"><a href="#" onclick="showEventFrames()"><?php echo translate('Frames') ?></a></div>
|
||||
<?php
|
||||
if ( $event['SaveJPEGs'] & 3 )
|
||||
{
|
||||
if ( $event['SaveJPEGs'] & 3 ) { // frames or analysis
|
||||
?>
|
||||
<div id="stillsEvent"<?php if ( $streamMode == 'still' ) { ?> class="hidden"<?php } ?>><a href="#" onclick="showStills()"><?php echo translate('Stills') ?></a></div>
|
||||
<?php
|
||||
|
@ -143,8 +139,7 @@ if ( $event['SaveJPEGs'] & 3 )
|
|||
</div>
|
||||
<div id="eventVideo" class="">
|
||||
<?php
|
||||
if ( $event['DefaultVideo'] )
|
||||
{
|
||||
if ( $event['DefaultVideo'] ) {
|
||||
?>
|
||||
<div id="videoFeed">
|
||||
<video id="videoobj" class="video-js vjs-default-skin" width="<?php echo reScale( $event['Width'], $scale ) ?>" height="<?php echo reScale( $event['Height'], $scale ) ?>" data-setup='{ "controls": true, "playbackRates": [0.5, 1, 1.5, 2, 4, 8, 16, 32, 64, 128, 256], "autoplay": true, "preload": "auto", "plugins": { "zoomrotate": { "rotate": "<?php echo $Rotation ?>", "zoom": "<?php echo $Zoom ?>"}}}'>
|
||||
|
@ -166,26 +161,18 @@ addVideoTimingTrack(document.getElementById('videoobj'), LabelFormat, monitorNam
|
|||
</script>
|
||||
|
||||
<?php
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
?>
|
||||
<div id="imageFeed">
|
||||
<div id="imageFeed" <?php if ( $event['DefaultVideo'] ) { ?>class="hidden"<?php } ?> >
|
||||
<?php
|
||||
if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT )
|
||||
{
|
||||
if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
|
||||
$streamSrc = getStreamSrc( array( "source=event", "mode=mpeg", "event=".$eid, "frame=".$fid, "scale=".$scale, "rate=".$rate, "bitrate=".ZM_WEB_VIDEO_BITRATE, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "format=".ZM_MPEG_REPLAY_FORMAT, "replay=".$replayMode ) );
|
||||
outputVideoStream( "evtStream", $streamSrc, reScale( $event['Width'], $scale ), reScale( $event['Height'], $scale ), ZM_MPEG_LIVE_FORMAT );
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
$streamSrc = getStreamSrc( array( "source=event", "mode=jpeg", "event=".$eid, "frame=".$fid, "scale=".$scale, "rate=".$rate, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "replay=".$replayMode) );
|
||||
if ( canStreamNative() )
|
||||
{
|
||||
if ( canStreamNative() ) {
|
||||
outputImageStream( "evtStream", $streamSrc, reScale( $event['Width'], $scale ), reScale( $event['Height'], $scale ), validHtmlStr($event['Name']) );
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
outputHelperStream( "evtStream", $streamSrc, reScale( $event['Width'], $scale ), reScale( $event['Height'], $scale ) );
|
||||
}
|
||||
}
|
||||
|
@ -210,22 +197,17 @@ else
|
|||
</div>
|
||||
<div id="progressBar" class="invisible">
|
||||
<?php
|
||||
for ( $i = 0; $i < $panelSections; $i++ )
|
||||
{
|
||||
for ( $i = 0; $i < $panelSections; $i++ ) {
|
||||
?>
|
||||
<div class="progressBox" id="progressBox<?php echo $i ?>" title=""></div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if ($event['SaveJPEGs'] & 3)
|
||||
{
|
||||
if ($event['SaveJPEGs'] & 3) { // frames or analysis
|
||||
?>
|
||||
<div id="eventStills" class="hidden">
|
||||
<div id="eventThumbsPanel">
|
||||
|
|
|
@ -18,9 +18,8 @@
|
|||
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
//
|
||||
|
||||
if ( !canView( 'Events' ) )
|
||||
{
|
||||
$view = "error";
|
||||
if ( !canView( 'Events' ) ) {
|
||||
$view = 'error';
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -56,7 +55,13 @@ if ( isset( $_REQUEST['scale'] ) )
|
|||
else
|
||||
$scale = max( reScale( SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE ), SCALE_BASE );
|
||||
|
||||
$imageData = getImageSrc( $event, $frame, $scale, (isset($_REQUEST['show']) && $_REQUEST['show']=="capt") );
|
||||
$show = 'capt';
|
||||
if ( isset($_REQUEST['show']) ) {
|
||||
$show = $_REQUEST['show'];
|
||||
#} else if ( $imageData['hasAnalImage'] ) {
|
||||
#$show = 'anal';
|
||||
}
|
||||
$imageData = getImageSrc( $event, $frame, $scale, ($show=="capt") );
|
||||
|
||||
$imagePath = $imageData['thumbPath'];
|
||||
$eventPath = $imageData['eventPath'];
|
||||
|
@ -79,23 +84,16 @@ xhtmlHeaders(__FILE__, translate('Frame')." - ".$event['Id']." - ".$Frame->Frame
|
|||
</div>
|
||||
<div id="content">
|
||||
<p id="image">
|
||||
<?php if ( in_array($event['VideoWriter'],array("1","2")) ) { ?>
|
||||
<img src="?view=image&eid=<?php echo $event['Id'] ?>&fid=<?php echo $Frame->FrameId() ?>&scale=<?php echo $event['DefaultScale'] ?>&show=<?php echo $imageData['isAnalImage']?"capt":"anal" ?>" class="<?php echo $imageData['imageClass'] ?>" width="<?php echo reScale( $event['Width'], $event['DefaultScale'], $scale ) ?>" height="<?php echo reScale( $event['Height'], $event['DefaultScale'], $scale ) ?>" alt="<?php echo $Frame->EventId()."-".$Frame->FrameId() ?>">
|
||||
<?php } else {
|
||||
if ( $imageData['hasAnalImage'] ) { ?>
|
||||
<a href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $Frame->FrameId() ?>&scale=<?php echo $scale ?>&show=<?php echo $imageData['isAnalImage']?'capt':'anal' ?>">
|
||||
<?php } ?>
|
||||
<img src="<?php echo $Frame->getImageSrc($imageData['isAnalImage']?'analyse':'capture') ?>" width="<?php echo reScale( $event['Width'], $event['DefaultScale'], $scale ) ?>" height="<?php echo reScale( $event['Height'], $event['DefaultScale'], $scale ) ?>" alt="<?php echo $Frame->EventId()."-".$Frame->FrameId() ?>" class="<?php echo $imageData['imageClass'] ?>"/>
|
||||
<?php if ( $imageData['hasAnalImage'] ) { ?></a><?php } ?>
|
||||
<?php } ?>
|
||||
</p>
|
||||
<a href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $Frame->FrameId() ?>&scale=<?php echo $scale ?>&show=<?php echo $show == 'anal' ? 'capt':'anal' ?>">
|
||||
<img src="<?php echo $Frame->getImageSrc($imageData['isAnalImage']?'analyse':'capture') ?>" width="<?php echo reScale( $event['Width'], $event['DefaultScale'], $scale ) ?>" height="<?php echo reScale( $event['Height'], $event['DefaultScale'], $scale ) ?>" alt="<?php echo $Frame->EventId()."-".$Frame->FrameId() ?>" class="<?php echo $imageData['imageClass'] ?>"/>
|
||||
</p>
|
||||
<p id="controls">
|
||||
<?php if ( $Frame->FrameId() > 1 ) { ?>
|
||||
<a id="firstLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $firstFid ?>&scale=<?php echo $scale ?>"><?php echo translate('First') ?></a>
|
||||
<a id="prevLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $prevFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Prev') ?></a>
|
||||
<a id="firstLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $firstFid ?>&scale=<?php echo $scale ?>&show=<?php echo $show ?>"><?php echo translate('First') ?></a>
|
||||
<a id="prevLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $prevFid ?>&scale=<?php echo $scale ?>&show=<?php echo $show ?>"><?php echo translate('Prev') ?></a>
|
||||
<?php } if ( $Frame->FrameId() < $maxFid ) { ?>
|
||||
<a id="nextLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $nextFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Next') ?></a>
|
||||
<a id="lastLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $lastFid ?>&scale=<?php echo $scale ?>"><?php echo translate('Last') ?></a>
|
||||
<a id="nextLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $nextFid ?>&scale=<?php echo $scale ?>&show=<?php echo $show ?>"><?php echo translate('Next') ?></a>
|
||||
<a id="lastLink" href="?view=frame&eid=<?php echo $event['Id'] ?>&fid=<?php echo $lastFid ?>&scale=<?php echo $scale ?>&show=<?php echo $show ?>"><?php echo translate('Last') ?></a>
|
||||
<?php } ?>
|
||||
</p>
|
||||
<?php if (file_exists ($dImagePath)) { ?>
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
function setButtonState( element, butClass )
|
||||
{
|
||||
if ( element ) {
|
||||
element.className = butClass;
|
||||
element.disabled = (butClass != 'inactive');
|
||||
}
|
||||
}
|
||||
|
||||
function changeScale() {
|
||||
|
@ -87,7 +89,7 @@ function getCmdResponse( respObj, respText )
|
|||
streamCmdTimer = streamQuery.delay( streamTimeout );
|
||||
}
|
||||
|
||||
var streamReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'chain', onSuccess: getCmdResponse } );
|
||||
var streamReq = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'chain', onSuccess: getCmdResponse } );
|
||||
|
||||
function streamPause( action )
|
||||
{
|
||||
|
@ -251,7 +253,7 @@ function getEventResponse( respObj, respText )
|
|||
nearEventsQuery( eventData.Id );
|
||||
}
|
||||
|
||||
var eventReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getEventResponse } );
|
||||
var eventReq = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getEventResponse } );
|
||||
|
||||
function eventQuery( eventId )
|
||||
{
|
||||
|
@ -277,7 +279,7 @@ function getNearEventsResponse( respObj, respText )
|
|||
$('nextEventBtn').disabled = !nextEventId;
|
||||
}
|
||||
|
||||
var nearEventsReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getNearEventsResponse } );
|
||||
var nearEventsReq = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getNearEventsResponse } );
|
||||
|
||||
function nearEventsQuery( eventId )
|
||||
{
|
||||
|
@ -386,8 +388,12 @@ function hideEventImageComplete()
|
|||
{
|
||||
var eventImg = $('eventImage');
|
||||
var thumbImg = $('eventThumb'+$('eventImage').getProperty( 'alt' ));
|
||||
if ( thumbImg ) {
|
||||
thumbImg.removeClass('selected');
|
||||
thumbImg.setOpacity( 1.0 );
|
||||
} else {
|
||||
console.log("Unable to find eventThumb at " + 'eventThumb'+$('eventImage').getProperty( 'alt' ) );
|
||||
}
|
||||
$('prevImageBtn').disabled = true;
|
||||
$('nextImageBtn').disabled = true;
|
||||
$('eventImagePanel').setStyle( 'display', 'none' );
|
||||
|
@ -447,7 +453,7 @@ function getFrameResponse( respObj, respText )
|
|||
loadEventThumb( eventData, frame, respObj.loopback=="true" );
|
||||
}
|
||||
|
||||
var frameReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'chain', onSuccess: getFrameResponse } );
|
||||
var frameReq = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'chain', onSuccess: getFrameResponse } );
|
||||
|
||||
function frameQuery( eventId, frameId, loadImage )
|
||||
{
|
||||
|
@ -589,7 +595,7 @@ function getActResponse( respObj, respText )
|
|||
eventQuery( eventData.Id );
|
||||
}
|
||||
|
||||
var actReq = new Request.JSON( { url: thisUrl, method: 'post', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getActResponse } );
|
||||
var actReq = new Request.JSON( { url: thisUrl, method: 'get', timeout: AJAX_TIMEOUT, link: 'cancel', onSuccess: getActResponse } );
|
||||
|
||||
function actQuery( action, parms )
|
||||
{
|
||||
|
@ -639,6 +645,7 @@ function showEventFrames()
|
|||
function showVideo()
|
||||
{
|
||||
$('eventStills').addClass( 'hidden' );
|
||||
$('imageFeed').addClass('hidden');
|
||||
$('eventVideo').removeClass( 'hidden' );
|
||||
|
||||
$('stillsEvent').removeClass( 'hidden' );
|
||||
|
@ -651,7 +658,17 @@ function showVideo()
|
|||
function showStills()
|
||||
{
|
||||
$('eventStills').removeClass( 'hidden' );
|
||||
$('imageFeed').removeClass('hidden');
|
||||
$('eventVideo').addClass( 'hidden' );
|
||||
|
||||
if (vid && ( vid.paused != true ) ) {
|
||||
// Pause the video
|
||||
vid.pause();
|
||||
|
||||
// Update the button text to 'Play'
|
||||
//if ( playButton )
|
||||
//playButton.innerHTML = "Play";
|
||||
}
|
||||
|
||||
$('stillsEvent').addClass( 'hidden' );
|
||||
$('videoEvent').removeClass( 'hidden' );
|
||||
|
@ -659,8 +676,7 @@ function showStills()
|
|||
streamMode = 'stills';
|
||||
|
||||
streamPause( true );
|
||||
if ( !scroll )
|
||||
{
|
||||
if ( !scroll ) {
|
||||
scroll = new Fx.Scroll( 'eventThumbs', {
|
||||
wait: false,
|
||||
duration: 500,
|
||||
|
@ -745,6 +761,7 @@ function handleClick( event )
|
|||
}
|
||||
function setupListener()
|
||||
{
|
||||
// I think this stuff was to use our existing buttons instead of the videojs controls.
|
||||
|
||||
// Buttons
|
||||
var playButton = document.getElementById("play-pause");
|
||||
|
@ -840,42 +857,38 @@ function setupListener()
|
|||
});
|
||||
}
|
||||
|
||||
function initPage()
|
||||
{
|
||||
//FIXME prevent blocking...not sure what is happening or best way to unblock
|
||||
vid=$('videoobj');
|
||||
if (vid)
|
||||
{
|
||||
/*setupListener();
|
||||
vid.removeAttribute("controls");
|
||||
/* window.videoobj.oncanplay=null;
|
||||
window.videoobj.currentTime=window.videoobj.currentTime-1;
|
||||
window.videoobj.currentTime=window.videoobj.currentTime+1;//may not be symetrical of course
|
||||
|
||||
vid.onstalled=function(){window.vid.currentTime=window.vid.currentTime-1;window.vid.currentTime=window.vid.currentTime+1;}
|
||||
vid.onwaiting=function(){window.vid.currentTime=window.vid.currentTime-1;window.vid.currentTime=window.vid.currentTime+1;}
|
||||
vid.onloadstart=function(){window.vid.currentTime=window.vid.currentTime-1;window.vid.currentTime=window.vid.currentTime+1;}
|
||||
vid.onplay=function(){window.vid.currentTime=window.vid.currentTime-1;window.vid.currentTime=window.vid.currentTime+1;}
|
||||
vid.onplaying=function(){window.vid.currentTime=window.vid.currentTime-1;window.vid.currentTime=window.vid.currentTime+1;}
|
||||
//window.vid.hide();//does not help
|
||||
var sources = window.videoobj.getElementsByTagName('source');
|
||||
sources[0].src=null;
|
||||
window.videoobj.load();
|
||||
streamPlay(); */
|
||||
}
|
||||
else
|
||||
{
|
||||
streamCmdTimer = streamQuery.delay( 250 );
|
||||
eventQuery.pass( eventData.Id ).delay( 500 );
|
||||
function initPage() {
|
||||
//FIXME prevent blocking...not sure what is happening or best way to unblock
|
||||
vid = videojs("videoobj");
|
||||
if ( vid ) {
|
||||
/*
|
||||
setupListener();
|
||||
vid.removeAttribute("controls");
|
||||
/* window.videoobj.oncanplay=null;
|
||||
window.videoobj.currentTime=window.videoobj.currentTime-1;
|
||||
window.videoobj.currentTime=window.videoobj.currentTime+1;//may not be symetrical of course
|
||||
|
||||
if ( canStreamNative )
|
||||
{
|
||||
var streamImg = $('imageFeed').getElement('img');
|
||||
if ( !streamImg )
|
||||
streamImg = $('imageFeed').getElement('object');
|
||||
$(streamImg).addEvent( 'click', function( event ) { handleClick( event ); } );
|
||||
}
|
||||
vid.onstalled=function(){window.vid.currentTime=window.vid.currentTime-1;window.vid.currentTime=window.vid.currentTime+1;}
|
||||
vid.onwaiting=function(){window.vid.currentTime=window.vid.currentTime-1;window.vid.currentTime=window.vid.currentTime+1;}
|
||||
vid.onloadstart=function(){window.vid.currentTime=window.vid.currentTime-1;window.vid.currentTime=window.vid.currentTime+1;}
|
||||
vid.onplay=function(){window.vid.currentTime=window.vid.currentTime-1;window.vid.currentTime=window.vid.currentTime+1;}
|
||||
vid.onplaying=function(){window.vid.currentTime=window.vid.currentTime-1;window.vid.currentTime=window.vid.currentTime+1;}
|
||||
//window.vid.hide();//does not help
|
||||
var sources = window.videoobj.getElementsByTagName('source');
|
||||
sources[0].src=null;
|
||||
window.videoobj.load();
|
||||
streamPlay(); */
|
||||
} else {
|
||||
streamCmdTimer = streamQuery.delay( 250 );
|
||||
eventQuery.pass( eventData.Id ).delay( 500 );
|
||||
|
||||
if ( canStreamNative ) {
|
||||
var streamImg = $('imageFeed').getElement('img');
|
||||
if ( !streamImg )
|
||||
streamImg = $('imageFeed').getElement('object');
|
||||
$(streamImg).addEvent( 'click', function( event ) { handleClick( event ); } );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Kick everything off
|
||||
|
|
|
@ -74,8 +74,9 @@ if ( empty($_REQUEST['path']) ) {
|
|||
}
|
||||
|
||||
if ( ! file_exists( $path ) ) {
|
||||
Debug( "$path does not exist");
|
||||
# Generate the frame JPG
|
||||
if ( $Event->DefaultVideo() ) {
|
||||
if ( $show == 'capt' and $Event->DefaultVideo() ) {
|
||||
$command ='ffmpeg -i '.$Event->Path().'/'.$Event->DefaultVideo().' -vf "select=gte(n\\,'.$Frame->FrameId().'),setpts=PTS-STARTPTS" '.$path;
|
||||
#$command ='ffmpeg -v 0 -i '.$Storage->Path().'/'.$Event->Path().'/'.$Event->DefaultVideo().' -vf "select=gte(n\\,'.$Frame->FrameId().'),setpts=PTS-STARTPTS" '.$path;
|
||||
Debug( "Running $command" );
|
||||
|
|
Loading…
Reference in New Issue