Merge pull request #1125 from liucougar/smart_video_or_image

better way of detecting showing image or video in timeline and event view
This commit is contained in:
Steve Gilvarry 2015-10-26 08:07:17 +11:00
commit f5fedde139
3 changed files with 7 additions and 6 deletions

View File

@ -117,6 +117,7 @@ $statusData = array(
"Height" => true,
"Length" => true,
"Frames" => true,
"DefaultVideo" => true,
"AlarmFrames" => true,
"TotScore" => true,
"AvgScore" => true,

View File

@ -138,7 +138,7 @@ if ( $event['SaveJPEGs'] & 3 )
</div>
<div id="eventVideo" class="">
<?php
if ( $event['VideoWriter'] )
if ( $event['DefaultVideo'] )
{
?>
<link href="//vjs.zencdn.net/4.11/video-js.css" rel="stylesheet">

View File

@ -111,8 +111,8 @@ function previewEvent( eventId, frameId )
{
showEventDetail( events[eventId]['frames'][frameId]['html'] );
var imagePath = events[eventId].frames[frameId].Image.imagePath;
var showVideo = parseInt(monitors[events[eventId].MonitorId].VideoWriter);
loadEventImage( imagePath, eventId, frameId, events[eventId].Width, events[eventId].Height, events[eventId].Frames/events[eventId].Length, showVideo);
var videoName = events[eventId].DefaultVideo;
loadEventImage( imagePath, eventId, frameId, events[eventId].Width, events[eventId].Height, events[eventId].Frames/events[eventId].Length, videoName);
return;
}
}
@ -120,15 +120,15 @@ function previewEvent( eventId, frameId )
requestFrameData( eventId, frameId );
}
function loadEventImage( imagePath, eid, fid, width, height, fps, showVideo )
function loadEventImage( imagePath, eid, fid, width, height, fps, videoName )
{
var vid= $('preview');
var imageSrc = $('imageSrc');
if(showVideo)
if(videoName)
{
vid.show();
imageSrc.hide();
var newsource=imagePrefix+imagePath.slice(0,imagePath.lastIndexOf('/'))+"/event.mp4";
var newsource=imagePrefix+imagePath.slice(0,imagePath.lastIndexOf('/'))+"/"+videoName;
//console.log(newsource);
//console.log(sources[0].src.slice(-newsource.length));
if(newsource!=vid.currentSrc.slice(-newsource.length) || vid.readyState==0)