Browse Source

Some working version (internal demo)

Evgeny Gagua 3 months ago
parent
commit
96aa15c153
  1. 6
      lib/controller/doSessionOperations.php
  2. 55
      lib/controller/getComposedVideo.php
  3. 106
      lib/controller/getComposerStatus.php
  4. 6
      lib/controller/getMonitoringPlatformView.php
  5. 8
      lib/controller/getMonitoringSessionView.php
  6. 8
      lib/controller/getMonitoringTrackView.php
  7. 72
      lib/controller/getSessionData.php
  8. 50
      lib/controller/getVideoSegment.php
  9. 4
      lib/controller/validateUserSession.php
  10. 3
      lib/javascript/jsapi_dynamic/argus_global_vars.js
  11. 32
      lib/javascript/jsapi_dynamic/argus_main.js
  12. 66
      lib/javascript/jsapi_dynamic/argus_monitoring.js
  13. 425
      lib/javascript/jsapi_dynamic/argus_reports.js
  14. 32
      lib/php/argus/templates.php
  15. 31
      lib/upgrade_database.php
  16. BIN
      style/assets/lside.png
  17. BIN
      style/assets/rside.png
  18. 38
      style/style.css

6
lib/controller/doSessionOperations.php

@ -92,6 +92,12 @@
}; };
break; 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 { } else {
$Data['msg']='Wrong Parameters!'; $Data['msg']='Wrong Parameters!';

55
lib/controller/getComposedVideo.php

@ -0,0 +1,55 @@
<?php
require_once('../ajax_asm.php');
require_once('../php/argus/server.php');
$UID = intval( $CUser->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.");
//};
};
};
};
};
?>

106
lib/controller/getComposerStatus.php

@ -0,0 +1,106 @@
<?php
require_once('../ajax_asm.php');
require_once('../php/argus/server.php');
ob_start();
$UID = intval( $CUser->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: /');
};
?>

6
lib/controller/getMonitoringPlatformView.php

@ -124,8 +124,10 @@
$CVTPL = str_ireplace( '%%%%TITLE%%%', $TTL, $CVTPL ); $CVTPL = str_ireplace( '%%%%TITLE%%%', $TTL, $CVTPL );
$CVTPL = str_ireplace( '%%%STATUS%CLASS%%', 'aaBB', $CVTPL ); $CVTPL = str_ireplace( '%%%STATUS%CLASS%%', 'aaBB', $CVTPL );
$CVTPL = str_ireplace( '%%%IMG%URL%%%', $URL, $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']; $MODU_IDS[] = $MM['id'];
}; };
} else { } else {

8
lib/controller/getMonitoringSessionView.php

@ -58,9 +58,13 @@
$LTitle = $MD['name']; $LTitle = $MD['name'];
$LVID = str_ireplace( '%%%SELURL%%%', $URL, $LVID ); $LVID = str_ireplace( '%%%SELURL%%%', $URL, $LVID );
$LVID = str_ireplace( '%%%HBTN%%%','&nbsp;', $LVID ); $LVID = str_ireplace( '%%%HBTN%%%','&nbsp;', $LVID );
$LVID = str_ireplace( '%%MIP%%', $MD['IP4'], $LVID );
$LVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $LVID );
} else { } else {
$LVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX ); $LVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX );
$LVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $LVID ); $LVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $LVID );
$LVID = str_ireplace( '%%MIP%%', $MD['IP4'], $LVID );
$LVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $LVID );
}; };
} else { } else {
$LVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX ); $LVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX );
@ -77,9 +81,13 @@
$RTitle = $MD['name']; $RTitle = $MD['name'];
$RVID = str_ireplace( '%%%SELURL%%%', $URL, $RVID ); $RVID = str_ireplace( '%%%SELURL%%%', $URL, $RVID );
$RVID = str_ireplace( '%%%HBTN%%%','&nbsp;', $RVID ); $RVID = str_ireplace( '%%%HBTN%%%','&nbsp;', $RVID );
$RVID = str_ireplace( '%%MIP%%', $MD['IP4'], $RVID );
$RVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $RVID );
} else { } else {
$RVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX ); $RVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX );
$RVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $RVID ); $RVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $RVID );
$RVID = str_ireplace( '%%MIP%%', $MD['IP4'], $RVID );
$RVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $RVID );
}; };
} else { } else {
$RVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX ); $RVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX );

8
lib/controller/getMonitoringTrackView.php

@ -66,9 +66,13 @@
$LTitle = $MD['name']; $LTitle = $MD['name'];
$LVID = str_ireplace( '%%%SELURL%%%', $URL, $LVID ); $LVID = str_ireplace( '%%%SELURL%%%', $URL, $LVID );
$LVID = str_ireplace( '%%%HBTN%%%','&nbsp;', $LVID ); $LVID = str_ireplace( '%%%HBTN%%%','&nbsp;', $LVID );
$LVID = str_ireplace( '%%MIP%%', $MD['IP4'], $LVID );
$LVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $LVID );
} else { } else {
$LVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX ); $LVID = str_ireplace( '%%MID%%', '0', $EMPTY_VIDEO_CTX );
$LVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $LVID ); $LVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $LVID );
$LVID = str_ireplace( '%%MIP%%', $MD['IP4'], $LVID );
$LVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $LVID );
$LMID = 0; $LMID = 0;
} }
} else { } else {
@ -86,9 +90,13 @@
$RTitle = $MD['name']; $RTitle = $MD['name'];
$RVID = str_ireplace( '%%%SELURL%%%', $URL, $RVID ); $RVID = str_ireplace( '%%%SELURL%%%', $URL, $RVID );
$RVID = str_ireplace( '%%%HBTN%%%','&nbsp;', $RVID ); $RVID = str_ireplace( '%%%HBTN%%%','&nbsp;', $RVID );
$RVID = str_ireplace( '%%MIP%%', $MD['IP4'], $RVID );
$RVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $RVID );
} else { } else {
$RVID = str_ireplace( '%%MID%%', '1', $EMPTY_VIDEO_CTX ); $RVID = str_ireplace( '%%MID%%', '1', $EMPTY_VIDEO_CTX );
$RVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $RVID ); $RVID = str_ireplace( '%%PLATFORM%ID%%', $CPID, $RVID );
$RVID = str_ireplace( '%%MIP%%', $MD['IP4'], $RVID );
$RVID = str_ireplace( '%%MCID%%', $MD['cam_id'], $RVID );
$RMID = 0; $RMID = 0;
}; };
} else { } else {

72
lib/controller/getSessionData.php

@ -28,6 +28,73 @@
$QS = "SELECT `layout` FROM `metro_platforms` WHERE `id`={$TRD['platform_id']}"; $QS = "SELECT `layout` FROM `metro_platforms` WHERE `id`={$TRD['platform_id']}";
$RR = $DATABASE->Query( $QS ); $RR = $DATABASE->Query( $QS );
$Data['layout'] = $RR[0]['layout']; $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'] )); $Data['basepath'] = '/lib/controller/data/reports/'.$Data['track_id'].'/'.date("Y/m/d",intval( $SD['ts'] ));
if( file_exists( $SYSPath . $Data['basepath'] )){ if( file_exists( $SYSPath . $Data['basepath'] )){
$Data['events']= array(); $Data['events']= array();
@ -50,17 +117,22 @@
//$CE['module_id']=intval( $CR['module_id'] ); //$CE['module_id']=intval( $CR['module_id'] );
$CE['az']=floatval( $CR['azimuth'] ); $CE['az']=floatval( $CR['azimuth'] );
$CE['r']=floatval( $CR['range'] );//cos( floatval( $CR['azimuth'] ) ) $CE['r']=floatval( $CR['range'] );//cos( floatval( $CR['azimuth'] ) )
if( $TRD['side'] == 'U' ){ if( $TRD['side'] == 'U' ){
if( $Data['r_module_id'] == intval( $CR['module_id'] ) ){ 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['x'] = 75.0+25.0 *(($CR['azimuth']>90 && $CR['azimuth'] < 210)?1.0:-1.0) * floatval( $CR['range'] ) / 70.0;
$CE['side']= 'R';
} else { } else {
$CE['x'] = 25.0+25.0 *(($CR['azimuth']>90 && $CR['azimuth'] < 210)?1.0:-1.0) * floatval( $CR['range'] ) / 70.0; $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 { } else {
if( $Data['r_module_id'] == intval( $CR['module_id'] ) ){ 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['x'] = 75.0+25.0 *(($CR['azimuth']>90 && $CR['azimuth'] < 210)?-1.0:1.0) * floatval( $CR['range'] ) / 70.0;
$CE['side']= 'R';
} else { } else {
$CE['x'] = 25.0+25.0 *(($CR['azimuth']>90 && $CR['azimuth'] < 210)?-1.0:1.0) * floatval( $CR['range'] ) / 70.0; $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; $Data['events'][] = $CE;

50
lib/controller/getVideoSegment.php

@ -0,0 +1,50 @@
<?php
require_once('../ajax_asm.php');
require_once('../php/argus/server.php');
$UID = intval( $CUser->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.");
};
};
};
};
};
?>

4
lib/controller/validateUserSession.php

@ -8,8 +8,8 @@
// If difference more then 2 minutes // If difference more then 2 minutes
if( abs( $MTS-$CTS ) > 120 ){ if( abs( $MTS-$CTS ) > 120 ){
//Push Kernel Command -> Sync Time //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 // Logout user to perform time sync
//echo "{'sessionIsValid': false }"; //echo "{'sessionIsValid': false }";
//exit(); //exit();

3
lib/javascript/jsapi_dynamic/argus_global_vars.js

@ -85,7 +85,8 @@ var tlLoadLocker = false;
var tlLastTS = 0; var tlLastTS = 0;
var tlInterval = null; var tlInterval = null;
var tlMonitoring = false; var tlMonitoring = false;
var tlMemCheckInterval = null;
const MemCheckMaxHS = 2147483648; //2Gb
<?php <?php
if( intval($CUser->Data['ss_timeout']) ){ if( intval($CUser->Data['ss_timeout']) ){
?> ?>

32
lib/javascript/jsapi_dynamic/argus_main.js

@ -157,6 +157,27 @@ function failureAJAXFunction( responce, opts ){
//doLogout(); //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 ){ function doUserOperation( OPId, Param, reload ){
Ext.Ajax.request({ Ext.Ajax.request({
url: '/lib/controller/updateUserSettings.php', url: '/lib/controller/updateUserSettings.php',
@ -189,7 +210,7 @@ function updateUserScreenResolution( x, y ){
failure: failureAJAXFunction failure: failureAJAXFunction
}); });
}; };
var contentChangesCount = 0;
//var contentChangesCount = 0;
function updateUserContent(){ function updateUserContent(){
var ser_c = Ext.encode( contentView ); var ser_c = Ext.encode( contentView );
if( contentViewConfig != ser_c ) { if( contentViewConfig != ser_c ) {
@ -203,8 +224,9 @@ function updateUserContent(){
}, },
success: function(){ success: function(){
contentViewConfig = ser_c; 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 failure: failureAJAXFunction
}); });
@ -399,10 +421,10 @@ Ext.onReady(function(){
if( 'wakeLock' in navigator ) tryKeepScreenAlive(10); if( 'wakeLock' in navigator ) tryKeepScreenAlive(10);
doCheckHeap();
doCheckWindowSize(); doCheckWindowSize();
if( <?=intval($CUser->Data['ss_mode']);?> == 1 ) ssShowSS(); if( <?=intval($CUser->Data['ss_mode']);?> == 1 ) ssShowSS();
gSessionValidatorInterval = window.setInterval( sessionValidator, 1000 );
gSessionValidatorInterval = window.setInterval( sessionValidator, 5000 );
NotificationStack = new PNotify.Stack({dir1: 'down', firstpos1: 25}); NotificationStack = new PNotify.Stack({dir1: 'down', firstpos1: 25});
//window.onresize = doCheckWindowSize; //window.onresize = doCheckWindowSize;
Ext.QuickTips.init(); Ext.QuickTips.init();

66
lib/javascript/jsapi_dynamic/argus_monitoring.js

@ -860,7 +860,7 @@ function fetchStatus(){
if( data.modules[i].status > 0 ){ if( data.modules[i].status > 0 ){
var tt = document.getElementById('plat_video_'+mon_selectedPlatform+'_'+data.modules[i].id ); var tt = document.getElementById('plat_video_'+mon_selectedPlatform+'_'+data.modules[i].id );
if( tt != undefined ){ 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 ); tt = document.getElementById('plat_status_'+mon_selectedPlatform+'_'+data.modules[i].id );
if( tt != undefined ){ if( tt != undefined ){
@ -1242,3 +1242,67 @@ function loadMonitoringSessionView( session_id ){
failure: failureAJAXFunction 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();
};
}

425
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; var EventPanelWindow = null;
function showEventPanel(){ function showEventPanel(){
if( EventPanelWindow == null ){ if( EventPanelWindow == null ){
@ -587,6 +613,224 @@ function showEventsOnMap( data, removeCursor = true ){
}; };
}; };
var sesVideosStartTS = 0;
function VideoButtonRenderer( value, metaData, record, rowIndex, colIndex, store ){
return '<a class="small_vd_btn" href="/lib/controller/getVideoSegment.php?SESSION='+rep_selectedEventId+'&VID='+record.data.id+'">Download</a>';
}
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;//'<img height="16px" src="/style/assets/lside.png">';
};
return sesVideosListRName;//'<img height="16px" src="/style/assets/rside.png">';
}
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: <?=$UserID;?>,
SID: '<?=$Session;?>'
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
if( data.status == 'ok' ){
CompositeVideoStatus = 1;
CompositeVideoProgress = 0;
CompositeVideoStatusUpdate();
} else {
Ext.Msg.show({
title:'<?=$Labels->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: '<div class="vid_dwc_panel"><table width="100%"><tr><td align="center" colspan=2>Compose Videos into one file</td></tr><tr><td colspan=2>&nbsp;</td></tr><tr><td align="center" colspan=2><a class="big_vd_btn" href="javascript:startVideoComposer()">Start Video Composer</a></td></tr><tr><td colspan=2>&nbsp;</td></tr></table></div>'
});
break;
};
case 1:{
rr.add({
border: false,
frame: false,
//layout: 'vbox',
//layoutConfig: {
// align: 'center'
//},
items:[{
html: '<center>Composing Video</center>'
},{
xtype: 'progress',
value: CompositeVideoProgress
}]
});
//CompositeVideoStatusTO = window.setTimeout( 1000, eventVideosStatusUpdater );
eventVideosStatusUpdater();
break;
};
case 2:{
if( sesVideosListRExists ){
rr.add({
xtype: 'panel',
frame: false,
border: false,
html: '<div class="vid_dwc_panel"><table width="100%"><tr><td align="center" colspan=2>Composed Video from '+sesVideosListRName+' side</td></tr><tr><td align="right">Resolution:</td><td>'+CompositeVideoRightInfo.pic_size+'</td></tr><tr><td align="right">Frame rate:</td><td>'+CompositeVideoRightInfo.fps+'</td></tr><tr><td align="right">Codec:</td><td>'+CompositeVideoRightInfo.codec+'</td></tr><tr><td align="right">Duration:</td><td>'+CompositeVideoRightInfo.duration+'</td></tr><tr><td align="right">File size:</td><td>'+CompositeVideoRightInfo.file_size+'</td></tr><tr><td align="center" colspan=2><a class="big_vd_btn" href="/lib/controller/getComposedVideo.php?SESSION='+rep_selectedEventId+'&SIDE=R">Download</a></td></tr></table></div>'
});
};
if( sesVideosListLExists ){
rr.add({
xtype: 'panel',
frame: false,
border: false,
html: '<div class="vid_dwc_panel"><table width="100%"><tr><td align="center" colspan=2>Composed Video from '+sesVideosListLName+' side</td></tr><tr><td align="right">Resolution:</td><td>'+CompositeVideoLeftInfo.pic_size+'</td></tr><tr><td align="right">Frame rate:</td><td>'+CompositeVideoLeftInfo.fps+'</td></tr><tr><td align="right">Codec:</td><td>'+CompositeVideoLeftInfo.codec+'</td></tr><tr><td align="right">Duration:</td><td>'+CompositeVideoLeftInfo.duration+'</td></tr><tr><td align="right">File size:</td><td>'+CompositeVideoLeftInfo.file_size+'</td></tr><tr><td align="center" colspan=2><a class="big_vd_btn" href="/lib/controller/getComposedVideo.php?SESSION='+rep_selectedEventId+'&SIDE=L">Download</a></td></tr></table></div>'
});
};
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: <?=$UserID;?>,
SID: '<?=$Session;?>'
},
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 ){ function LoadMapEventsZ( Mode ){
if( tlLoadLocker ) return; if( tlLoadLocker ) return;
tlLoadLocker = true; tlLoadLocker = true;
@ -746,6 +990,7 @@ function getData( Mode, ST = 0, ET = 0, SR = 0, DR = 0 ){
}; };
function loadArchive(){ function loadArchive(){
debugger;
if( tlInterval!= null ){ if( tlInterval!= null ){
window.clearInterval( tlInterval ); window.clearInterval( tlInterval );
tlInterval = null; tlInterval = null;
@ -1305,6 +1550,8 @@ class argusSessionPlayer{
this.lVideos = []; this.lVideos = [];
this.rVideos = []; this.rVideos = [];
this.Events = []; this.Events = [];
this.rEvents = [];
this.lEvents = [];
this.mSvgElements = []; this.mSvgElements = [];
if( autoplay != undefined ) this.mAutoPlay = autoplay; if( autoplay != undefined ) this.mAutoPlay = autoplay;
Ext.Ajax.request({ Ext.Ajax.request({
@ -1331,20 +1578,59 @@ class argusSessionPlayer{
mSesPlay.lVideos = []; mSesPlay.lVideos = [];
mSesPlay.nextRTimestamp = 0.0; mSesPlay.nextRTimestamp = 0.0;
mSesPlay.nextLTimestamp = 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'); var tt = Ext.getCmp('hpl_slider');
tt.setMinValue( 0 ); tt.setMinValue( 0 );
tt.setMaxValue( data.length / 1000 ); 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 ){ 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_id = 'video_player_'+data.r_module_id;
mSesPlay.rVideoJS = videojs( mSesPlay.rVideoJS_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("click", function(){ mSesPlay.play(); });
mSesPlay.rVideoJS.on("dblclick", function(){ fullScreen( mSesPlay.rVideoJS_id );}); mSesPlay.rVideoJS.on("dblclick", function(){ fullScreen( mSesPlay.rVideoJS_id );});
// New imp // New imp
@ -1359,12 +1645,20 @@ class argusSessionPlayer{
}); });
mSesPlay.rVideoJS.on('videotick', (e) => { 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_id = 'video_player_'+data.l_module_id;
mSesPlay.lVideoJS = videojs( mSesPlay.lVideoJS_id ); mSesPlay.lVideoJS = videojs( mSesPlay.lVideoJS_id );
@ -1382,10 +1676,18 @@ class argusSessionPlayer{
}); });
mSesPlay.lVideoJS.on('videotick', (e) => { 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 ); drawSessionDataOnSlider( mSesPlay.startTime/1000, mSesPlay.endTime/1000, data.events, data.videos );
mSesPlay.setPosition( 0 ); mSesPlay.setPosition( 0 );
@ -1403,10 +1705,66 @@ class argusSessionPlayer{
failure: failureAJAXFunction 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 ){ if( !this.mPaused ){
this.currentTime = currentTime;
if( this.currentTime == 0 ) this.currentTime = this.startTime; if( this.currentTime == 0 ) this.currentTime = this.startTime;
//debugger; //debugger;
this.currentTime = this.checkPlayebleTime( this.currentTime );
var zz = document.getElementById('hpl_time_mon'); var zz = document.getElementById('hpl_time_mon');
if( zz != undefined ){ if( zz != undefined ){
zz.innerHTML = ts2dts( this.currentTime ); zz.innerHTML = ts2dts( this.currentTime );
@ -1431,7 +1789,7 @@ class argusSessionPlayer{
}; };
this.rVideoJS_playing = true; 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 ){ if( this.lVideos.length ){
var fid = -1; var fid = -1;
@ -1452,7 +1810,7 @@ class argusSessionPlayer{
}; };
this.lVideoJS_playing = true; 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 ){ if( this.Events.length ){
var sid = -1; var sid = -1;
@ -1501,7 +1859,7 @@ class argusSessionPlayer{
tt.setValue( ( this.currentTime - this.startTime ) / 1000, true ); tt.setValue( ( this.currentTime - this.startTime ) / 1000, true );
tt.resumeEvents(); tt.resumeEvents();
}; };
this.currentTime += 250;
//this.currentTime += 250;
if( this.currentTime > this.endTime ) if( this.mLooping ){ if( this.currentTime > this.endTime ) if( this.mLooping ){
this.currentTime = 0; this.currentTime = 0;
} else { } else {
@ -1514,18 +1872,30 @@ class argusSessionPlayer{
var zz = Ext.getCmp( 'hpl_pl_btn' ); var zz = Ext.getCmp( 'hpl_pl_btn' );
if( this.mPaused ){ if( this.mPaused ){
this.mPaused = false; 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.setIconClass( 'plr_op_pause' );
zz.setText('Pause'); zz.setText('Pause');
} else { } else {
this.mPaused = true; 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.setIconClass( 'plr_op_play' );
zz.setText('Play'); zz.setText('Play');
}; };
this.action();
this.action( this.currentTime );
//if( this.mTimer == null ) this.mTimer = window.setInterval( this.action.bind(this), 250 ); //if( this.mTimer == null ) this.mTimer = window.setInterval( this.action.bind(this), 250 );
} }
pause(){ pause(){
@ -1540,9 +1910,15 @@ class argusSessionPlayer{
}; };
} }
setPosition( pos_time ){ 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'); 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(){ onLVideoEnd(){
} }
@ -1881,10 +2257,11 @@ class _argusSessionPlayer{
} }
} }
var SelectedSessionID = 0;
function loadHistorySessionView( session_id ){ function loadHistorySessionView( session_id ){
autoRiseEvent = false; autoRiseEvent = false;
rep_selectedEventId = session_id;
SelectedSessionID = rep_selectedEventId = session_id;
Ext.Ajax.request({ Ext.Ajax.request({
url: '/lib/controller/getHistorySessionView.php', url: '/lib/controller/getHistorySessionView.php',
params: { params: {

32
lib/php/argus/templates.php

@ -381,6 +381,7 @@ $EMPTY_VIDEO_CTX=<<<DATA_BOUNDARY
}], }],
listeners:{ listeners:{
afterrender: function( p ){ afterrender: function( p ){
alert('KAKA');
var zz = p.findParentByType('panel'); var zz = p.findParentByType('panel');
var xx = zz.getInnerWidth() * 450 / 1600; var xx = zz.getInnerWidth() * 450 / 1600;
var yy = xx * 1600 / 900; var yy = xx * 1600 / 900;
@ -417,7 +418,7 @@ $SIMPLE_VIDEO_CTX=<<<DATA_BOUNDARY
custom: '%%MID%%', custom: '%%MID%%',
bodyCssClass: 'mon_videoPanel', bodyCssClass: 'mon_videoPanel',
items:[{ items:[{
html:'<img id="plat_video_%%%PLATFORM%ID%%%_%%MID%%" width="123px" src="%%%IMG%URL%%%">'
html:'<video id="plat_video_%%%PLATFORM%ID%%%_%%MID%%" ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" autoplay playsinline muted width="100%" ></video><!--img id="plat_video_%%%PLATFORM%ID%%%_%%MID%%" width="123px" src="%%%IMG%URL%%%"-->'
},{ },{
xtype: 'spacer', xtype: 'spacer',
height: 5 height: 5
@ -430,6 +431,10 @@ $SIMPLE_VIDEO_CTX=<<<DATA_BOUNDARY
//loadModuleView( %%%PLATFORM%ID%%%, %%MID%% ); //loadModuleView( %%%PLATFORM%ID%%%, %%MID%% );
loadTrackView( %%TRACK%ID%% ); loadTrackView( %%TRACK%ID%% );
}); });
},
afterrender: function(){
//alert('A32');
startWhepClient( 'plat_video_%%%PLATFORM%ID%%%_%%MID%%', '%%MIP%%', 'stream_%%MCID%%' );
} }
} }
} }
@ -447,7 +452,7 @@ $EXT_VIDEO_CTX=<<<DATA_BOUNDARY
id: 'plat_video_%%MID%%', id: 'plat_video_%%MID%%',
border: true, border: true,
width: '100%', width: '100%',
html: '<div id="plat_video_div_%%MID%%" style="display: flex;align-items: center;" ><img id="plat_video_img_%%MID%%" ondblclick="fullScreen(\'plat_video_div_%%MID%%\');" style="cursor: zoom-in" src="%%%SELURL%%%" width="100%" /><div id="cam_ctrl_%%MID%%" style="display: none; float: left; position: absolute; left: 30px; bottom: 30px; z-index: 1000;"><table width="100%" border=0><tr><td width="24"><img id="img_btn_010_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/010.png"></td><td width="24"><img id="img_btn_032_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/032.png"></td><td width="24"><img id="img_btn_033_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/033.png"></td><td width="24"><img id="img_btn_034_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/034.png"></td><td>&nbsp;</td></tr><tr><td><img id="img_btn_011_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/011.png"></td><td><img id="img_btn_031_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/031.png"></td><td><img id="img_btn_020_%%MID%%" class="ptz_ctrl_btn" src="/style/png/basic/020.png"></td><td><img id="img_btn_027_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/027.png"></td><td>&nbsp;</td></tr><tr><td>%%%HBTN%%%</td><td><img id="img_btn_030_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/030.png"></td><td><img id="img_btn_029_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/029.png"></td><td><img id="img_btn_028_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/028.png"></td><td>&nbsp;</td></tr></table></div></div>'
html: '<div id="plat_video_div_%%MID%%" style="display: flex;align-items: center;" ><video id="plat_video_%%%PLATFORM%ID%%%_%%MID%%" ondblclick="fullScreen(\'plat_video_div_%%MID%%\');" style="cursor: zoom-in" autoplay playsinline muted width="100%" ></video><!--img id="plat_video_img_%%MID%%" ondblclick="fullScreen(\'plat_video_div_%%MID%%\');" style="cursor: zoom-in" src="%%%SELURL%%%" width="100%" /--><div id="cam_ctrl_%%MID%%" style="display: none; float: left; position: absolute; left: 30px; bottom: 30px; z-index: 1000;"><table width="100%" border=0><tr><td width="24"><img id="img_btn_010_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/010.png"></td><td width="24"><img id="img_btn_032_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/032.png"></td><td width="24"><img id="img_btn_033_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/033.png"></td><td width="24"><img id="img_btn_034_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/034.png"></td><td>&nbsp;</td></tr><tr><td><img id="img_btn_011_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/011.png"></td><td><img id="img_btn_031_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/031.png"></td><td><img id="img_btn_020_%%MID%%" class="ptz_ctrl_btn" src="/style/png/basic/020.png"></td><td><img id="img_btn_027_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/027.png"></td><td>&nbsp;</td></tr><tr><td>%%%HBTN%%%</td><td><img id="img_btn_030_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/030.png"></td><td><img id="img_btn_029_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/029.png"></td><td><img id="img_btn_028_%%MID%%" class="ptz_ctrl_btn" src="/style/png/player/028.png"></td><td>&nbsp;</td></tr></table></div></div>'
}], }],
listeners:{ listeners:{
afterrender: function( p ){ afterrender: function( p ){
@ -483,10 +488,13 @@ $EXT_VIDEO_CTX=<<<DATA_BOUNDARY
document.getElementById('img_btn_034_%%MID%%').addEventListener( 'mouseup', makePtzStop ); document.getElementById('img_btn_034_%%MID%%').addEventListener( 'mouseup', makePtzStop );
document.getElementById('img_btn_034_%%MID%%').addEventListener( 'mousedown', makePtzMove ); document.getElementById('img_btn_034_%%MID%%').addEventListener( 'mousedown', makePtzMove );
document.getElementById('img_btn_020_%%MID%%').addEventListener( 'mousedown', makePtzStop ); document.getElementById('img_btn_020_%%MID%%').addEventListener( 'mousedown', makePtzStop );
startWhepClient( 'plat_video_%%%PLATFORM%ID%%%_%%MID%%', '%%MIP%%', 'stream_%%MCID%%' );
} }
} }
} }
DATA_BOUNDARY; DATA_BOUNDARY;
//
$VIDEOJS_CTX=<<<DATA_BOUNDARY $VIDEOJS_CTX=<<<DATA_BOUNDARY
{ {
xtype: 'panel', xtype: 'panel',
@ -501,16 +509,24 @@ $VIDEOJS_CTX=<<<DATA_BOUNDARY
listeners:{ listeners:{
afterrender: function( p ){ afterrender: function( p ){
var zz = p.findParentByType('panel'); var zz = p.findParentByType('panel');
var xx = zz.getInnerWidth() * 450 / 1600;
var yy = xx * 1600 / 900;
var xx = parseInt( zz.getInnerWidth() * 450 / 1600 );
var yy = parseInt( xx * 1600 / 900 );
p.setWidth( yy ); p.setWidth( yy );
p.setHeight( xx );//+32
p.setHeight( xx );
var z = Ext.getCmp('j_video_%%MID%%'); var z = Ext.getCmp('j_video_%%MID%%');
z.setHeight( xx ); z.setHeight( xx );
z.setWidth( yy ); z.setWidth( yy );
var jv = document.getElementById('video_player_%%MID%%');
jv.setAttribute('height', ''+xx);
jv.setAttribute('width', ''+yy);
var jv = document.getElementById('video_player_%%MID%%');
if( jv != undefined ){
//jv.setAttribute('height', ''+xx+'px');
//jv.setAttribute('width', ''+yy+'px');
//jv.style.width = yy+"px";
//jv.style.height = xx+"px";
jv.setAttribute('height', "100%");
jv.setAttribute('width', "100%");
jv.style.width = "100%";
jv.style.height = "100%";
};
} }
} }
} }

31
lib/upgrade_database.php

@ -36,6 +36,37 @@
$UPGRADE = true; $UPGRADE = true;
$DATABASE->Query( $QS ); $DATABASE->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 =<<<DATA_BOUNDARY
CREATE TABLE `argus`.`media_composer_queue` (
`id` int UNSIGNED NOT NULL AUTO_INCREMENT,
`ts` int UNSIGNED NOT NULL,
`session_id` int UNSIGNED NOT NULL,
`uuid` char(64) NOT NULL,
`status` char(1) CHARACTER SET ascii COLLATE ascii_bin NULL DEFAULT 'N',
`progress` tinyint(3) UNSIGNED NULL DEFAULT 0,
PRIMARY KEY (`id`)
) ENGINE = MyISAM;
DATA_BOUNDARY;
$UPGRADE = true;
$DATABASE->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 ){ if( $UPGRADE ){
echo "Upgrade Done!\n\n"; echo "Upgrade Done!\n\n";
} else { } else {

BIN
style/assets/lside.png

Binary file not shown.

After

Width: 64  |  Height: 27  |  Size: 3.0 KiB

BIN
style/assets/rside.png

Binary file not shown.

After

Width: 64  |  Height: 27  |  Size: 3.0 KiB

38
style/style.css

@ -2304,4 +2304,42 @@ input[type="range"]:focus::-moz-range-thumb {
background-position: 8px 8px; background-position: 8px 8px;
background-size: 48px 48px; background-size: 48px 48px;
background-image: url("assets/adam-1.png")!important; background-image: url("assets/adam-1.png")!important;
}
.small_vd_btn{
cursor: pointer;
background-color: yellow;
text-decoration: none;
color: black;
border-radius: 5px;
padding: 5px;
height: 20px;
font-size: 10px;
font-weight: bold;
}
.small_vd_btn:hover{
text-decoration: none;
}
.big_vd_btn{
cursor: pointer;
background-color: orange;
text-decoration: none;
color: black;
border-radius: 10px;
padding-left: 15px;
padding-right: 15px;
height: 42px;
font-size: 20px;
}
.big_vd_btn:hover{
text-decoration: none;
background-color: yellow;
}
.vid_dwc_panel{
background: #f1f1f1;
color: black;
font-size: 12px;
font-weight: bold;
border-radius: 10px;
margin-bottom: 10px;
} }
Loading…
Cancel
Save