replace OutputVideoStream and OutputImageStream with versions that return a string. Call getStreamHTML before we output the headers because we use streamMode and streamSrc in the header .js.php
This commit is contained in:
parent
513d1568d0
commit
be5f0cd4a9
|
@ -229,154 +229,137 @@ function getMimeType( $file )
|
||||||
return( trim( exec( 'file -bi '.escapeshellarg( $file ).' 2>/dev/null' ) ) );
|
return( trim( exec( 'file -bi '.escapeshellarg( $file ).' 2>/dev/null' ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputVideoStream( $id, $src, $width, $height, $format, $title="" )
|
function outputVideoStream( $id, $src, $width, $height, $format, $title="" ) {
|
||||||
{
|
echo getVideoStreamHTML( $id, $src, $width, $height, $format, $title );
|
||||||
if ( file_exists( $src ) )
|
|
||||||
$mimeType = getMimeType( $src );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
switch( $format )
|
|
||||||
{
|
|
||||||
case 'asf' :
|
|
||||||
$mimeType = "video/x-ms-asf";
|
|
||||||
break;
|
|
||||||
case 'avi' :
|
|
||||||
case 'wmv' :
|
|
||||||
$mimeType = "video/x-msvideo";
|
|
||||||
break;
|
|
||||||
case 'mov' :
|
|
||||||
$mimeType = "video/quicktime";
|
|
||||||
break;
|
|
||||||
case 'mpg' :
|
|
||||||
case 'mpeg' :
|
|
||||||
$mimeType = "video/mpeg";
|
|
||||||
break;
|
|
||||||
case 'swf' :
|
|
||||||
$mimeType = "application/x-shockwave-flash";
|
|
||||||
break;
|
|
||||||
case '3gp' :
|
|
||||||
$mimeType = "video/3gpp";
|
|
||||||
break;
|
|
||||||
default :
|
|
||||||
$mimeType = "video/$format";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( !$mimeType || ($mimeType == 'application/octet-stream') )
|
|
||||||
$mimeType = 'video/'.$format;
|
|
||||||
$objectTag = false;
|
|
||||||
if ( ZM_WEB_USE_OBJECT_TAGS )
|
|
||||||
{
|
|
||||||
switch( $mimeType )
|
|
||||||
{
|
|
||||||
case "video/x-ms-asf" :
|
|
||||||
case "video/x-msvideo" :
|
|
||||||
case "video/mp4" :
|
|
||||||
{
|
|
||||||
if ( isWindows() )
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<object id="<?php echo $id ?>" width="<?php echo validNum($width) ?>" height="<?php echo validNum($height) ?>"
|
|
||||||
classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
|
|
||||||
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902"
|
|
||||||
standby="Loading Microsoft Windows Media Player components..."
|
|
||||||
type="<?php echo $mimeType ?>">
|
|
||||||
<param name="FileName" value="<?php echo $src ?>"/>
|
|
||||||
<param name="autoStart" value="1"/>
|
|
||||||
<param name="showControls" value="0"/>
|
|
||||||
<embed type="<?php echo $mimeType ?>"
|
|
||||||
pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"
|
|
||||||
src="<?php echo $src ?>"
|
|
||||||
name="<?php echo validHtmlStr($title) ?>"
|
|
||||||
width="<?php echo validNum($width) ?>"
|
|
||||||
height="<?php echo validInt($height) ?>"
|
|
||||||
autostart="1"
|
|
||||||
showcontrols="0">
|
|
||||||
</embed>
|
|
||||||
</object>
|
|
||||||
<?php
|
|
||||||
$objectTag = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "video/quicktime" :
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<object id="<?php echo $id ?>" width="<?php echo $width ?>" height="<?php echo $height ?>"
|
|
||||||
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
|
|
||||||
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
|
|
||||||
type="<?php echo $mimeType ?>">
|
|
||||||
<param name="src" value="<?php echo $src ?>"/>
|
|
||||||
<param name="autoplay" VALUE="true"/>
|
|
||||||
<param name="controller" VALUE="false"/>
|
|
||||||
<embed type="<?php echo $mimeType ?>"
|
|
||||||
src="<?php echo $src ?>"
|
|
||||||
pluginspage="http://www.apple.com/quicktime/download/"
|
|
||||||
name="<?php echo validHtmlStr($title) ?>"
|
|
||||||
width="<?php echo validInt($width) ?>"
|
|
||||||
height="<?php echo validInt($height) ?>"
|
|
||||||
autoplay="true"
|
|
||||||
controller="true">
|
|
||||||
</embed>
|
|
||||||
</object>
|
|
||||||
<?php
|
|
||||||
$objectTag = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case "application/x-shockwave-flash" :
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<object id="<?php echo $id ?>" width="<?php echo $width ?>" height="<?php echo $height ?>"
|
|
||||||
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
|
|
||||||
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
|
|
||||||
type="<?php echo $mimeType ?>">
|
|
||||||
<param name="movie" value="<?php echo $src ?>"/>
|
|
||||||
<param name="quality" value="high"/>
|
|
||||||
<param name="bgcolor" value="#ffffff"/>
|
|
||||||
<embed type="<?php echo $mimeType ?>"
|
|
||||||
pluginspage="http://www.macromedia.com/go/getflashplayer"
|
|
||||||
src="<?php echo $src ?>"
|
|
||||||
name="<?php echo validHtmlStr($title) ?>"
|
|
||||||
width="<?php echo validInt($width) ?>"
|
|
||||||
height="<?php echo validInt($height) ?>"
|
|
||||||
quality="high"
|
|
||||||
bgcolor="#ffffff">
|
|
||||||
</embed>
|
|
||||||
</object>
|
|
||||||
<?php
|
|
||||||
$objectTag = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( !$objectTag )
|
|
||||||
{
|
|
||||||
?>
|
|
||||||
<embed<?php echo isset($mimeType)?(' type="'.$mimeType.'"'):"" ?>
|
|
||||||
src="<?php echo $src ?>"
|
|
||||||
name="<?php echo validHtmlStr($title) ?>"
|
|
||||||
width="<?php echo validInt($width) ?>"
|
|
||||||
height="<?php echo validInt($height) ?>"
|
|
||||||
autostart="1"
|
|
||||||
autoplay="1"
|
|
||||||
showcontrols="0"
|
|
||||||
controller="0">
|
|
||||||
</embed>
|
|
||||||
<?php
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputImageStream( $id, $src, $width, $height, $title="" )
|
function getVideoStreamHTML( $id, $src, $width, $height, $format, $title="" ) {
|
||||||
{
|
$html = '';
|
||||||
if ( canStreamIframe() ) {
|
$width = validInt($width);
|
||||||
?>
|
$height = validInt($height);
|
||||||
<iframe id="<?php echo $id ?>" src="<?php echo $src ?>" alt="<?php echo validHtmlStr($title) ?>" width="<?php echo $width ?>" height="<?php echo $height ?>"/>
|
$title = validHtmlStr($title);
|
||||||
<?php
|
|
||||||
} else {
|
if ( file_exists( $src ) ) {
|
||||||
?>
|
$mimeType = getMimeType( $src );
|
||||||
<img id="<?php echo $id ?>" src="<?php echo $src ?>" alt="<?php echo validHtmlStr($title) ?>" width="<?php echo $width ?>" height="<?php echo $height ?>"/>
|
} else {
|
||||||
<?php
|
switch( $format ) {
|
||||||
}
|
case 'asf' :
|
||||||
|
$mimeType = "video/x-ms-asf";
|
||||||
|
break;
|
||||||
|
case 'avi' :
|
||||||
|
case 'wmv' :
|
||||||
|
$mimeType = "video/x-msvideo";
|
||||||
|
break;
|
||||||
|
case 'mov' :
|
||||||
|
$mimeType = "video/quicktime";
|
||||||
|
break;
|
||||||
|
case 'mpg' :
|
||||||
|
case 'mpeg' :
|
||||||
|
$mimeType = "video/mpeg";
|
||||||
|
break;
|
||||||
|
case 'swf' :
|
||||||
|
$mimeType = "application/x-shockwave-flash";
|
||||||
|
break;
|
||||||
|
case '3gp' :
|
||||||
|
$mimeType = "video/3gpp";
|
||||||
|
break;
|
||||||
|
default :
|
||||||
|
$mimeType = "video/$format";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ( !$mimeType || ($mimeType == 'application/octet-stream') )
|
||||||
|
$mimeType = 'video/'.$format;
|
||||||
|
if ( ZM_WEB_USE_OBJECT_TAGS ) {
|
||||||
|
switch( $mimeType ) {
|
||||||
|
case "video/x-ms-asf" :
|
||||||
|
case "video/x-msvideo" :
|
||||||
|
case "video/mp4" :
|
||||||
|
{
|
||||||
|
if ( isWindows() ) {
|
||||||
|
return '<object id="'.$id.'" width="'.$width.'" height="'.$height.'
|
||||||
|
classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
|
||||||
|
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,0,02,902"
|
||||||
|
standby="Loading Microsoft Windows Media Player components..."
|
||||||
|
type="'.$mimeType.'">
|
||||||
|
<param name="FileName" value="'.$src.'"/>
|
||||||
|
<param name="autoStart" value="1"/>
|
||||||
|
<param name="showControls" value="0"/>
|
||||||
|
<embed type="'.$mimeType.'"
|
||||||
|
pluginspage="http://www.microsoft.com/Windows/MediaPlayer/"
|
||||||
|
src="'.$src.'"
|
||||||
|
name="'.$title.'"
|
||||||
|
width="'.$width.'"
|
||||||
|
height="'.$height.'"
|
||||||
|
autostart="1"
|
||||||
|
showcontrols="0">
|
||||||
|
</embed>
|
||||||
|
</object>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
case "video/quicktime" :
|
||||||
|
{
|
||||||
|
return '<object id="'.$id.'" width="'.$width.'" height="'.$height.'"
|
||||||
|
classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"
|
||||||
|
codebase="http://www.apple.com/qtactivex/qtplugin.cab"
|
||||||
|
type="'.$mimeType.'">
|
||||||
|
<param name="src" value="'.$src.'"/>
|
||||||
|
<param name="autoplay" VALUE="true"/>
|
||||||
|
<param name="controller" VALUE="false"/>
|
||||||
|
<embed type="'.$mimeType.'"
|
||||||
|
src="'.$src.'"
|
||||||
|
pluginspage="http://www.apple.com/quicktime/download/"
|
||||||
|
name="'.$title.'" width="'.$width.'" height="'.$height.'"
|
||||||
|
autoplay="true"
|
||||||
|
controller="true">
|
||||||
|
</embed>
|
||||||
|
</object>';
|
||||||
|
}
|
||||||
|
case "application/x-shockwave-flash" :
|
||||||
|
{
|
||||||
|
return '<object id="'.$id.'" width="'.$width.'" height="'.$height.'"
|
||||||
|
classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
|
||||||
|
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
|
||||||
|
type="'.$mimeType.'">
|
||||||
|
<param name="movie" value="'.$src.'"/>
|
||||||
|
<param name="quality" value="high"/>
|
||||||
|
<param name="bgcolor" value="#ffffff"/>
|
||||||
|
<embed type="'.$mimeType.'"
|
||||||
|
pluginspage="http://www.macromedia.com/go/getflashplayer"
|
||||||
|
src="'.$src.'"
|
||||||
|
name="'.$title.'"
|
||||||
|
width="'.$width.'"
|
||||||
|
height="'.$height.'"
|
||||||
|
quality="high"
|
||||||
|
bgcolor="#ffffff">
|
||||||
|
</embed>
|
||||||
|
</object>';
|
||||||
|
}
|
||||||
|
} # end switch
|
||||||
|
} # end if use object tags
|
||||||
|
return '<embed'. ( isset($mimeType)?(' type="'.$mimeType.'"'):'' ). '
|
||||||
|
src="'.$src.'"
|
||||||
|
name="'.$title.'"
|
||||||
|
width="'.$width.'"
|
||||||
|
height="'.$height.'"
|
||||||
|
autostart="1"
|
||||||
|
autoplay="1"
|
||||||
|
showcontrols="0"
|
||||||
|
controller="0">
|
||||||
|
</embed>';
|
||||||
|
}
|
||||||
|
|
||||||
|
function outputImageStream( $id, $src, $width, $height, $title="" ) {
|
||||||
|
echo getImageStream( $id, $src, $width, $height, $title );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function getImageStream( $id, $src, $width, $height, $title="" ) {
|
||||||
|
if ( canStreamIframe() ) {
|
||||||
|
return '<iframe id="'.$id.'" src="'.$src.'" alt="'. validHtmlStr($title) .'" width="'. validInt($width)." height=".validInt($height).'"/>';
|
||||||
|
} else {
|
||||||
|
return '<img id="'.$id.'" src="'.$src.'" alt="'. validHtmlStr($title) .'" width="'. validInt($width) .'" height="'. validInt( $height ).'"/>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function outputControlStream( $src, $width, $height, $monitor, $scale, $target )
|
function outputControlStream( $src, $width, $height, $monitor, $scale, $target )
|
||||||
|
@ -2502,11 +2485,11 @@ function getStreamHTML( $monitor, $scale=100 ) {
|
||||||
//FIXME, the width and height of the image need to be scaled.
|
//FIXME, the width and height of the image need to be scaled.
|
||||||
if ( ZM_WEB_STREAM_METHOD == 'mpeg' && ZM_MPEG_LIVE_FORMAT ) {
|
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 ) );
|
$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() );
|
return getVideoStream( "liveStream", $streamSrc, reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), ZM_MPEG_LIVE_FORMAT, $monitor->Name() );
|
||||||
} else if ( canStream() ) {
|
} else if ( canStream() ) {
|
||||||
$streamSrc = $monitor->getStreamSrc( array( 'mode=jpeg', 'scale='.$scale, 'maxfps='.ZM_WEB_VIDEO_MAXFPS, 'buffer='.$monitor->StreamReplayBuffer() ) );
|
$streamSrc = $monitor->getStreamSrc( array( 'mode=jpeg', 'scale='.$scale, 'maxfps='.ZM_WEB_VIDEO_MAXFPS, 'buffer='.$monitor->StreamReplayBuffer() ) );
|
||||||
if ( canStreamNative() )
|
if ( canStreamNative() )
|
||||||
outputImageStream( "liveStream", $streamSrc, reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), $monitor->Name() );
|
return getImageStream( "liveStream", $streamSrc, reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), $monitor->Name() );
|
||||||
elseif ( canStreamApplet() )
|
elseif ( canStreamApplet() )
|
||||||
outputHelperStream( "liveStream", $streamSrc, reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), $monitor->Name() );
|
outputHelperStream( "liveStream", $streamSrc, reScale( $monitor->Width(), $scale ), reScale( $monitor->Height(), $scale ), $monitor->Name() );
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -118,6 +118,10 @@ $selfIntersecting = isSelfIntersecting( $newZone['Points'] );
|
||||||
|
|
||||||
$focusWindow = true;
|
$focusWindow = true;
|
||||||
$connkey = generateConnKey();
|
$connkey = generateConnKey();
|
||||||
|
$streamSrc = '';
|
||||||
|
$streamMode = '';
|
||||||
|
# Have to do this here, because the .js.php references somethings figured out when generating the streamHTML
|
||||||
|
$StreamHTML = getStreamHTML( $monitor, $scale );
|
||||||
|
|
||||||
xhtmlHeaders(__FILE__, translate('Zone') );
|
xhtmlHeaders(__FILE__, translate('Zone') );
|
||||||
?>
|
?>
|
||||||
|
@ -211,7 +215,7 @@ xhtmlHeaders(__FILE__, translate('Zone') );
|
||||||
<div id="definitionPanel">
|
<div id="definitionPanel">
|
||||||
<div id="imagePanel">
|
<div id="imagePanel">
|
||||||
<div id="imageFrame" style="width: <?php echo reScale( $monitor->Width(), $scale ) ?>px; height: <?php echo reScale( $monitor->Height(), $scale ) ?>px;">
|
<div id="imageFrame" style="width: <?php echo reScale( $monitor->Width(), $scale ) ?>px; height: <?php echo reScale( $monitor->Height(), $scale ) ?>px;">
|
||||||
<?php echo getStreamHTML( $monitor, $scale ); ?>
|
<?php $StreamHTML; ?>
|
||||||
<svg id="zoneSVG" class="zones" style="width: <?php echo reScale( $monitor->Width(), $scale ) ?>px; height: <?php echo reScale( $monitor->Height(), $scale ) ?>px;margin-top: -<?php echo $monitor->Height ?>px;background: none;">
|
<svg id="zoneSVG" class="zones" style="width: <?php echo reScale( $monitor->Width(), $scale ) ?>px; height: <?php echo reScale( $monitor->Height(), $scale ) ?>px;margin-top: -<?php echo $monitor->Height ?>px;background: none;">
|
||||||
<polygon id="zonePoly" points="<?php echo $zone['AreaCoords'] ?>" class="<?php echo $zone['Type'] ?>"/>
|
<polygon id="zonePoly" points="<?php echo $zone['AreaCoords'] ?>" class="<?php echo $zone['Type'] ?>"/>
|
||||||
Sorry, your browser does not support inline SVG
|
Sorry, your browser does not support inline SVG
|
||||||
|
|
Loading…
Reference in New Issue