removealarmcuesPHP
removed the PHP rendering and placement code
This commit is contained in:
parent
d4cf84f7e6
commit
c39cf77a9c
|
@ -219,7 +219,7 @@ if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
|
|||
<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;"><?php renderAlarmCues ();?></div>
|
||||
<div id="alarmCueJpeg" class="alarmCue" style="width: <?php echo reScale($Event->Width(), $scale);?>px;"></div>
|
||||
</div><!--imageFeed-->
|
||||
</div>
|
||||
<?php } /*end if !DefaultVideo*/ ?>
|
||||
|
@ -265,11 +265,5 @@ if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
|
|||
} // end if Event exists
|
||||
?>
|
||||
</div><!--page-->
|
||||
<!-- Alarm Cues on video. -->
|
||||
<script type="text/javascript">
|
||||
alarmHtml = '<div class="alarmCue">' + alarmHtml + '</div>'
|
||||
$j(".vjs-progress-control").append(alarmHtml);
|
||||
$j(".vjs-control-bar").addClass("vjs-zm");
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
@ -47,80 +47,3 @@ var canStreamNative = <?php echo canStreamNative()?'true':'false' ?>;
|
|||
//
|
||||
var deleteString = "<?php echo translate('Delete') ?>";
|
||||
var causeString = "<?php echo translate('AttrCause') ?>";
|
||||
|
||||
//
|
||||
// AlarmCues
|
||||
//
|
||||
<?php
|
||||
function renderAlarmCues () {
|
||||
global $Event, $scale;
|
||||
$sql = 'SELECT *, unix_timestamp(TimeStamp) AS UnixTimeStamp FROM Frames WHERE EventID = ? ORDER BY FrameId';
|
||||
$frames = dbFetchAll($sql, NULL, array($_REQUEST['eid']));
|
||||
if (count($frames)) {
|
||||
$width = reScale($Event->Width(), $scale);
|
||||
$lastFrame = end($frames);
|
||||
$lastTime = $lastFrame['Delta'] * 100;
|
||||
$ratio = $width / $lastTime;
|
||||
$minAlarm = ceil(1 / $ratio);
|
||||
$spanTimeStart = 0;
|
||||
$spanTimeEnd = 0;
|
||||
$alarmed = 0;
|
||||
$alarmHtml = "";
|
||||
$pixSkewNone = 0;
|
||||
$pixSkewAlarm = 0;
|
||||
$skip = 0;
|
||||
foreach ($frames as $key => $frame) {
|
||||
if ($frame['Type'] == "Alarm" && $alarmed == 0) { //From nothing to alarm. End nothing and start alarm.
|
||||
if ($skip > $key) continue;
|
||||
$alarmed = 1;
|
||||
if ($frame['Delta'] == 0) continue; //If event starts with alarm
|
||||
$spanTimeEnd = $frame['Delta'] * 100;
|
||||
$spanTime = $spanTimeEnd - $spanTimeStart;
|
||||
$pix = $ratio * $spanTime;
|
||||
$pixSkewNone += $pix - round($pix);
|
||||
$pix = round($pix);
|
||||
if (($pixSkewNone > 1 || $pixSkewNone < -1) && $pix + round($pixSkewNone) > 0) { //add skew if it's a pixel and won't zero span
|
||||
$pix += round($pixSkewNone);
|
||||
$pixSkewNone = $pixSkewNone - round($pixSkewNone);
|
||||
}
|
||||
$alarmHtml .= "<span class=\"alarmCue noneCue\" style=\"width:" . $pix . "px;\"></span>";
|
||||
$spanTimeStart = $spanTimeEnd;
|
||||
} elseif ($frame['Type'] !== "Alarm" && $alarmed == 1) { //from Alarm to nothing. End alarm and start nothing.
|
||||
if ($skip > $key) continue;
|
||||
$futNone = 0;
|
||||
$keyPlus = $key + 1;
|
||||
while ($futNone < $minAlarm) { //check ahead to see if there's enough for a none.
|
||||
if (!array_key_exists($keyPlus, $frames )) break; //check if end of event
|
||||
$futNone = ($frames[$keyPlus]['Delta'] * 100) - ($frame['Delta'] * 100);
|
||||
if ($frames[$keyPlus]['Type'] == "Alarm") {
|
||||
$skip = $keyPlus;
|
||||
continue 2;
|
||||
}
|
||||
$keyPlus +=1;
|
||||
}
|
||||
if ((($frame['Delta'] * 100) - $spanTimeStart) < $minAlarm && (array_key_exists($keyPlus, $frames))) continue; //alarm short and more event
|
||||
$spanTimeEnd = $frame['Delta'] * 100;
|
||||
$spanTime = $spanTimeEnd - $spanTimeStart;
|
||||
$alarmed = 0;
|
||||
$pix = $ratio * $spanTime;
|
||||
$pixSkewAlarm += $pix - round($pix);
|
||||
$pix = round($pix);
|
||||
if (($pixSkewAlarm > 1 || $pixSkewAlarm < -1) && $pix + round($pixSkewAlarm) > 0) {
|
||||
$pix += round($pixSkewAlarm);
|
||||
$pixSkewAlarm = $pixSkewAlarm - round($pixSkewAlarm);
|
||||
}
|
||||
$alarmHtml .= "<span class=\"alarmCue\" style=\"width:" . $pix . "px;\"></span>";
|
||||
$spanTimeStart = $spanTimeEnd;
|
||||
} elseif ($frame['Type'] == "Alarm" && $alarmed == 1 && !array_key_exists($key+1, $frames)) { // event ends on alarm
|
||||
$spanTimeEnd = $frame['Delta'] * 100;
|
||||
$spanTime = $spanTimeEnd - $spanTimeStart;
|
||||
$alarmed = 0;
|
||||
$pix = round($ratio * $spanTime);
|
||||
$alarmHtml .= "<span class=\"alarmCue\" style=\"width:" . $pix . "px;\"></span>";
|
||||
}
|
||||
}
|
||||
echo $alarmHtml;
|
||||
}
|
||||
}
|
||||
?>
|
||||
var alarmHtml = '<?php renderAlarmCues (); ?>';
|
||||
|
|
Loading…
Reference in New Issue