From 96aa15c15325b0bc02cc876053cfdeb29d63ab53 Mon Sep 17 00:00:00 2001 From: Evgeny Gagua Date: Mon, 17 Aug 2026 20:57:30 +0300 Subject: [PATCH] Some working version (internal demo) --- lib/controller/doSessionOperations.php | 6 + lib/controller/getComposedVideo.php | 55 +++ lib/controller/getComposerStatus.php | 106 +++++ lib/controller/getMonitoringPlatformView.php | 6 +- lib/controller/getMonitoringSessionView.php | 8 + lib/controller/getMonitoringTrackView.php | 8 + lib/controller/getSessionData.php | 72 +++ lib/controller/getVideoSegment.php | 50 +++ lib/controller/validateUserSession.php | 4 +- .../jsapi_dynamic/argus_global_vars.js | 3 +- lib/javascript/jsapi_dynamic/argus_main.js | 32 +- .../jsapi_dynamic/argus_monitoring.js | 66 ++- lib/javascript/jsapi_dynamic/argus_reports.js | 425 +++++++++++++++++- lib/php/argus/templates.php | 32 +- lib/upgrade_database.php | 31 ++ style/assets/lside.png | Bin 0 -> 3051 bytes style/assets/rside.png | Bin 0 -> 3027 bytes style/style.css | 38 ++ 18 files changed, 899 insertions(+), 43 deletions(-) create mode 100644 lib/controller/getComposedVideo.php create mode 100644 lib/controller/getComposerStatus.php create mode 100644 lib/controller/getVideoSegment.php create mode 100644 style/assets/lside.png create mode 100644 style/assets/rside.png diff --git a/lib/controller/doSessionOperations.php b/lib/controller/doSessionOperations.php index 6b8f6ee..be859b1 100644 --- a/lib/controller/doSessionOperations.php +++ b/lib/controller/doSessionOperations.php @@ -92,6 +92,12 @@ }; break; }; + case 3:{ // Compose Session videos` + $QS="INSERT INTO `mem_web_queue`(`cmd`,`aux_id`) VALUES(239,{$OID})"; + $DATABASE->Query( $QS ); + $Data['status'] = 'ok'; + break; + }; }; } else { $Data['msg']='Wrong Parameters!'; diff --git a/lib/controller/getComposedVideo.php b/lib/controller/getComposedVideo.php new file mode 100644 index 0000000..551fa83 --- /dev/null +++ b/lib/controller/getComposedVideo.php @@ -0,0 +1,55 @@ +Data['id'] ); + $ACCESS = intval( $CUser->Data['access'] ); + if( $CUser->Data['id'] > 1 ){ + if( isset( $_GET['SESSION'] ) ) $SESID = intval( $_GET['SESSION'] ); else $SESID = 0; + if( isset( $_GET['SIDE'] ) ) $SIDE = $_GET['SIDE']; else $SIDE = 'L'; + if( $SESID ){ + $QS = "SELECT * FROM `media_composer_queue` WHERE `session_id`={$SESID}"; + $RR = $DATABASE->Query( $QS ); + if( count( $RR ) ){ + $SD = $RR[0]; + if( $SIDE == 'L' ){ + $Data['basepath'] = '/lib/controller/data/composed_videos/'.$SD['uuid'].'_L.mp4'; + } else { + $Data['basepath'] = '/lib/controller/data/composed_videos/'.$SD['uuid'].'_R.mp4'; + } + $filePath = $SYSPath . $Data['basepath']; + if( file_exists( $filePath )){ + //$DBN = $SYSPath . $Data['basepath'] .'/report.db'; + //echo $DBN; + //if( !file_exists( $DBN )) echo "Not Exist!!"; + //$RBASE = new SQLite_DB( $DBN ); + //$QS = "SELECT * FROM `videos` WHERE `session_id`={$SESID} AND `id`={$VID}"; + //$RR = $RBASE->Query( $QS ); + //$CR = $RR[0]; + //$NAME = $CR['uuid'] . '.'. $CR['ext']; + //$filePath = $SYSPath . $Data['basepath'] . '/' . $NAME; + //if( file_exists($filePath) ){ + //$QS = "SELECT `ms`.`short`, `mp`.`level`, `mt`.`short` as `tshort` FROM ( `metro_tracks` `mt` LEFT JOIN `metro_platforms` `mp` ON ( `mt`.`platform_id`=`mp`.`id`) ) LEFT JOIN `metro_stations` `ms` ON ( `mp`.`station_id` = `ms`.`id` ) WHERE `mt`.`id`={$SD['track_id']}"; + //$RR = $DATABASE->Query( $QS ); + $downloadName = 'some_name_that_must_be_corrected.mp4';//$RR[0]['short'].'_'.$RR[0]['level'].'_'.$RR[0]['tshort'].'_'.date("Y-m-d_H.i.s", $CR['ts'] ).'.'. $CR['ext']; + // 1. Clear any previous output buffers + if (ob_get_level()) { + ob_end_clean(); + } + // 2. Set the content type (e.g., application/pdf, image/jpeg, or application/octet-stream) + header('Content-Type: application/octet-stream'); + // 3. Force download and define the file name + header('Content-Disposition: attachment; filename="' . $downloadName. '"'); + // 4. Provide the exact file size to show download progress + header('Content-Length: ' . filesize($filePath)); + // 5. Read the file and write it directly to the output buffer + readfile($filePath); + exit; + //} else { + // die("Error: The requested file does not exist."); + //}; + }; + }; + }; + }; +?> \ No newline at end of file diff --git a/lib/controller/getComposerStatus.php b/lib/controller/getComposerStatus.php new file mode 100644 index 0000000..9573922 --- /dev/null +++ b/lib/controller/getComposerStatus.php @@ -0,0 +1,106 @@ +Data['id'] ); + $ACCESS = intval( $CUser->Data['access'] ); + if( $CUser->Data['id'] > 1 ){ + $Data['status'] = 'error'; + if( isset( $_POST['SESSION'] ) ) $SESID = intval( $_POST['SESSION'] ); else $SESID = 0; + if( $SESID ){ + $QS = "SELECT * FROM `sessions` WHERE `id`={$SESID}"; + $RR = $DATABASE->Query( $QS ); + if( count( $RR ) ){ + $SD = $RR[0]; + $Data['ses_status']=intval( $SD['status'] ); + $Data['start_ts'] = intval( $SD['ts'] ) * 1000 + intval( $SD['ts_ms'] ); + $Data['track_id'] = intval( $SD['track_id'] ); + $QS = "SELECT * FROM `metro_tracks` WHERE `id`={$Data['track_id']}"; + $RR = $DATABASE->Query( $QS ); + $TRD = $RR[0]; + if( $TRD['side'] == 'U' ){ + $Data['r_module_id'] = intval( $TRD['near_module_id'] ); + $Data['l_module_id'] = intval( $TRD['far_module_id'] ); + } else { + $Data['r_module_id'] = intval( $TRD['far_module_id'] ); + $Data['l_module_id'] = intval( $TRD['near_module_id'] ); + }; + $QS = "SELECT `layout` FROM `metro_platforms` WHERE `id`={$TRD['platform_id']}"; + $RR = $DATABASE->Query( $QS ); + $Data['layout'] = $RR[0]['layout']; + //Get Names + $QS = "SELECT `name` FROM `metro_modules` WHERE `id`={$Data['l_module_id']}"; + $RR = $DATABASE->Query( $QS ); + $Data['l_module_name'] = $RR[0]['name']; + $QS = "SELECT `name` FROM `metro_modules` WHERE `id`={$Data['r_module_id']}"; + $RR = $DATABASE->Query( $QS ); + $Data['r_module_name'] = $RR[0]['name']; + + $QS = "SELECT * FROM `media_composer_queue` WHERE `session_id`={$SESID}"; + $RR = $DATABASE->Query( $QS ); + if( count( $RR ) ){ + $Data['composed_video'] = true; + $Data['composed_video_progress'] = intval( $RR[0]['process'] ) ; + if( $Data['composed_video_progress'] < 255 ){ + $Data['composed_video_status'] = 'W'; + } else { + $Data['composed_video_status'] = 'D'; + $Data['composed_left_video_exists'] = file_exists('data/composed_videos/' . $RR[0]['uuid'].'_L.mp4' ); + if( $Data['composed_left_video_exists'] ){ + $CMD = "ffprobe -hide_banner ./data/composed_videos/{$RR[0]['uuid']}_L.mp4 2>&1"; + $Zaza = `$CMD`; + $TA = explode( "\n", $Zaza ); + $Data['composed_left_info'] = array(); + $Data['composed_left_info']['file_size']= sprintf("%.2f Mb",filesize("./data/composed_videos/{$RR[0]['uuid']}_L.mp4")/1048576.0 ); + foreach( $TA as $A ){ + if( stripos( $A, "Duration:" ) !== false ){ + $YY = explode( "Duration:", $A ); + $JJ = explode( ",", $YY[1] ); + $Data['composed_left_info']['duration'] = trim( $JJ[0] ); + }; + if( stripos( $A, "Video:" ) !== false ){ + $YY = explode( "Video:", $A ); + $JJ = explode( ",", $YY[1] ); + $Data['composed_left_info']['codec']= trim( $JJ[0] ); + $Data['composed_left_info']['pic_size']= trim( $JJ[2] ); + $Data['composed_left_info']['bitrate']= trim( $JJ[3] ); + $Data['composed_left_info']['fps']= trim( $JJ[4] ); + }; + }; + }; + $Data['composed_right_video_exists'] = file_exists('data/composed_videos/' . $RR[0]['uuid'].'_R.mp4' ); + if( $Data['composed_right_video_exists'] ){ + $CMD = "ffprobe -hide_banner ./data/composed_videos/{$RR[0]['uuid']}_R.mp4 2>&1"; + $Zaza = `$CMD`; + $TA = explode( "\n", $Zaza ); + $Data['composed_right_info'] = array(); + $Data['composed_right_info']['file_size']= sprintf("%.2f Mb",filesize("./data/composed_videos/{$RR[0]['uuid']}_R.mp4")/1048576.0 ); + foreach( $TA as $A ){ + if( stripos( $A, "Duration:" ) !== false ){ + $YY = explode( "Duration:", $A ); + $JJ = explode( ",", $YY[1] ); + $Data['composed_right_info']['duration'] = trim( $JJ[0] ); + }; + if( stripos( $A, "Video:" ) !== false ){ + $YY = explode( "Video:", $A ); + $JJ = explode( ",", $YY[1] ); + $Data['composed_right_info']['codec']= trim( $JJ[0] ); + $Data['composed_right_info']['pic_size']= trim( $JJ[2] ); + $Data['composed_right_info']['bitrate']= trim( $JJ[3] ); + $Data['composed_right_info']['fps']= trim( $JJ[4] ); + }; + }; + }; + }; + $Data['status'] = 'ok'; + } else { + $Data['err_msg'] = 'No Composer Record!'; + }; + } else $Data['err_msg'] = 'Session ID is Wrong!'; + } else $Data['err_msg'] = 'No Session ID provided!'; + $Data['messages'] = ob_get_clean(); + echo json_encode( $Data ); + } else { + header('location: /'); + }; +?> \ No newline at end of file diff --git a/lib/controller/getMonitoringPlatformView.php b/lib/controller/getMonitoringPlatformView.php index 7cc3960..f7717e4 100644 --- a/lib/controller/getMonitoringPlatformView.php +++ b/lib/controller/getMonitoringPlatformView.php @@ -124,8 +124,10 @@ $CVTPL = str_ireplace( '%%%%TITLE%%%', $TTL, $CVTPL ); $CVTPL = str_ireplace( '%%%STATUS%CLASS%%', 'aaBB', $CVTPL ); $CVTPL = str_ireplace( '%%%IMG%URL%%%', $URL, $CVTPL ); - $CVTPL = str_ireplace( '%%%STATUS%%%', 'Status', $CVTPL ); - $ITEM = str_ireplace( '%%%VIDEO'.$CTRK['side'].$MM['side'].'%%%', $CVTPL, $ITEM ); + $CVTPL = str_ireplace( '%%%IMG%URL%%%', $URL, $CVTPL ); + $CVTPL = str_ireplace( '%%MIP%%', $MM['IP4'], $CVTPL ); + $CVTPL = str_ireplace( '%%MCID%%', $MM['cam_id'], $CVTPL ); + $ITEM = str_ireplace( '%%%VIDEO'.$CTRK['side'].$MM['side'].'%%%', $CVTPL, $ITEM ); $MODU_IDS[] = $MM['id']; }; } else { diff --git a/lib/controller/getMonitoringSessionView.php b/lib/controller/getMonitoringSessionView.php index e6d712b..9997594 100644 --- a/lib/controller/getMonitoringSessionView.php +++ b/lib/controller/getMonitoringSessionView.php @@ -58,9 +58,13 @@ $LTitle = $MD['name']; $LVID = str_ireplace( '%%%SELURL%%%', $URL, $LVID ); $LVID = str_ireplace( '%%%HBTN%%%',' ', $LVID ); + $LVID = str_ireplace( '%%MIP%%', $MD['IP4'], $LVID ); + $LVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $LVID ); } else { $LVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX ); $LVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $LVID ); + $LVID = str_ireplace( '%%MIP%%', $MD['IP4'], $LVID ); + $LVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $LVID ); }; } else { $LVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX ); @@ -77,9 +81,13 @@ $RTitle = $MD['name']; $RVID = str_ireplace( '%%%SELURL%%%', $URL, $RVID ); $RVID = str_ireplace( '%%%HBTN%%%',' ', $RVID ); + $RVID = str_ireplace( '%%MIP%%', $MD['IP4'], $RVID ); + $RVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $RVID ); } else { $RVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX ); $RVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $RVID ); + $RVID = str_ireplace( '%%MIP%%', $MD['IP4'], $RVID ); + $RVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $RVID ); }; } else { $RVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX ); diff --git a/lib/controller/getMonitoringTrackView.php b/lib/controller/getMonitoringTrackView.php index 5547e59..7cbb820 100644 --- a/lib/controller/getMonitoringTrackView.php +++ b/lib/controller/getMonitoringTrackView.php @@ -66,9 +66,13 @@ $LTitle = $MD['name']; $LVID = str_ireplace( '%%%SELURL%%%', $URL, $LVID ); $LVID = str_ireplace( '%%%HBTN%%%',' ', $LVID ); + $LVID = str_ireplace( '%%MIP%%', $MD['IP4'], $LVID ); + $LVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $LVID ); } else { $LVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX ); $LVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $LVID ); + $LVID = str_ireplace( '%%MIP%%', $MD['IP4'], $LVID ); + $LVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $LVID ); $LMID = 0; } } else { @@ -86,9 +90,13 @@ $RTitle = $MD['name']; $RVID = str_ireplace( '%%%SELURL%%%', $URL, $RVID ); $RVID = str_ireplace( '%%%HBTN%%%',' ', $RVID ); + $RVID = str_ireplace( '%%MIP%%', $MD['IP4'], $RVID ); + $RVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $RVID ); } else { $RVID = str_ireplace( '%%MID%%', '1', $EMPTY_VIDEO_CTX ); $RVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $RVID ); + $RVID = str_ireplace( '%%MIP%%', $MD['IP4'], $RVID ); + $RVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $RVID ); $RMID = 0; }; } else { diff --git a/lib/controller/getSessionData.php b/lib/controller/getSessionData.php index 0ffad21..f3a8908 100644 --- a/lib/controller/getSessionData.php +++ b/lib/controller/getSessionData.php @@ -28,6 +28,73 @@ $QS = "SELECT `layout` FROM `metro_platforms` WHERE `id`={$TRD['platform_id']}"; $RR = $DATABASE->Query( $QS ); $Data['layout'] = $RR[0]['layout']; + //Get Names + $QS = "SELECT `name` FROM `metro_modules` WHERE `id`={$Data['l_module_id']}"; + $RR = $DATABASE->Query( $QS ); + $Data['l_module_name'] = $RR[0]['name']; + $QS = "SELECT `name` FROM `metro_modules` WHERE `id`={$Data['r_module_id']}"; + $RR = $DATABASE->Query( $QS ); + $Data['r_module_name'] = $RR[0]['name']; + + $QS = "SELECT * FROM `media_composer_queue` WHERE `session_id`={$SESID}"; + $RR = $DATABASE->Query( $QS ); + if( count( $RR ) ){ + $Data['composed_video'] = true; + $Data['composed_video_progress'] = intval( $RR[0]['process'] ) ; + if( $Data['composed_video_progress'] < 255 ){ + $Data['composed_video_status'] = 'W'; + } else { + $Data['composed_video_status'] = 'D'; + $Data['composed_left_video_exists'] = file_exists('data/composed_videos/' . $RR[0]['uuid'].'_L.mp4' ); + if( $Data['composed_left_video_exists'] ){ + $CMD = "ffprobe -hide_banner ./data/composed_videos/{$RR[0]['uuid']}_L.mp4 2>&1"; + $Zaza = `$CMD`; + $TA = explode( "\n", $Zaza ); + $Data['composed_left_info'] = array(); + $Data['composed_left_info']['file_size']= sprintf("%.2f Mb",filesize("./data/composed_videos/{$RR[0]['uuid']}_L.mp4")/1048576.0 ); + foreach( $TA as $A ){ + if( stripos( $A, "Duration:" ) !== false ){ + $YY = explode( "Duration:", $A ); + $JJ = explode( ",", $YY[1] ); + $Data['composed_left_info']['duration'] = trim( $JJ[0] ); + }; + if( stripos( $A, "Video:" ) !== false ){ + $YY = explode( "Video:", $A ); + $JJ = explode( ",", $YY[1] ); + $Data['composed_left_info']['codec']= trim( $JJ[0] ); + $Data['composed_left_info']['pic_size']= trim( $JJ[2] ); + $Data['composed_left_info']['bitrate']= trim( $JJ[3] ); + $Data['composed_left_info']['fps']= trim( $JJ[4] ); + }; + }; + }; + $Data['composed_right_video_exists'] = file_exists('data/composed_videos/' . $RR[0]['uuid'].'_R.mp4' ); + if( $Data['composed_right_video_exists'] ){ + $CMD = "ffprobe -hide_banner ./data/composed_videos/{$RR[0]['uuid']}_R.mp4 2>&1"; + $Zaza = `$CMD`; + $TA = explode( "\n", $Zaza ); + $Data['composed_right_info'] = array(); + $Data['composed_right_info']['file_size']= sprintf("%.2f Mb",filesize("./data/composed_videos/{$RR[0]['uuid']}_R.mp4")/1048576.0 ); + foreach( $TA as $A ){ + if( stripos( $A, "Duration:" ) !== false ){ + $YY = explode( "Duration:", $A ); + $JJ = explode( ",", $YY[1] ); + $Data['composed_right_info']['duration'] = trim( $JJ[0] ); + }; + if( stripos( $A, "Video:" ) !== false ){ + $YY = explode( "Video:", $A ); + $JJ = explode( ",", $YY[1] ); + $Data['composed_right_info']['codec']= trim( $JJ[0] ); + $Data['composed_right_info']['pic_size']= trim( $JJ[2] ); + $Data['composed_right_info']['bitrate']= trim( $JJ[3] ); + $Data['composed_right_info']['fps']= trim( $JJ[4] ); + }; + }; + }; + }; + } else { + $Data['composed_video'] = false; + }; $Data['basepath'] = '/lib/controller/data/reports/'.$Data['track_id'].'/'.date("Y/m/d",intval( $SD['ts'] )); if( file_exists( $SYSPath . $Data['basepath'] )){ $Data['events']= array(); @@ -50,17 +117,22 @@ //$CE['module_id']=intval( $CR['module_id'] ); $CE['az']=floatval( $CR['azimuth'] ); $CE['r']=floatval( $CR['range'] );//cos( floatval( $CR['azimuth'] ) ) + if( $TRD['side'] == 'U' ){ if( $Data['r_module_id'] == intval( $CR['module_id'] ) ){ $CE['x'] = 75.0+25.0 *(($CR['azimuth']>90 && $CR['azimuth'] < 210)?1.0:-1.0) * floatval( $CR['range'] ) / 70.0; + $CE['side']= 'R'; } else { $CE['x'] = 25.0+25.0 *(($CR['azimuth']>90 && $CR['azimuth'] < 210)?1.0:-1.0) * floatval( $CR['range'] ) / 70.0; + $CE['side']= 'L'; }; } else { if( $Data['r_module_id'] == intval( $CR['module_id'] ) ){ $CE['x'] = 75.0+25.0 *(($CR['azimuth']>90 && $CR['azimuth'] < 210)?-1.0:1.0) * floatval( $CR['range'] ) / 70.0; + $CE['side']= 'R'; } else { $CE['x'] = 25.0+25.0 *(($CR['azimuth']>90 && $CR['azimuth'] < 210)?-1.0:1.0) * floatval( $CR['range'] ) / 70.0; + $CE['side']= 'L'; }; }; $Data['events'][] = $CE; diff --git a/lib/controller/getVideoSegment.php b/lib/controller/getVideoSegment.php new file mode 100644 index 0000000..1b37b11 --- /dev/null +++ b/lib/controller/getVideoSegment.php @@ -0,0 +1,50 @@ +Data['id'] ); + $ACCESS = intval( $CUser->Data['access'] ); + if( $CUser->Data['id'] > 1 ){ + if( isset( $_GET['SESSION'] ) ) $SESID = intval( $_GET['SESSION'] ); else $SESID = 0; + if( isset( $_GET['VID'] ) ) $VID = intval( $_GET['VID'] ); else $VID = 0; + if( $SESID ){ + $QS = "SELECT * FROM `sessions` WHERE `id`={$SESID}"; + $RR = $DATABASE->Query( $QS ); + if( count( $RR ) ){ + $SD = $RR[0]; + $Data['basepath'] = '/lib/controller/data/reports/'.$SD['track_id'].'/'.date("Y/m/d",intval( $SD['ts'] )); + if( file_exists( $SYSPath . $Data['basepath'] )){ + $DBN = $SYSPath . $Data['basepath'] .'/report.db'; + //echo $DBN; + //if( !file_exists( $DBN )) echo "Not Exist!!"; + $RBASE = new SQLite_DB( $DBN ); + $QS = "SELECT * FROM `videos` WHERE `session_id`={$SESID} AND `id`={$VID}"; + $RR = $RBASE->Query( $QS ); + $CR = $RR[0]; + $NAME = $CR['uuid'] . '.'. $CR['ext']; + $filePath = $SYSPath . $Data['basepath'] . '/' . $NAME; + if( file_exists($filePath) ){ + $QS = "SELECT `ms`.`short`, `mp`.`level`, `mt`.`short` as `tshort` FROM ( `metro_tracks` `mt` LEFT JOIN `metro_platforms` `mp` ON ( `mt`.`platform_id`=`mp`.`id`) ) LEFT JOIN `metro_stations` `ms` ON ( `mp`.`station_id` = `ms`.`id` ) WHERE `mt`.`id`={$SD['track_id']}"; + $RR = $DATABASE->Query( $QS ); + $downloadName = $RR[0]['short'].'_'.$RR[0]['level'].'_'.$RR[0]['tshort'].'_'.date("Y-m-d_H.i.s", $CR['ts'] ).'.'. $CR['ext']; + // 1. Clear any previous output buffers + if (ob_get_level()) { + ob_end_clean(); + } + // 2. Set the content type (e.g., application/pdf, image/jpeg, or application/octet-stream) + header('Content-Type: application/octet-stream'); + // 3. Force download and define the file name + header('Content-Disposition: attachment; filename="' . $downloadName. '"'); + // 4. Provide the exact file size to show download progress + header('Content-Length: ' . filesize($filePath)); + // 5. Read the file and write it directly to the output buffer + readfile($filePath); + exit; + } else { + die("Error: The requested file does not exist."); + }; + }; + }; + }; + }; +?> \ No newline at end of file diff --git a/lib/controller/validateUserSession.php b/lib/controller/validateUserSession.php index ed8b120..46dbf36 100644 --- a/lib/controller/validateUserSession.php +++ b/lib/controller/validateUserSession.php @@ -8,8 +8,8 @@ // If difference more then 2 minutes if( abs( $MTS-$CTS ) > 120 ){ //Push Kernel Command -> Sync Time - $QS = "INSERT INTO `command_bus`(`target_id`,`cmd`,`status`,`parameter`) VALUES(1,252,0,'{$CTS}')"; - $DATABASE->Query( $QS, false ); + //$QS = "INSERT INTO `command_bus`(`target_id`,`cmd`,`status`,`parameter`) VALUES(1,252,0,'{$CTS}')"; + //$DATABASE->Query( $QS, false ); // Logout user to perform time sync //echo "{'sessionIsValid': false }"; //exit(); diff --git a/lib/javascript/jsapi_dynamic/argus_global_vars.js b/lib/javascript/jsapi_dynamic/argus_global_vars.js index 5ca388e..860cb7d 100644 --- a/lib/javascript/jsapi_dynamic/argus_global_vars.js +++ b/lib/javascript/jsapi_dynamic/argus_global_vars.js @@ -85,7 +85,8 @@ var tlLoadLocker = false; var tlLastTS = 0; var tlInterval = null; var tlMonitoring = false; - +var tlMemCheckInterval = null; +const MemCheckMaxHS = 2147483648; //2Gb Data['ss_timeout']) ){ ?> diff --git a/lib/javascript/jsapi_dynamic/argus_main.js b/lib/javascript/jsapi_dynamic/argus_main.js index e507923..944c5c2 100644 --- a/lib/javascript/jsapi_dynamic/argus_main.js +++ b/lib/javascript/jsapi_dynamic/argus_main.js @@ -157,6 +157,27 @@ function failureAJAXFunction( responce, opts ){ //doLogout(); }; +function doCheckHeap(){ + if( performance != undefined ){ + if( performance.memory != undefined ){ + cMV = performance.memory; + //console.log( cMV.totalJSHeapSize ); + if( cMV.totalJSHeapSize > MemCheckMaxHS ) doRefresh(); + if( tlMemCheckInterval == null ){ + tlMemCheckInterval = window.setInterval( doCheckHeap, 3000 ); + }; + }; + }; + if (performance.measureUserAgentSpecificMemory) { + try { + const memorySample = performance.measureUserAgentSpecificMemory(); + console.log(`Total page memory usage: ${memorySample.bytes} bytes`); + } catch (error) { + console.error("Measurement failed:", error); + }; + }; +}; + function doUserOperation( OPId, Param, reload ){ Ext.Ajax.request({ url: '/lib/controller/updateUserSettings.php', @@ -189,7 +210,7 @@ function updateUserScreenResolution( x, y ){ failure: failureAJAXFunction }); }; -var contentChangesCount = 0; +//var contentChangesCount = 0; function updateUserContent(){ var ser_c = Ext.encode( contentView ); if( contentViewConfig != ser_c ) { @@ -203,8 +224,9 @@ function updateUserContent(){ }, success: function(){ contentViewConfig = ser_c; - contentChangesCount++; - if( contentChangesCount%5== 0 ) doRefresh(); + //Handle Memory by Checking Heap Sizes in Timer Function + //contentChangesCount++; + //if( contentChangesCount%5== 0 ) doRefresh(); }, failure: failureAJAXFunction }); @@ -399,10 +421,10 @@ Ext.onReady(function(){ if( 'wakeLock' in navigator ) tryKeepScreenAlive(10); - + doCheckHeap(); doCheckWindowSize(); if( Data['ss_mode']);?> == 1 ) ssShowSS(); - gSessionValidatorInterval = window.setInterval( sessionValidator, 1000 ); + gSessionValidatorInterval = window.setInterval( sessionValidator, 5000 ); NotificationStack = new PNotify.Stack({dir1: 'down', firstpos1: 25}); //window.onresize = doCheckWindowSize; Ext.QuickTips.init(); diff --git a/lib/javascript/jsapi_dynamic/argus_monitoring.js b/lib/javascript/jsapi_dynamic/argus_monitoring.js index 79cc4ba..a3110d0 100644 --- a/lib/javascript/jsapi_dynamic/argus_monitoring.js +++ b/lib/javascript/jsapi_dynamic/argus_monitoring.js @@ -860,7 +860,7 @@ function fetchStatus(){ if( data.modules[i].status > 0 ){ var tt = document.getElementById('plat_video_'+mon_selectedPlatform+'_'+data.modules[i].id ); if( tt != undefined ){ - if( tt.src != data.modules[i].img ) tt.src = data.modules[i].img; + //if( tt.src != data.modules[i].img ) tt.src = data.modules[i].img; }; tt = document.getElementById('plat_status_'+mon_selectedPlatform+'_'+data.modules[i].id ); if( tt != undefined ){ @@ -1242,3 +1242,67 @@ function loadMonitoringSessionView( session_id ){ failure: failureAJAXFunction }); }; + +var peerConnections = []; + +async function startWhepClient( video_id, ip_address, stream_id ){ + const STREAM_PATH = stream_id; // 'stream_3'; // Replace with your stream name + const MEDIAMTX_URL = 'http://'+ip_address+':8889/'+STREAM_PATH+'/whep'; + + // 1. Initialize the RTCPeerConnection + //if( peerConnection == null ){ + const peerConnection = new RTCPeerConnection({ + iceServers: [{ urls: 'stun:stun.l.google.com:19302' }] // Standard STUN for local/NAT routing + }); + peerConnections[video_id] = peerConnection; + //}; + + // 2. Set up media placeholders (MediaMTX requires transceivers before the offer) + peerConnection.addTransceiver('video', { direction: 'recvonly' }); + //peerConnection.addTransceiver('audio', { direction: 'recvonly' }); + + // 3. Handle incoming stream track + peerConnection.ontrack = (event) => { + var videoElement = document.getElementById( video_id ); + if (videoElement && event.streams[0]) { + videoElement.srcObject = event.streams[0]; + } + }; + + // 4. Create and set Local Description (Offer) + const offer = await peerConnection.createOffer(); + await peerConnection.setLocalDescription(offer); + + // 5. Send Offer to MediaMTX via HTTP POST + const response = await fetch(MEDIAMTX_URL, { + method: 'POST', + headers: { 'Content-Type': 'application/sdp' }, + body: peerConnection.localDescription.sdp + }); + + if (!response.ok) { + throw new Error(`MediaMTX WHEP signaling failed: ${response.statusText}`); + } + + // 6. Set Remote Description (Answer) received from MediaMTX + const answerSdp = await response.text(); + await peerConnection.setRemoteDescription(new RTCSessionDescription({ + type: 'answer', + sdp: answerSdp + })); +}; + +function stopWhepClient( video_id, stream_id ){ + if( peerConnections[video_id] != undefined ){ + peerConnections[video_id].getReceivers().forEach( receiver => { + if( receiver.track ){ + receiver.track.stop(); + } + }); + peerConnections[video_id].close(); + delete( peerConnections[video_id] ); + var videoElement = document.getElementById( video_id ); + videoElement.srcObject = null; + videoElement.load(); + }; +} \ No newline at end of file diff --git a/lib/javascript/jsapi_dynamic/argus_reports.js b/lib/javascript/jsapi_dynamic/argus_reports.js index a3f2342..54f0a53 100644 --- a/lib/javascript/jsapi_dynamic/argus_reports.js +++ b/lib/javascript/jsapi_dynamic/argus_reports.js @@ -249,6 +249,32 @@ var eventsListStore = new Ext.data.JsonStore({ })*/ }); +var videosListStore = new Ext.data.JsonStore({ + root: 'videos', +// totalProperty: 'totalCount', + idProperty: 'id', + remoteSort: true, + fields: [{ + name: 'id', + type: 'int' + },{ + name: 'sts', + type: 'int' + },{ + name: 'ets', + type: 'int' + },{ + name: 'side', + type: 'string' + },{ + name: 'name', + type: 'string', + },{ + name: 'fps', + type: 'int', + }] +}); + var EventPanelWindow = null; function showEventPanel(){ if( EventPanelWindow == null ){ @@ -587,6 +613,224 @@ function showEventsOnMap( data, removeCursor = true ){ }; }; +var sesVideosStartTS = 0; + +function VideoButtonRenderer( value, metaData, record, rowIndex, colIndex, store ){ + return 'Download'; +} +function VideoStartRenderer( value, metaData, record, rowIndex, colIndex, store ){ + var csec = parseInt((record.data.sts - sesVideosStartTS)/1000); + var cmin = parseInt( csec / 60 ); + var chour = parseInt( csec / 3600 ); + csec = csec % 60; + var oms=''; + if( chour ){ + oms= String(chour).padStart(2, '0')+':'+String(cmin).padStart(2, '0')+':'+String(csec).padStart(2, '0'); + } else { + if( cmin ){ + oms= '00:'+String(cmin).padStart(2, '0')+':'+String(csec).padStart(2, '0'); + } else { + oms= '00:00:'+String(csec).padStart(2, '0'); + }; + }; + return oms; +} +function VideoSideRenderer( value ){ + if( value == 'L' ){ + return sesVideosListLName;//''; + }; + return sesVideosListRName;//''; +} +function VideoLengthRenderer( value, metaData, record, rowIndex, colIndex, store ){ + return parseInt((record.data.ets - record.data.sts)/1000)+ ' sec.'; +} + +var videosListColModel_ops = { + columns: [ + {header: "ID", width: 50, sortable: false, menuDisabled: true, align: 'center', fixed: true, css: 'vertical-align: middle;', dataIndex: 'id' }, + {header: "Time",width: 120, sortable: false, fixed: true, menuDisabled: true, /*renderer: camCapRenderer,*/ dataIndex: 'sts', renderer: VideoStartRenderer }, + {header: "Length", width: 100, sortable: false, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'ets', renderer: VideoLengthRenderer }, + {header: "Side", width: 100, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'side' ,renderer: VideoSideRenderer }, + /*{header: "Name", width: 180, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'name' },*/ + {header: "Download", width: 100, sortable: false, fixed: true, menuDisabled: true, align: 'left', css: 'vertical-align: middle;', dataIndex: 'id', renderer: VideoButtonRenderer } + ], + defaults: { + sortable: true, + menuDisabled: true, + width: 100 + }, + listeners: { + hiddenchange: function(cm, colIndex, hidden) { + //saveConfig(colIndex, hidden); + } + } +}; +var SelectedVideo = -1; +var SelectedVideoRow = null; +var videosListSelModel_ops = { + singleSelect: true, + listeners: { + rowselect: function(sm, row, rec ) { + //loadEventProperties( rec.data ); + SelectedVideo = rec.data.id; + SelectedVideoRow = row; + //alert( SelectedEvent ); + //var CB = Ext.getCmp('con_to_src'); + //CB.enable(); + } + } +}; + +var CompositeVideoStatus = 0; +var CompositeVideoProgress = 0; +var CompositeVideoStatusTO = null; +var sesVideosListWindow = null; +var sesVideosListRName = ''; +var sesVideosListLName = ''; +var sesVideosListRExists = false; +var sesVideosListLExists = false; +var CompositeVideoRightInfo = null; +var CompositeVideoLeftInfo = null; +function startVideoComposer(){ + Ext.Ajax.request({ + url: '/lib/controller/doSessionOperations.php', + params: { + SESSION: SelectedSessionID, + OPID: 3, + UID: , + SID: '' + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + if( data.status == 'ok' ){ + CompositeVideoStatus = 1; + CompositeVideoProgress = 0; + CompositeVideoStatusUpdate(); + } else { + Ext.Msg.show({ + title:'GetLabel('_ERROR_MSG_');?>', + msg: data.msg, + buttons: Ext.Msg.OK, + icon: Ext.MessageBox.ERROR + }); + }; + }, + failure: failureAJAXFunction + }); +} +function CompositeVideoStatusUpdate(){ + var rr = Ext.getCmp('EvtVidCompDownPanel'); + rr.removeAll(); + switch( CompositeVideoStatus ){ + case 0:{ + rr.add({ + xtype: 'panel', + frame: false, + border: false, + html: '
Compose Videos into one file
 
Start Video Composer
 
' + }); + break; + }; + case 1:{ + rr.add({ + border: false, + frame: false, + //layout: 'vbox', + //layoutConfig: { + // align: 'center' + //}, + items:[{ + html: '
Composing Video
' + },{ + xtype: 'progress', + value: CompositeVideoProgress + }] + }); + //CompositeVideoStatusTO = window.setTimeout( 1000, eventVideosStatusUpdater ); + eventVideosStatusUpdater(); + break; + }; + case 2:{ + if( sesVideosListRExists ){ + rr.add({ + xtype: 'panel', + frame: false, + border: false, + html: '
Composed Video from '+sesVideosListRName+' side
Resolution:'+CompositeVideoRightInfo.pic_size+'
Frame rate:'+CompositeVideoRightInfo.fps+'
Codec:'+CompositeVideoRightInfo.codec+'
Duration:'+CompositeVideoRightInfo.duration+'
File size:'+CompositeVideoRightInfo.file_size+'
Download
' + }); + }; + if( sesVideosListLExists ){ + rr.add({ + xtype: 'panel', + frame: false, + border: false, + html: '
Composed Video from '+sesVideosListLName+' side
Resolution:'+CompositeVideoLeftInfo.pic_size+'
Frame rate:'+CompositeVideoLeftInfo.fps+'
Codec:'+CompositeVideoLeftInfo.codec+'
Duration:'+CompositeVideoLeftInfo.duration+'
File size:'+CompositeVideoLeftInfo.file_size+'
Download
' + }); + }; + break; + }; + }; + rr.doLayout(); +} + +function hideEventsVideos(){ + //if( sesVideosListWindow != null ){ + // sesVideosListWindow.hide(); + //} + if( CompositeVideoStatusTO!= null ) window.clearTimeout( CompositeVideoStatusTO ); + CompositeVideoStatusTO = null; + sesVideosListWindow = null; +} + +function eventVideosStatusUpdater(){ + Ext.Ajax.request({ + url: '/lib/controller/getComposerStatus.php', + params: { + SESSION: SelectedSessionID, + UID: , + SID: '' + }, + success: function( response, opts ){ + var data = Ext.decode(response.responseText); + + CompositeVideoStatusUpdate() + CompositeVideoStatusTO = window.setTimeout( 1000, eventVideosStatusUpdater ); + } + }); +} + +function showEventsVideos(){ + if( sesVideosListWindow == null ){ + sesVideosListWindow = new Ext.Window({ + title: 'Videos', + modal: true, + width: 490, + height: 560, + closeAction: 'close', + resizable: false, + items:[{ + xtype: 'grid', + height: 350, + ds: videosListStore, + cm: new Ext.grid.ColumnModel( videosListColModel_ops ), + sm: new Ext.grid.RowSelectionModel( videosListSelModel_ops ), + },{ + xtype: 'panel', + border: false, + frame: false, + id: 'EvtVidCompDownPanel', + autoScroll: true, + items:[] + }], + listeners:{ + close: hideEventsVideos + } + }); + }; + sesVideosListWindow.show(); + CompositeVideoStatusUpdate(); +}; + function LoadMapEventsZ( Mode ){ if( tlLoadLocker ) return; tlLoadLocker = true; @@ -746,6 +990,7 @@ function getData( Mode, ST = 0, ET = 0, SR = 0, DR = 0 ){ }; function loadArchive(){ + debugger; if( tlInterval!= null ){ window.clearInterval( tlInterval ); tlInterval = null; @@ -1305,6 +1550,8 @@ class argusSessionPlayer{ this.lVideos = []; this.rVideos = []; this.Events = []; + this.rEvents = []; + this.lEvents = []; this.mSvgElements = []; if( autoplay != undefined ) this.mAutoPlay = autoplay; Ext.Ajax.request({ @@ -1331,20 +1578,59 @@ class argusSessionPlayer{ mSesPlay.lVideos = []; mSesPlay.nextRTimestamp = 0.0; mSesPlay.nextLTimestamp = 0.0; + sesVideosListRName = data.r_module_name; + sesVideosListLName = data.l_module_name; + if( data.composed_video ){ + if( data.composed_video_status == 'D' ){ + CompositeVideoStatus = 2; + sesVideosListRExists = data.composed_right_video_exists; + sesVideosListLExists = data.composed_left_video_exists; + if( sesVideosListLExists ) CompositeVideoLeftInfo = data.composed_left_info; else CompositeVideoLeftInfo = null; + if( sesVideosListRExists ) CompositeVideoRightInfo = data.composed_right_info; else CompositeVideoRightInfo = null; + } else { + CompositeVideoStatus = 1; + CompositeVideoProgress = data.composed_video_progress; + CompositeVideoLeftInfo = null; + CompositeVideoRightInfo = null; + sesVideosListRExists = false; + sesVideosListLExists = false; + } + } else CompositeVideoStatus = 0; var tt = Ext.getCmp('hpl_slider'); tt.setMinValue( 0 ); tt.setMaxValue( data.length / 1000 ); - if( data.events.length ) mSesPlay.Events = data.events; + if( data.events.length ){ + mSesPlay.Events = data.events; + for( var i=0; i < data.events.length; i++ ){ + if( data.events[i].side == 'L' ){ + mSesPlay.lEvents.push( data.events[i] ); + } else { + mSesPlay.rEvents.push( data.events[i] ); + }; + }; + }; if( data.videos.length ){ - for( var i=0; i < data.videos.length; i++ ) - if( data.videos[i].side == 'R' ) mSesPlay.rVideos.push( data.videos[i] ); else mSesPlay.lVideos.push( data.videos[i] ); + videosListStore.loadData( data, false ); + for( var i=0; i < data.videos.length; i++ ){ + if( mSesPlay.currentTime == 0 ){ + mSesPlay.currentTime = data.videos[i].sts; + } else { + if( data.videos[i].sts < mSesPlay.currentTime ) mSesPlay.currentTime = data.videos[i].sts; + }; + if( data.videos[i].side == 'R' ) mSesPlay.rVideos.push( data.videos[i] ); + else mSesPlay.lVideos.push( data.videos[i] ); + }; + sesVideosStartTS = mSesPlay.currentTime; + } else { + sesVideosStartTS = 0; + videosListStore.removeAll(); }; - if( mSesPlay.rVideos.length ) { //data.r_module_id ){ + if( mSesPlay.rVideos.length ) { mSesPlay.rVideoJS_id = 'video_player_'+data.r_module_id; mSesPlay.rVideoJS = videojs( mSesPlay.rVideoJS_id ); - //mSesPlay.rVideoJS.poster( window.location.origin + '/style/assets/no-signal_h.png' ); + mSesPlay.rVideoJS.on("click", function(){ mSesPlay.play(); }); mSesPlay.rVideoJS.on("dblclick", function(){ fullScreen( mSesPlay.rVideoJS_id );}); // New imp @@ -1359,12 +1645,20 @@ class argusSessionPlayer{ }); mSesPlay.rVideoJS.on('videotick', (e) => { - console.log("Video timestamp:", e.timestamp.toFixed(1)); + mSesPlay.action( mSesPlay.rVideos[mSesPlay.rVideoJS_cid].sts + e.timestamp*1000 ); + }); + mSesPlay.rVideoJS.on('ended', function() { + console.log("Video Ended!"); + if( mSesPlay.rVideoJS_cid < mSesPlay.rVideos.length ){ + mSesPlay.rVideoJS_cid++; + var ns = {type: 'video/mp4', src: mSesPlay.basePath + mSesPlay.rVideos[mSesPlay.rVideoJS_cid].name }; + mSesPlay.rVideoJS.src( ns ); + mSesPlay.rVideoJS.play(); + mSesPlay.rVideoJS_playing = true; + }; }); - } else { - //correct empty Video Placeholder }; - if( mSesPlay.lVideos.length ){ //data.l_module_id ){ + if( mSesPlay.lVideos.length ){ mSesPlay.lVideoJS_id = 'video_player_'+data.l_module_id; mSesPlay.lVideoJS = videojs( mSesPlay.lVideoJS_id ); @@ -1382,10 +1676,18 @@ class argusSessionPlayer{ }); mSesPlay.lVideoJS.on('videotick', (e) => { - console.log("Video timestamp:", e.timestamp.toFixed(1)); + mSesPlay.action( mSesPlay.lVideos[mSesPlay.lVideoJS_cid].sts + e.timestamp*1000 ); + }); + mSesPlay.lVideoJS.on('ended', function() { + console.log("Video Ended!"); + if( mSesPlay.lVideoJS_cid < mSesPlay.lVideos.length ){ + mSesPlay.lVideoJS_cid++; + var ns = {type: 'video/mp4', src: mSesPlay.basePath + mSesPlay.lVideos[mSesPlay.lVideoJS_cid].name }; + mSesPlay.lVideoJS.src( ns ); + mSesPlay.lVideoJS.play(); + mSesPlay.lVideoJS_playing = true; + }; }); - } else { - //correct empty Video Placeholder }; drawSessionDataOnSlider( mSesPlay.startTime/1000, mSesPlay.endTime/1000, data.events, data.videos ); mSesPlay.setPosition( 0 ); @@ -1403,10 +1705,66 @@ class argusSessionPlayer{ failure: failureAJAXFunction }); } - action(){ + checkPlayebleTime( ct ){ + if( this.rVideos.length ){ + var fid = -1; + if( this.rVideoJS_cid < this.rVideos.length - 1 ){ + for(var i=this.rVideoJS_cid+1; i < this.rVideos.length; i++ ){ + if( this.currentTime >= this.rVideos[i].sts && this.currentTime <= (this.rVideos[i].sts+60000) ){ + fid = i; + break; + }; + }; + if( fid < 0 ){ + //No Segments for Now; + //this.rVideoJS_playing = false; + this.rVideoJS_cid = 1; + var ns = {type: 'video/mp4', src: this.basePath + this.rVideos[this.rVideoJS_cid].name }; + this.rVideoJS.src( ns ); + this.rVideoJS_playing = true; + } else { + if( this.rVideoJS_cid != fid ){ + this.rVideoJS_cid = fid; + var ns = {type: 'video/mp4', src: this.basePath + this.rVideos[this.rVideoJS_cid].name }; + this.rVideoJS.src( ns ); + }; + this.rVideoJS_playing = true; + }; + }; + }; + if( this.lVideos.length ){ + var fid = -1; + for(var i=this.lVideos.length-1; i > 0; i-- ){ + if( this.currentTime >= this.lVideos[i].sts && this.currentTime <= (this.lVideos[i].sts+60000) ){ + fid = i; + break; + }; + }; + if( fid < 0 ){ + //No Segments for Now; + //this.lVideoJS_playing = false; + this.lVideoJS_cid = 1; + var ns = {type: 'video/mp4', src: this.basePath + this.lVideos[this.lVideoJS_cid].name }; + this.lVideoJS.src( ns ); + this.lVideoJS_playing = true; + } else { + if( this.lVideoJS_cid != fid ){ + this.lVideoJS_cid = fid; + var ns = {type: 'video/mp4', src: this.basePath + this.lVideos[this.lVideoJS_cid].name }; + this.lVideoJS.src( ns ); + }; + this.lVideoJS_playing = true; + }; + //if( this.lVideoJS_playing ) this.lVideoJS.currentTime( ( this.currentTime - this.lVideos[this.lVideoJS_cid].sts ) / 1000 ); + }; + } + action( currentTime = 0 ){ if( !this.mPaused ){ + this.currentTime = currentTime; if( this.currentTime == 0 ) this.currentTime = this.startTime; //debugger; + this.currentTime = this.checkPlayebleTime( this.currentTime ); + var zz = document.getElementById('hpl_time_mon'); if( zz != undefined ){ zz.innerHTML = ts2dts( this.currentTime ); @@ -1431,7 +1789,7 @@ class argusSessionPlayer{ }; this.rVideoJS_playing = true; }; - if( this.rVideoJS_playing ) this.rVideoJS.currentTime( ( this.currentTime - this.rVideos[this.rVideoJS_cid].sts ) / 1000 ); + //if( this.rVideoJS_playing ) this.rVideoJS.currentTime( ( this.currentTime - this.rVideos[this.rVideoJS_cid].sts ) / 1000 ); }; if( this.lVideos.length ){ var fid = -1; @@ -1452,7 +1810,7 @@ class argusSessionPlayer{ }; this.lVideoJS_playing = true; }; - if( this.lVideoJS_playing ) this.lVideoJS.currentTime( ( this.currentTime - this.lVideos[this.lVideoJS_cid].sts ) / 1000 ); + //if( this.lVideoJS_playing ) this.lVideoJS.currentTime( ( this.currentTime - this.lVideos[this.lVideoJS_cid].sts ) / 1000 ); }; if( this.Events.length ){ var sid = -1; @@ -1501,7 +1859,7 @@ class argusSessionPlayer{ tt.setValue( ( this.currentTime - this.startTime ) / 1000, true ); tt.resumeEvents(); }; - this.currentTime += 250; + //this.currentTime += 250; if( this.currentTime > this.endTime ) if( this.mLooping ){ this.currentTime = 0; } else { @@ -1514,18 +1872,30 @@ class argusSessionPlayer{ var zz = Ext.getCmp( 'hpl_pl_btn' ); if( this.mPaused ){ this.mPaused = false; - if( this.rVideoJS_playing ) this.rVideoJS.play(); - if( this.lVideoJS_playing ) this.lVideoJS.play(); + if( this.rVideos.length ){ + if( !this.rVideoJS_playing ) this.rVideoJS.play(); + this.rVideoJS_playing = true; + }; + if( this.lVideos.length ){ + if( !this.lVideoJS_playing ) this.lVideoJS.play(); + this.lVideoJS_playing = true; + }; zz.setIconClass( 'plr_op_pause' ); zz.setText('Pause'); } else { this.mPaused = true; - if( this.rVideoJS_playing ) this.rVideoJS.pause(); - if( this.lVideoJS_playing ) this.lVideoJS.pause(); + if( this.rVideos.length ){ + if( this.rVideoJS_playing ) this.rVideoJS.pause(); + this.rVideoJS_playing = false; + }; + if( this.lVideos.length ){ + if( this.lVideoJS_playing ) this.lVideoJS.pause(); + this.lVideoJS_playing = false; + }; zz.setIconClass( 'plr_op_play' ); zz.setText('Play'); }; - this.action(); + this.action( this.currentTime ); //if( this.mTimer == null ) this.mTimer = window.setInterval( this.action.bind(this), 250 ); } pause(){ @@ -1540,9 +1910,15 @@ class argusSessionPlayer{ }; } setPosition( pos_time ){ - this.currentTime = this.startTime + pos_time*1000; + //this.currentTime = this.startTime + pos_time*1000; + var nt = this.startTime + pos_time*1000; var zz = document.getElementById('hpl_time_mon'); - zz.innerHTML = ts2dts( this.currentTime ); + zz.innerHTML = ts2dts( nt ); + + if( this.rVideoJS_playing ) + this.rVideoJS.currentTime( ( nt - this.rVideos[this.rVideoJS_cid].sts ) / 1000 ); + if( this.lVideoJS_playing ) + this.lVideoJS.currentTime( ( nt - this.lVideos[this.lVideoJS_cid].sts ) / 1000 ); } onLVideoEnd(){ } @@ -1881,10 +2257,11 @@ class _argusSessionPlayer{ } } +var SelectedSessionID = 0; function loadHistorySessionView( session_id ){ autoRiseEvent = false; - rep_selectedEventId = session_id; + SelectedSessionID = rep_selectedEventId = session_id; Ext.Ajax.request({ url: '/lib/controller/getHistorySessionView.php', params: { diff --git a/lib/php/argus/templates.php b/lib/php/argus/templates.php index 5687d71..dbcc9a1 100644 --- a/lib/php/argus/templates.php +++ b/lib/php/argus/templates.php @@ -381,6 +381,7 @@ $EMPTY_VIDEO_CTX=<<' + html:'' },{ xtype: 'spacer', height: 5 @@ -430,6 +431,10 @@ $SIMPLE_VIDEO_CTX=<<' + html: '
' }], listeners:{ afterrender: function( p ){ @@ -483,10 +488,13 @@ $EXT_VIDEO_CTX=<<Query( $QS ); }; + $QS = "SHOW TABLES LIKE 'session_composer_queue'" + $R = $DATABASE->Query( $QS ); + if( count( $R ) ){ + $QS = "ALTER TABLE `session_composer_queue` RENAME TO `media_composer_queue`"; + $UPGRADE = true; + $DATABASE->Query( $QS ); + }; + $QS = "SHOW TABLES LIKE 'media_composer_queue1'" + $R = $DATABASE->Query( $QS ); + if( count( $R ) == 0 ){ + $QS =<<Query( $QS ); + }; + $QS = "SHOW TABLES LIKE 'media_encoder_queue'" + $R = $DATABASE->Query( $QS ); + if( count( $R ) == 0 ){ + $QS = "ALTER TABLE `media_queue` RENAME TO `media_encoder_queue`"; + $UPGRADE = true; + $DATABASE->Query( $QS ); + }; if( $UPGRADE ){ echo "Upgrade Done!\n\n"; } else { diff --git a/style/assets/lside.png b/style/assets/lside.png new file mode 100644 index 0000000000000000000000000000000000000000..29abab32e04774514edbe2309c63c8268c4fbee9 GIT binary patch literal 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