From 98203e6c2fe6b56e7445420edf3199b61a29b22a Mon Sep 17 00:00:00 2001 From: stan Date: Sun, 6 Feb 2011 16:04:11 +0000 Subject: [PATCH] Improved stream handling for single image mode, for Chrome etc. git-svn-id: http://svn.zoneminder.com/svn/zm/trunk@3281 e3e1d417-86f3-4887-817a-d78f3d33393f --- web/includes/functions.php | 2 +- web/skins/classic/views/js/watch.js | 6 +++++- web/skins/classic/views/js/watch.js.php | 2 +- web/skins/classic/views/watch.php | 1 - 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/web/includes/functions.php b/web/includes/functions.php index 624e4a963..6e25ea2d9 100644 --- a/web/includes/functions.php +++ b/web/includes/functions.php @@ -171,7 +171,7 @@ function getStreamSrc( $args, $querySep='&' ) $args[] = "user=".$_SESSION['username']; } } - if ( !empty($GLOBALS['connkey']) ) + if ( !in_array( "mode=single", $args ) && !empty($GLOBALS['connkey']) ) { $args[] = "connkey=".$GLOBALS['connkey']; } diff --git a/web/skins/classic/views/js/watch.js b/web/skins/classic/views/js/watch.js index 3be7fda7a..18e9643e0 100644 --- a/web/skins/classic/views/js/watch.js +++ b/web/skins/classic/views/js/watch.js @@ -710,9 +710,13 @@ function initPage() var streamImg = $('imageFeed').getElement('img'); if ( !streamImg ) streamImg = $('imageFeed').getElement('object'); - $(streamImg).addEvent( 'click', handleClick.bindWithEvent( $(streamImg) ) ); if ( streamMode == "single" ) + { + streamImg.addEvent( 'click', fetchImage.pass( streamImg ) ); fetchImage.pass( streamImg ).periodical( imageRefreshTimeout ); + } + else + streamImg.addEvent( 'click', handleClick.bindWithEvent( streamImg ) ); } if ( refreshApplet && appletRefreshTime ) diff --git a/web/skins/classic/views/js/watch.js.php b/web/skins/classic/views/js/watch.js.php index 16709f9fc..8db4c7efc 100644 --- a/web/skins/classic/views/js/watch.js.php +++ b/web/skins/classic/views/js/watch.js.php @@ -50,7 +50,7 @@ var monitorHeight = ; var scale = ; -var streamSrc = ""; +var streamSrc = ""; var statusRefreshTimeout = ; var eventsRefreshTimeout = ; diff --git a/web/skins/classic/views/watch.php b/web/skins/classic/views/watch.php index 97ab12a50..661630ab3 100644 --- a/web/skins/classic/views/watch.php +++ b/web/skins/classic/views/watch.php @@ -44,7 +44,6 @@ $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'] ) ); $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() )