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));
|
||||
$monitors = $this->Monitor->find('all', array('recursive' => -1, 'fields' => array('Id', 'StreamReplayBuffer')));
|
||||
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);
|
||||
}
|
||||
|
@ -182,4 +182,4 @@
|
|||
}
|
||||
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -24,9 +24,9 @@
|
|||
$ZM_MPEG_LIVE_FORMAT = $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 {
|
||||
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 {
|
||||
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\">";
|
||||
return $liveStream;
|
||||
$liveStream = "<img class=\"livestream_resize\" id=\"liveStream_$id\" alt=\"Live Stream of $name\" src=\"$src&monitor=$id\">";
|
||||
return $src;
|
||||
}
|
||||
|
||||
public function showNoImage($name, $src, $id, $width=0) {
|
||||
|
|
|
@ -6,13 +6,17 @@
|
|||
|
||||
<div class="row" id="monitors">
|
||||
<?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">
|
||||
<?php
|
||||
if($daemonStatus && $mon['Monitor']['Function'] != "None" && $mon['Monitor']['Enabled'])
|
||||
echo $this->LiveStream->makeLiveStream($mon['Monitor']['Name'], $streamSrc[$monitor], $mon['Monitor']['Id'], $mon['Monitor']['Width']);
|
||||
else
|
||||
if($daemonStatus && $mon['Monitor']['Function'] != "None" && $mon['Monitor']['Enabled']) {
|
||||
echo $this->Html->image($streamSrc[$mon['Monitor']['Id']], array(
|
||||
'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);
|
||||
}
|
||||
?>
|
||||
<div class="caption">
|
||||
<h4><?php echo $this->Html->link($mon['Monitor']['Name'],array('controller' => 'monitors', 'action' => 'view', $mon['Monitor']['Id'])); ?></h4>
|
||||
|
@ -27,4 +31,4 @@
|
|||
<?php
|
||||
$this->Js->get('#monitors');
|
||||
$this->Js->sortable(array('complete' => '$.post("/monitors/reorder", $("#monitors").sortable("serialize"))',));
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -2,7 +2,10 @@
|
|||
|
||||
<?php
|
||||
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
|
||||
echo $this->LiveStream->showNoImage($monitor['Monitor']['Name'], $streamSrc, $monitor['Monitor']['Id']);
|
||||
?>
|
||||
|
|
Loading…
Reference in New Issue