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 ) )
|
2004-03-15 06:24:09 +08:00
|
|
|
$scale = ZM_WEB_DEFAULT_SCALE;
|
2004-02-19 18:48:33 +08:00
|
|
|
|
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-03-16 05:39:15 +08:00
|
|
|
// Prompt an image to be generated
|
2004-01-08 19:45:57 +08:00
|
|
|
if ( ZM_WEB_REFRESH_METHOD == "http" )
|
2004-04-19 19:23:40 +08:00
|
|
|
header("Refresh: ".ZM_WEB_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
|
|
|
|
|
2004-12-30 02:03:13 +08:00
|
|
|
$image_src = getStreamSrc( array( "mode=single", "monitor=".$monitor['Id'], "scale=".$scale ) );
|
2004-05-05 19:22:50 +08:00
|
|
|
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2004-12-29 03:22:23 +08:00
|
|
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
|
2003-07-11 17:27:56 +08:00
|
|
|
<html>
|
|
|
|
<head>
|
2004-01-08 18:09:35 +08:00
|
|
|
<title>ZM - <?= $monitor['Name'] ?> - <?= $zmSlangFeed ?></title>
|
2004-12-29 02:20:11 +08:00
|
|
|
<link rel="stylesheet" href="zm_html_styles.css" type="text/css">
|
2004-12-29 03:29:43 +08:00
|
|
|
<script type="text/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-20 17:48:14 +08:00
|
|
|
var now = new Date();
|
|
|
|
var zm_image = new Image();
|
2004-05-05 19:22:50 +08:00
|
|
|
zm_image.src = '<?= $image_src ?>'+'&'+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-04-19 19:23:40 +08:00
|
|
|
window.setInterval( "fetchImage()", <?= ZM_WEB_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
|
|
|
?>
|
2004-04-19 19:23:40 +08:00
|
|
|
window.setTimeout( "window.location.reload(true)", <?= ZM_WEB_REFRESH_IMAGE*1000 ?> );
|
2003-07-11 17:27:56 +08:00
|
|
|
<?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-15 07:27:36 +08:00
|
|
|
if ( ZM_VIDEO_STREAM_METHOD == 'mpeg' && ZM_VIDEO_LIVE_FORMAT )
|
2003-07-11 17:27:56 +08:00
|
|
|
{
|
2004-12-30 02:03:13 +08:00
|
|
|
$stream_src = getStreamSrc( array( "mode=mpeg", "monitor=".$monitor['Id'], "scale=".$scale, "bitrate=".ZM_WEB_VIDEO_BITRATE, "maxfps=".ZM_WEB_VIDEO_MAXFPS, "format=".ZM_VIDEO_LIVE_FORMAT ) );
|
2004-03-04 23:05:54 +08:00
|
|
|
if ( isWindows() )
|
|
|
|
{
|
|
|
|
if ( isInternetExplorer() )
|
|
|
|
{
|
2003-07-11 17:27:56 +08:00
|
|
|
?>
|
2004-08-11 22:27:15 +08:00
|
|
|
<object id="MediaPlayer1" width="<?= reScale( $monitor['Width'], $scale ) ?>" height="<?= reScale( $monitor['Height'], $scale ) ?>"
|
2004-03-04 23:05:54 +08:00
|
|
|
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">
|
2004-08-11 22:27:15 +08:00
|
|
|
<param name="FileName" value="<?= $stream_src ?>">
|
|
|
|
<param name="animationatStart" value="true">
|
|
|
|
<param name="transparentatStart" value="true">
|
|
|
|
<param name="autoStart" value="true">
|
|
|
|
<param name="showControls" value="false">
|
2004-03-04 23:05:54 +08:00
|
|
|
</OBJECT>
|
2003-07-11 17:27:56 +08:00
|
|
|
<?php
|
2004-03-04 23:05:54 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
?>
|
2004-08-11 22:27:15 +08:00
|
|
|
<embed type="application/x-mplayer2"
|
2004-03-04 23:05:54 +08:00
|
|
|
pluginspage = "http://www.microsoft.com/Windows/MediaPlayer/"
|
2004-08-11 22:27:15 +08:00
|
|
|
src="<?= $stream_src ?>"
|
2004-03-04 23:05:54 +08:00
|
|
|
name="MediaPlayer1"
|
2004-08-11 22:27:15 +08:00
|
|
|
width="<?= reScale( $monitor['Width'], $scale ) ?>"
|
|
|
|
height="<?= reScale( $monitor['Height'], $scale ) ?>"
|
|
|
|
autostart="true">
|
|
|
|
</embed>
|
2004-03-04 23:05:54 +08:00
|
|
|
<?php
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
?>
|
2004-08-11 22:27:15 +08:00
|
|
|
<embed type="video/mpeg"
|
2004-03-15 07:27:36 +08:00
|
|
|
src="<?= $stream_src ?>"
|
2004-08-11 22:27:15 +08:00
|
|
|
width="<?= reScale( $monitor['Width'], $scale ) ?>"
|
|
|
|
height="<?= reScale( $monitor['Height'], $scale ) ?>"
|
|
|
|
autostart="true">
|
|
|
|
</embed>
|
2004-03-04 23:05:54 +08:00
|
|
|
<?php
|
|
|
|
}
|
2004-01-08 19:45:57 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2004-12-30 02:03:13 +08:00
|
|
|
$stream_src = getStreamSrc( array( "mode=jpeg", "monitor=".$monitor['Id'], "scale=".$scale, "maxfps=".ZM_WEB_VIDEO_MAXFPS ) );
|
2004-03-04 23:05:54 +08:00
|
|
|
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-05-05 19:22:50 +08:00
|
|
|
<img name="zmImage" src="<?= $image_src ?>" 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>
|