2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
//
|
|
|
|
// ZoneMinder web watch feed view file, $Date$, $Revision$
|
|
|
|
// Copyright (C) 2003 Philip Coombes
|
|
|
|
//
|
|
|
|
// This program is free software; you can redistribute it and/or
|
|
|
|
// modify it under the terms of the GNU General Public License
|
|
|
|
// as published by the Free Software Foundation; either version 2
|
|
|
|
// of the License, or (at your option) any later version.
|
|
|
|
//
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
// along with this program; if not, write to the Free Software
|
|
|
|
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
//
|
2003-07-11 17:27:56 +08:00
|
|
|
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( !canView( 'Stream' ) )
|
|
|
|
{
|
|
|
|
$view = "error";
|
|
|
|
return;
|
|
|
|
}
|
2004-02-18 23:36:35 +08:00
|
|
|
|
|
|
|
if ( empty($mode) )
|
2004-01-08 19:45:57 +08:00
|
|
|
{
|
|
|
|
if ( canStream() )
|
|
|
|
$mode = "stream";
|
|
|
|
else
|
|
|
|
$mode = "still";
|
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
|
2004-02-19 18:48:33 +08:00
|
|
|
if ( !isset( $scale ) )
|
|
|
|
$scale = SCALE_SCALE;
|
|
|
|
|
2004-01-08 19:45:57 +08:00
|
|
|
$result = mysql_query( "select * from Monitors where Id = '$mid'" );
|
|
|
|
if ( !$result )
|
|
|
|
die( mysql_error() );
|
|
|
|
$monitor = mysql_fetch_assoc( $result );
|
|
|
|
|
|
|
|
if ( $mode != "stream" )
|
|
|
|
{
|
2004-02-19 18:48:33 +08:00
|
|
|
if ( !ZM_WEB_DOUBLE_BUFFER )
|
|
|
|
{
|
|
|
|
// Prompt an image to be generated
|
|
|
|
createImage( $monitor, $scale );
|
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( ZM_WEB_REFRESH_METHOD == "http" )
|
2004-02-19 18:48:33 +08:00
|
|
|
header("Refresh: ".REFRESH_IMAGE."; URL=$PHP_SELF?view=watchfeed&mid=$mid&mode=still&scale=$scale" );
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
|
|
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
|
|
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); // always modified
|
|
|
|
header("Cache-Control: no-store, no-cache, must-revalidate"); // HTTP/1.1
|
|
|
|
header("Cache-Control: post-check=0, pre-check=0", false);
|
|
|
|
header("Pragma: no-cache"); // HTTP/1.0
|
|
|
|
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
<html>
|
|
|
|
<head>
|
2004-01-08 18:09:35 +08:00
|
|
|
<title>ZM - <?= $monitor['Name'] ?> - <?= $zmSlangFeed ?></title>
|
2003-07-11 17:27:56 +08:00
|
|
|
<link rel="stylesheet" href="zm_styles.css" type="text/css">
|
|
|
|
<script language="JavaScript">
|
2004-02-19 18:48:33 +08:00
|
|
|
<?php
|
|
|
|
if ( $mode != "stream" && ZM_WEB_REFRESH_METHOD == "javascript" )
|
2003-07-11 17:27:56 +08:00
|
|
|
{
|
2004-02-19 18:48:33 +08:00
|
|
|
if ( ZM_WEB_DOUBLE_BUFFER )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
function fetchImage()
|
2003-07-11 17:27:56 +08:00
|
|
|
{
|
2004-02-19 21:02:05 +08:00
|
|
|
window.parent.MonitorFetch<?= $monitor['Id'] ?>.location.reload( true );
|
2004-02-19 18:48:33 +08:00
|
|
|
|
2004-02-20 17:48:14 +08:00
|
|
|
var now = new Date();
|
|
|
|
var zm_image = new Image();
|
|
|
|
zm_image.src = '<?= ZM_DIR_IMAGES.'/'.$monitor['Name'] ?>.jpg?'+now.getTime();
|
2004-02-19 18:48:33 +08:00
|
|
|
|
|
|
|
document['zmImage'].src = zm_image.src;
|
2003-07-11 17:27:56 +08:00
|
|
|
}
|
2004-02-19 18:48:33 +08:00
|
|
|
|
2004-02-19 21:02:05 +08:00
|
|
|
window.parent.MonitorFetch<?= $monitor['Id'] ?>.location = '<?= $PHP_SELF ?>?view=imagefetch&mid=<?= $monitor['Id'] ?>&scale=<?= $scale ?>';
|
2004-02-19 18:48:33 +08:00
|
|
|
window.setInterval( "fetchImage()", <?= REFRESH_IMAGE*1000 ?> );
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-02-19 18:48:33 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
window.setTimeout( "window.location.reload(true)", <?= REFRESH_IMAGE*1000 ?> );
|
|
|
|
<?php
|
2004-02-19 18:48:33 +08:00
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body>
|
2004-02-19 18:48:33 +08:00
|
|
|
<table width="96%" align="center" border="0" cellspacing="0" cellpadding="2">
|
2004-03-04 23:05:54 +08:00
|
|
|
<tr><td colspan="5" align="center">
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( $mode == "stream" )
|
|
|
|
{
|
2004-03-04 23:05:54 +08:00
|
|
|
if ( ZM_WEB_VIDEO_STREAM_METHOD == 'mpeg' )
|
2003-07-11 17:27:56 +08:00
|
|
|
{
|
2004-03-11 19:18:14 +08:00
|
|
|
$stream_src = ZM_PATH_ZMS."?mode=mpeg&monitor=".$monitor['Id']."&scale=$scale&bitrate=".VIDEO_BITRATE."&maxfps=".VIDEO_MAXFPS."&buffer=0";
|
2004-03-04 23:05:54 +08:00
|
|
|
if ( isWindows() )
|
|
|
|
{
|
|
|
|
if ( isInternetExplorer() )
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2004-03-04 23:05:54 +08:00
|
|
|
<OBJECT ID="MediaPlayer1" width=<?= reScale( $monitor['Width'], $scale ) ?> height=<?= reScale( $monitor['Height'], $scale ) ?>
|
|
|
|
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="application/x-oleobject">
|
|
|
|
<PARAM NAME="FileName" VALUE="<?= $stream_src."&format=asf" ?>"
|
|
|
|
<PARAM NAME="animationatStart" VALUE="true">
|
|
|
|
<PARAM NAME="transparentatStart" VALUE="true">
|
|
|
|
<PARAM NAME="autoStart" VALUE="true">
|
|
|
|
<PARAM NAME="showControls" VALUE="false">
|
|
|
|
</OBJECT>
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-03-04 23:05:54 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<EMBED type="application/x-mplayer2"
|
|
|
|
pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/"
|
|
|
|
SRC="<?= $stream_src."&format=asf" ?>"
|
|
|
|
name="MediaPlayer1"
|
|
|
|
width=<?= reScale( $monitor['Width'], $scale ) ?>
|
|
|
|
height=<?= reScale( $monitor['Height'], $scale ) ?>
|
|
|
|
AutoStart=true>
|
|
|
|
</EMBED>
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<EMBED type="video/mpeg"
|
2004-03-10 01:01:05 +08:00
|
|
|
src="<?= $stream_src."&format=asf" ?>"
|
2004-03-04 23:05:54 +08:00
|
|
|
width=<?= reScale( $monitor['Width'], $scale ) ?>
|
|
|
|
height=<?= reScale( $monitor['Height'], $scale ) ?>
|
|
|
|
AutoStart=true>
|
|
|
|
</EMBED>
|
|
|
|
<?php
|
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-03-04 23:05:54 +08:00
|
|
|
$stream_src = ZM_PATH_ZMS."?mode=jpeg&monitor=".$monitor['Id']."&idle=".STREAM_IDLE_DELAY."&refresh=".STREAM_FRAME_DELAY."&scale=$scale";
|
|
|
|
if ( canStreamNative() )
|
|
|
|
{
|
|
|
|
?>
|
|
|
|
<img src="<?= $stream_src ?>" border="0" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>">
|
|
|
|
<?php
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2004-03-04 23:05:54 +08:00
|
|
|
<applet code="com.charliemouse.cambozola.Viewer" archive="<?= ZM_PATH_CAMBOZOLA ?>" align="middle" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>"><param name="url" value="<?= $stream_src ?>"></applet>
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-03-04 23:05:54 +08:00
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2004-03-04 23:05:54 +08:00
|
|
|
<img name="zmImage" src="<?= ZM_DIR_IMAGES.'/'.$monitor['Name'] ?>.jpg" border="0" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>">
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2004-03-04 23:05:54 +08:00
|
|
|
</td></tr>
|
2003-07-11 17:27:56 +08:00
|
|
|
</table>
|
|
|
|
</body>
|
|
|
|
</html>
|