function outputlivestream($monitor, $inwidth = 0, $inheight = 0) { $scale = isset($_REQUEST['scale']) ? validInt($_REQUEST['scale']) : reScale(SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE); $connkey = $monitor['connKey']; // Minor hack //$connKey = generateConnKey(); if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) { $streamMode = "mpeg"; $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT, "buffer=" . $monitor['StreamReplayBuffer'])); } elseif (canStream()) { $streamMode = "jpeg"; $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "buffer=" . $monitor['StreamReplayBuffer'])); } else { $streamMode = "single"; $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale)); } $width = !empty($inwidth) ? $inwidth : 150; $height = empty($inheight) ? $width * $monitor['Height'] / $monitor['Width'] : $inheight; $width = (int) $width; $height = (int) $height; if ($streamMode === "mpeg") { outputVideoStream('liveStream' . $monitor['Id'], $streamSrc, reScale($width, $scale), reScale($height, $scale), ZM_MPEG_LIVE_FORMAT, $monitor['Name']); } elseif ($streamMode == "jpeg") { if (canStreamNative()) { outputImageStream('liveStream' . $monitor['Id'], $streamSrc, reScale($width, $scale), reScale($height, $scale), $monitor['Name']); } elseif (canStreamApplet()) { outputHelperStream('liveStream' . $monitor['Id'], $streamSrc, reScale($width, $scale), reScale($height, $scale), $monitor['Name']); } } else { outputImageStill('liveStream' . $monitor['Id'], $streamSrc, reScale($width, $scale), reScale($height, $scale), $monitor['Name']); } }
function displayMonitor($monitor, $bandwidth) { if (!defined(ZM_WEB_DEFAULT_SCALE)) { $scale = 40; } else { $scale = ZM_WEB_DEFAULT_SCALE; } if ($bandwidth == 'high') { if (ZM_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) { $streamMode = "mpeg"; $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT, "buffer=" . $monitor['StreamReplayBuffer'])); } if (canStream()) { $streamMode = "jpeg"; $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "buffer=" . $monitor['StreamReplayBuffer'])); } } if ($bandwidth == 'low' || $bandwidth == "medium" || $bandwidth == "" || !$bandwidth) { $streamSrc = getStreamSrc(array("mode=single", "monitor=" . $monitor['Id'], "scale=" . $scale)); } $width = $monitor['Width'] * ('.' . $scale) + 20; ?> <li id="monitor_<?php echo $monitor['Id']; ?> " style="width:<?php echo $width; ?> px;"> <div class="mon_header"> <h3 style="display:inline;"><?php echo $monitor['Name']; ?> </h3> <div class="right"> <div class="spinner"></div> <div class="minimize"><img src="skins/new/graphics/minimize.png" style="width:15px;" alt="minimize" /></div> </div> </div> <div class="mon"> <a rel="monitor" href="?view=watch&mid=<?php echo $monitor['Id']; ?> " title="<?php echo $monitor['Name']; ?> "> <?php $name = $monitor['Name'] . "_live"; outputImageStill("{$name}", $streamSrc, reScale($monitor['Width'], $scale), reScale($monitor['Height'], $scale), $monitor['Name']); ?> </a> </div> <div class="monfooter"> </div> </li> <?php }
} $row['ScaledWidth'] = reScale($row['Width'], $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE); $row['ScaledHeight'] = reScale($row['Height'], $row['DefaultScale'], ZM_WEB_DEFAULT_SCALE); $monitors[] = $row; } $monitor = $monitors[$monIdx]; $nextMid = $monIdx == count($monitors) - 1 ? $monitors[0]['Id'] : $monitors[$monIdx + 1]['Id']; $montageWidth = $monitor['ScaledWidth']; $montageHeight = $monitor['ScaledHeight']; $widthScale = $montageWidth * SCALE_BASE / $monitor['Width']; $heightScale = $montageHeight * SCALE_BASE / $monitor['Height']; $scale = (int) ($widthScale < $heightScale ? $widthScale : $heightScale); if (false && (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT)) { $streamMode = "mpeg"; $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT)); } elseif ($mode == 'stream' && canStream()) { $streamMode = "jpeg"; $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS)); } else { $streamMode = "single"; $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale)); } noCacheHeaders(); $focusWindow = true; xhtmlHeaders(__FILE__, $SLANG['CycleWatch']); ?> <body> <div id="page"> <div id="header"> <div id="headerButtons"> <?php
} $monitors[] = $row; } //$monitor = $monitors[$monIdx]; $nextMid = $monIdx == count($monitors) - 1 ? $monitors[0]['Id'] : $monitors[$monIdx + 1]['Id']; $prevMid = $monIdx == 0 ? $monitors[count($monitors) - 1]['Id'] : $monitors[$monIdx - 1]['Id']; if (isset($_REQUEST['scale'])) { $scale = validInt($_REQUEST['scale']); } else { $scale = getDeviceScale($monitor['Width'], $monitor['Height']); } $imageSrc = getStreamSrc(array("mode=single", "monitor=" . $monitor['Id'], "scale=" . $scale), '&'); if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) { $streamMode = "mpeg"; $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT)); } elseif (canStream()) { $streamMode = "jpeg"; $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS)); } else { $streamMode = "single"; $streamSrc = getStreamSrc(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale)); } xhtmlHeaders(__FILE__, $monitor['Name'] . ' - ' . translate('Watch')); ?> <body> <div id="page"> <div id="content"> <p class="<?php echo $class; ?> "><?php
function getStreamHTML($monitor, $scale = 100) { //FIXME, the width and height of the image need to be scaled. if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) { $streamSrc = $monitor->getStreamSrc(array("mode=mpeg", "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT)); outputVideoStream("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), ZM_MPEG_LIVE_FORMAT, $monitor->Name()); } else { if (canStream()) { $streamSrc = $monitor->getStreamSrc(array('mode=jpeg', 'scale=' . $scale, 'maxfps=' . ZM_WEB_VIDEO_MAXFPS, 'buffer=' . $monitor->StreamReplayBuffer())); if (canStreamNative()) { outputImageStream("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), $monitor->Name()); } elseif (canStreamApplet()) { outputHelperStream("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), $monitor->Name()); } } else { $streamSrc = $monitor->getStreamSrc(array('mode=single', "scale=" . $scale)); outputImageStill("liveStream", $streamSrc, reScale($monitor->Width(), $scale), reScale($monitor->Height(), $scale), $monitor->Name()); Info("The system has fallen back to single jpeg mode for streaming. Consider enabling Cambozola or upgrading the client browser."); } } }
$event = dbFetchOne($sql); if (isset($_REQUEST['rate'])) { $rate = validInt($_REQUEST['rate']); } else { $rate = reScale(RATE_BASE, $event['DefaultRate'], ZM_WEB_DEFAULT_RATE); } if (isset($_REQUEST['scale'])) { $scale = validInt($_REQUEST['scale']); } else { $scale = reScale(SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE); } $replayModes = array('single' => $SLANG['ReplaySingle'], 'all' => $SLANG['ReplayAll'], 'gapless' => $SLANG['ReplayGapless']); if (isset($_REQUEST['streamMode'])) { $streamMode = validHtmlStr($_REQUEST['streamMode']); } else { $streamMode = canStream() ? 'stream' : 'stills'; } if (isset($_REQUEST['replayMode'])) { $replayMode = validHtmlStr($_REQUEST['replayMode']); } if (isset($_COOKIE['replayMode']) && preg_match('#^[a-z]+$#', $_COOKIE['replayMode'])) { $replayMode = validHtmlStr($_COOKIE['replayMode']); } else { $replayMode = array_shift(array_keys($replayModes)); } parseSort(); parseFilter($_REQUEST['filter']); $filterQuery = $_REQUEST['filter']['query']; $panelSections = 40; $panelSectionWidth = (int) ceil(reScale($event['Width'], $scale) / $panelSections); $panelWidth = $panelSections * $panelSectionWidth - 1;
if (isset($_POST['eid']) && isset($eventdata[$_POST['eid']])) { $currentevent = $eventdata[$_POST['eid']]; } $event = !empty($currentevent) ? $currentevent : current($eventdata); $rate = isset($_POST['rate']) ? validInt($_POST['rate']) : reScale(RATE_BASE, $event['DefaultRate'], ZM_WEB_DEFAULT_RATE); $scale = isset($_POST['scale']) ? validInt($_POST['scale']) : reScale(SCALE_BASE, $event['DefaultScale'], ZM_WEB_DEFAULT_SCALE); /* $replayModes = array( 'single' => $SLANG['ReplaySingle'], 'all' => $SLANG['ReplayAll'], 'gapless' => $SLANG['ReplayGapless'], ); $replayMode = isset( $_POST['replayMode']) ? validHtmlStr($_POST['replayMode']) : array_shift( array_keys( $replayModes ) ); */ $replayMode = !empty($currentevent) ? 'single' : 'gapless'; $streamMode = isset($_POST['streamMode']) ? validHtmlStr($_POST['streamMode']) : (canStream() ? 'stream' : 'stills'); $panelSections = 40; $panelSectionWidth = (int) ceil(reScale($event['Width'], $scale) / $panelSections); $panelWidth = $panelSections * $panelSectionWidth - 1; $connkey = generateConnKey(); ?> <link rel="stylesheet" href="<?php echo getSkinFile('ajax/css/eventmain.css'); ?> " type="text/css"/> <script type="text/javascript"><?php require_once getSkinFile('ajax/js/eventmain.js.php'); ?> </script> <script type="text/javascript" src="<?php echo getSkinFile('ajax/js/eventmain.js');
function outputLiveStreamSrcModern($monitor, $inwidth = 0, $inheight = 0) { $scale = isset($_REQUEST['scale']) ? validInt($_REQUEST['scale']) : reScale(SCALE_BASE, $monitor['DefaultScale'], ZM_WEB_DEFAULT_SCALE); $connKey = generateAuthHashModern(false); //$connkey = $monitor['connKey']; // Minor hack if (ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT) { $streamMode = "mpeg"; $streamSrc = getStreamSrcModern(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "bitrate=" . ZM_WEB_VIDEO_BITRATE, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "format=" . ZM_MPEG_LIVE_FORMAT, "buffer=" . $monitor['StreamReplayBuffer'])); } elseif (canStream()) { $streamMode = "jpeg"; $streamSrc = getStreamSrcModern(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale, "maxfps=" . ZM_WEB_VIDEO_MAXFPS, "buffer=" . $monitor['StreamReplayBuffer'])); } else { $streamMode = "single"; $streamSrc = getStreamSrcModern(array("mode=" . $streamMode, "monitor=" . $monitor['Id'], "scale=" . $scale)); } return $streamSrc; }