From 70de139e775e343283340f3305bcaee46bd971a6 Mon Sep 17 00:00:00 2001 From: IgorA100 Date: Thu, 28 Mar 2024 19:47:53 +0300 Subject: [PATCH 1/3] Feat: Ability to download videos on the "Event" page with a multiport configuration --- web/includes/Event.php | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/web/includes/Event.php b/web/includes/Event.php index f45e7af77..653a12ab4 100644 --- a/web/includes/Event.php +++ b/web/includes/Event.php @@ -257,15 +257,19 @@ class Event extends ZM_Object { public function getStreamSrc( $args=array(), $querySep='&' ) { - $streamSrc = ''; $Server = $this->Server(); # If we are in a multi-port setup, then use the multiport, else by # passing null Server->Url will use the Port set in the Server setting - $streamSrc .= $Server->Url( - ZM_MIN_STREAMING_PORT ? + if ($args['mode'] == 'mp4') { #Downloading a video file. It is possible to reconsider the condition later. + #If the port is different from 80, the browser will start watching the video instead of downloading. + $port = null; + } else { + $port = ZM_MIN_STREAMING_PORT ? ZM_MIN_STREAMING_PORT+$this->{'MonitorId'} : - null); + null; + } + $streamSrc = $Server->Url($port); if ( $this->{'DefaultVideo'} and $args['mode'] != 'jpeg' ) { $streamSrc .= $Server->PathToIndex(); From f2aed5fc216c81b62e7b35776ed27f42f07f4237 Mon Sep 17 00:00:00 2001 From: IgorA100 Date: Wed, 3 Apr 2024 22:58:21 +0300 Subject: [PATCH 2/3] Chore: Adjust spaces, tabs, newlines --- web/includes/Event.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/web/includes/Event.php b/web/includes/Event.php index 653a12ab4..87b0d02f6 100644 --- a/web/includes/Event.php +++ b/web/includes/Event.php @@ -121,6 +121,7 @@ class Event extends ZM_Object { public function StartDateTimeSecs() { return strtotime($this->{'StartDateTime'}); } + public function EndDateTimeSecs() { return strtotime($this->{'EndDateTime'}); } @@ -256,7 +257,6 @@ class Event extends ZM_Object { } public function getStreamSrc( $args=array(), $querySep='&' ) { - $Server = $this->Server(); # If we are in a multi-port setup, then use the multiport, else by @@ -321,8 +321,8 @@ class Event extends ZM_Object { } function createListThumbnail( $overwrite=false ) { - # The idea here is that we don't really want to use the analysis jpeg as the thumbnail. - # The snapshot image will be generated during capturing + # The idea here is that we don't really want to use the analysis jpeg as the thumbnail. + # The snapshot image will be generated during capturing if ( file_exists($this->Path().'/snapshot.jpg') ) { Debug("snapshot exists"); $frame = null; @@ -384,7 +384,7 @@ class Event extends ZM_Object { function getThumbnailSrc( $args=array(), $querySep='&' ) { # The thumbnail is theoretically the image with the most motion. -# We always store at least 1 image when capturing + # We always store at least 1 image when capturing $streamSrc = ''; $Server = $this->Server(); @@ -529,7 +529,7 @@ class Event extends ZM_Object { 'imageClass' => $alarmFrame?'alarm':'normal', 'isAnalysisImage' => $isAnalysisImage, 'hasAnalysisImage' => $hasAnalysisImage, - 'FrameId' => $frame['FrameId'], + 'FrameId' => $frame['FrameId'], ); return $imageData; @@ -681,6 +681,7 @@ class Event extends ZM_Object { } return false; } + function canEdit($u=null) { global $user; if (!$u) $u=$user; @@ -844,5 +845,4 @@ class Event extends ZM_Object { } # end sub GenerateVideo } # end class - ?> From 5e1596d9f51f6add727a36b8c746bd1020c59b36 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Fri, 5 Apr 2024 09:32:05 -0400 Subject: [PATCH 3/3] Fix panning not working when paused. Also fixes SCALE. Fixes #3947 --- src/zm_eventstream.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/zm_eventstream.cpp b/src/zm_eventstream.cpp index 7f76cabe9..82c8f9643 100644 --- a/src/zm_eventstream.cpp +++ b/src/zm_eventstream.cpp @@ -528,10 +528,20 @@ void EventStream::processCommand(const CmdMsg *msg) { x = ((unsigned char)msg->msg_data[1]<<8)|(unsigned char)msg->msg_data[2]; y = ((unsigned char)msg->msg_data[3]<<8)|(unsigned char)msg->msg_data[4]; Debug(1, "Got PAN command, to %d,%d", x, y); + send_frame = true; + if (paused) { + step = 1; + send_twice = true; + } break; case CMD_SCALE : scale = ((unsigned char)msg->msg_data[1]<<8)|(unsigned char)msg->msg_data[2]; Debug(1, "Got SCALE command, to %d", scale); + send_frame = true; + if (paused) { + step = 1; + send_twice = true; + } break; case CMD_PREV : Debug(1, "Got PREV command");