An ugly hack to make the liveStreams display in both index and view views.
This commit is contained in:
parent
d9bbcdf3a9
commit
eed6c81287
|
@ -9,7 +9,7 @@
|
||||||
$this->set('monitors', $this->Monitor->find('all', $monitoroptions));
|
$this->set('monitors', $this->Monitor->find('all', $monitoroptions));
|
||||||
$monitors = $this->Monitor->find('all', array('recursive' => -1, 'fields' => array('Id', 'StreamReplayBuffer')));
|
$monitors = $this->Monitor->find('all', array('recursive' => -1, 'fields' => array('Id', 'StreamReplayBuffer')));
|
||||||
foreach ($monitors as $monitor => $mon) {
|
foreach ($monitors as $monitor => $mon) {
|
||||||
$streamSrc[$monitor] = $this->Monitor->getStreamSrc($monitor['Monitor']['Id'], $zmBandwidth, $monitor['Monitor']['StreamReplayBuffer']);
|
$streamSrc[$mon['Monitor']['Id']] = $this->Monitor->getStreamSrc($mon['Monitor']['Id'], $zmBandwidth, $monitor['Monitor']['StreamReplayBuffer']);
|
||||||
}
|
}
|
||||||
$this->set('streamSrc', $streamSrc);
|
$this->set('streamSrc', $streamSrc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,9 +24,9 @@
|
||||||
$ZM_MPEG_LIVE_FORMAT = $ZM_MPEG_LIVE_FORMAT;
|
$ZM_MPEG_LIVE_FORMAT = $ZM_MPEG_LIVE_FORMAT;
|
||||||
|
|
||||||
if ($ZM_WEB_STREAM_METHOD == 'mpeg' && $ZM_MPEG_LIVE_FORMAT) {
|
if ($ZM_WEB_STREAM_METHOD == 'mpeg' && $ZM_MPEG_LIVE_FORMAT) {
|
||||||
return "/cgi-bin/nph-zms?mode=mpeg&scale=100&maxfps=$ZM_WEB_VIDEO_MAXFPS&bitrate=$ZM_WEB_VIDEO_BITRATE&format=$ZM_MPEG_LIVE_FORMAT";
|
return "/cgi-bin/nph-zms?mode=mpeg&scale=100&maxfps=$ZM_WEB_VIDEO_MAXFPS&bitrate=$ZM_WEB_VIDEO_BITRATE&format=$ZM_MPEG_LIVE_FORMAT&monitor=$id";
|
||||||
} else {
|
} else {
|
||||||
return "/cgi-bin/nph-zms?mode=jpeg&scale=100&maxfps=$ZM_WEB_VIDEO_MAXFPS&buffer=$buffer";
|
return "/cgi-bin/nph-zms?mode=jpeg&scale=100&maxfps=$ZM_WEB_VIDEO_MAXFPS&buffer=$buffer&monitor=$id";
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,8 +3,8 @@ App::uses('AppHelper', 'View/Helper');
|
||||||
|
|
||||||
class LiveStreamHelper extends AppHelper {
|
class LiveStreamHelper extends AppHelper {
|
||||||
public function makeLiveStream($name, $src, $id, $width=0) {
|
public function makeLiveStream($name, $src, $id, $width=0) {
|
||||||
$liveStream = "<img class=\"livestream_resize\" id=\"liveStream_$id\" alt=\"Live Stream of $name\" src=\"$src&monitor=$id\" width=\"$width\">";
|
$liveStream = "<img class=\"livestream_resize\" id=\"liveStream_$id\" alt=\"Live Stream of $name\" src=\"$src&monitor=$id\">";
|
||||||
return $liveStream;
|
return $src;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showNoImage($name, $src, $id, $width=0) {
|
public function showNoImage($name, $src, $id, $width=0) {
|
||||||
|
|
|
@ -6,13 +6,17 @@
|
||||||
|
|
||||||
<div class="row" id="monitors">
|
<div class="row" id="monitors">
|
||||||
<?php foreach ($monitors as $monitor => $mon): ?>
|
<?php foreach ($monitors as $monitor => $mon): ?>
|
||||||
<div class="col-sm-6 col-md-3" id="Monitor_<?= $mon['Monitor']['Id']; ?>">
|
<div class="col-md-4" id="Monitor_<?= $mon['Monitor']['Id']; ?>">
|
||||||
<div class="thumbnail">
|
<div class="thumbnail">
|
||||||
<?php
|
<?php
|
||||||
if($daemonStatus && $mon['Monitor']['Function'] != "None" && $mon['Monitor']['Enabled'])
|
if($daemonStatus && $mon['Monitor']['Function'] != "None" && $mon['Monitor']['Enabled']) {
|
||||||
echo $this->LiveStream->makeLiveStream($mon['Monitor']['Name'], $streamSrc[$monitor], $mon['Monitor']['Id'], $mon['Monitor']['Width']);
|
echo $this->Html->image($streamSrc[$mon['Monitor']['Id']], array(
|
||||||
else
|
'alt' => 'Live stream of ' . $mon['Monitor']['Name'],
|
||||||
|
'id' => 'liveStream_' . $mon['Monitor']['Id'],
|
||||||
|
));
|
||||||
|
} else {
|
||||||
echo $this->LiveStream->showNoImage($mon['Monitor']['Name'], $streamSrc[$monitor], $mon['Monitor']['Id'], $width);
|
echo $this->LiveStream->showNoImage($mon['Monitor']['Name'], $streamSrc[$monitor], $mon['Monitor']['Id'], $width);
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
<div class="caption">
|
<div class="caption">
|
||||||
<h4><?php echo $this->Html->link($mon['Monitor']['Name'],array('controller' => 'monitors', 'action' => 'view', $mon['Monitor']['Id'])); ?></h4>
|
<h4><?php echo $this->Html->link($mon['Monitor']['Name'],array('controller' => 'monitors', 'action' => 'view', $mon['Monitor']['Id'])); ?></h4>
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if($daemonStatus && $monitor['Monitor']['Function'] != "None" && $monitor['Monitor']['Enabled'])
|
if($daemonStatus && $monitor['Monitor']['Function'] != "None" && $monitor['Monitor']['Enabled'])
|
||||||
echo $this->LiveStream->makeLiveStream($monitor['Monitor']['Name'], $streamSrc, $monitor['Monitor']['Id']);
|
echo $this->Html->image($streamSrc, array(
|
||||||
|
'alt' => 'Live stream of ' . $monitor['Monitor']['Name'],
|
||||||
|
'id' => 'liveStream_' . $monitor['Monitor']['Id']
|
||||||
|
));
|
||||||
else
|
else
|
||||||
echo $this->LiveStream->showNoImage($monitor['Monitor']['Name'], $streamSrc, $monitor['Monitor']['Id']);
|
echo $this->LiveStream->showNoImage($monitor['Monitor']['Name'], $streamSrc, $monitor['Monitor']['Id']);
|
||||||
?>
|
?>
|
||||||
|
|
Loading…
Reference in New Issue