Browse Source

MER Final Version before French Language is Added

master
Evgeny Gagua 3 years ago
parent
commit
0d54858217
  1. 38
      lib/controller/downloadVideo.php
  2. 24
      lib/controller/getFrames.php
  3. 3
      lib/controller/getHistoryEvents.php
  4. 25
      lib/controller/getReportLayout.php
  5. 21
      lib/controller/getVideoInfo.php
  6. 92
      lib/controller/report/node_13.js
  7. 273
      lib/javascript/jsapi_dynamic/mojo_reports.js
  8. 6
      style/style.css

38
lib/controller/downloadVideo.php

@ -9,23 +9,33 @@
fclose( $FD );
};
};
if( isset( $_POST['FLOC'] ) ){
//'/lib/controller/' = 16 chars
$SRC = substr( $_POST['FLOC'], 16 );
$FPS = intval( $_POST['FFPS'] );
if( isset( $_POST['FTS'] ) ){
ob_implicit_flush(true);
ignore_user_abort(true);
while( ob_get_level() ) ob_end_clean();
$DTS = intval( $_POST['FTS'] );
$MD5 = $_POST['FMD'];
$SRC = 'data/reports/' . date("Y/m/d", $DTS ) . '/'. $MD5. '.mjpeg';
$FPS = intval( $_POST['FPS'] );
if( file_exists( $SRC ) ){
$DST = '../tmp/' . md5_file( $SRC ) . '.mp4';
//$DST = '../tmp/' . md5_file( $SRC ) . '.mp4';
$DST = '../tmp/' . $MD5 . '.mp4';
//echo $SRC . "->" . $DST . "\n\n"; exit();
$COM = "ffmpeg -hide_banner -loglevel error -y -r {$FPS} -i {$SRC} -pix_fmt yuvj420p -b:v 4000k -c:v libx264 {$DST} 2>&1";
$JUJA = `$COM`;
//$COM = "ffmpeg -hide_banner -loglevel error -y -r {$FPS} -i {$SRC} -pix_fmt yuvj420p -b:v 4000k -c:v libx264 {$DST} 2>&1";
$COM = "ffmpeg -hide_banner -loglevel error -y -r {$FPS} -i {$SRC} -vcodec copy {$DST} 2>&1";
$JUJA = `rm -f ../tmp/*`;
$JUJA = `$COM`;
if( file_exists( $DST ) ){
output_dummy( $DST );
unlink( $DST );
} else output_dummy( '../../style/assets/nosignal.mp4' );
} else output_dummy( '../../style/assets/nosignal.mp4' );
} else output_dummy( '../../style/assets/nosignal.mp4' );
//header( 'location: /lib/tmp/' . $MD5 . '.mp4' );
echo '/lib/tmp/' . $MD5 . '.mp4';
//output_dummy( $DST );
//unlink( $DST );
} else //output_dummy( '../../style/assets/nosignal.mp4' );
echo '/style/assets/nosignal.mp4';
} else //output_dummy( '../../style/assets/nosignal.mp4' );
echo '/style/assets/nosignal.mp4';
} else // output_dummy( '../../style/assets/nosignal.mp4' );
echo '/style/assets/nosignal.mp4';
//-crf 20 -r 9 -b:v 3500 -filter:v "setpts=2.0 * PTS" ^M

24
lib/controller/getFrames.php

@ -1,8 +1,11 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$VID = intval( $_POST['VID'] );
$DTS = intval( $_POST['TS'] );
if( 1 ){//$CUser->Data['id'] > 1 ){
$VID = intval( $_GET['VID'] );
$DTS = intval( $_GET['TS'] );
$DTSM = intval( $_GET['TSM'] );
$START_FRAME = 0;
if( isset( $_GET['sf'] ) ) $START_FRAME = intval( $_GET['sf'] );
if( $VID && $DTS ){
$DS = date("Y/m/d", $DTS );
$QS = "SELECT * FROM `videos` WHERE `id` = {$VID}";
@ -10,10 +13,15 @@
$LREC = $ZIZI->Query( $QS );
if( count( $LREC ) ){
$Data = $LREC[0];
$FILE = "/srv/www/web/lib/controller/data/reports/{$DS}/{$Data['md5']}.{$Data['ext']}";
$FPS = intval( $Data['fps'] );
if( $FPS < 1 ) $FPS = 15;
if( $START_FRAME == 0 ){
$AETS = floatval( $DTS ) + floatval( $DTSM ) / 1000.0;
$AVTS = floatval( $Data['uts'] ) + floatval( $Data['uts_ms'] ) / 1000.0;
$START_FRAME = intval( ( $AETS - $AVTS )/ ( 1.0/ $FPS ) );
};
ob_implicit_flush(true);
//ignore_user_abort(true);
while( ob_get_level() ) ob_end_clean();
@ -24,9 +32,7 @@
header("Connection: close");
header("Content-Transfer-Encoding: BINARY");
header("Content-type: multipart/x-mixed-replace;boundary=MPFrame");
$START_FRAME = 0;
if( isset( $_GET['sf'] ) ) $START_FRAME = intval( $_GET['sf'] );
//$FILE = '/srv/www/web/lib/controller/data/reports/2024/02/14/d156c150ca14ac484f28ef4ad70666b2.mjpeg';
$FID = fopen( $FILE, "r");
@ -73,9 +79,9 @@
};
//file_put_contents('/srv/samba/Mojo_Web/lib/controller/test.txt',"KOKOMO");
exit();
};
};
};
} else echo " No Recoe";
} else echo " No Param";
} else echo " No ACC";
function readPixel($url, $x, $y, $callback)
{

3
lib/controller/getHistoryEvents.php

@ -32,7 +32,8 @@
$CR['el'] = sprintf( "%0.2f", floatval( $REC['elevation'] ));
$CR['r'] = intval( $REC['range_digital'] );
$CR['width'] = intval( $REC['area'] );
$CR['video_id'] = intval( $REC['video_id'] );
//$CR['video_id'] = intval( $REC['video_id'] );
$CR['video'] = intval( $REC['video_id'] ) > 0;
if( $REC['lat'] != 0 && $REC['lon'] != 0 ){
$CR['geo'] = true;
if( $SP['local_binding'] != 0 ){

25
lib/controller/getReportLayout.php

@ -57,6 +57,14 @@
}
_DATA_BOUNDARY;
$DUMMY['camera']="{xtype:'panel', id:'pan_ph_ccc_%%ID%%', title: 'Camera Placeholder', frame: true, border: true, draggable: false, layouit: 'fit', items:{$TABA}}";
$DUMMY['sensor']="{xtype:'panel', title: 'Sensor Placeholder', frame: true, border: true, draggable: false, html:'NO SENSOR', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 66+W );}}}";
} else {
$DUMMY['camera']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
$DUMMY['sensor']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
$DUMMY['map']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
$DUMMY['log']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
};
$LOGIO=<<<_DATA_BOUNDARY
{
xtype: 'grid',
@ -95,6 +103,7 @@ $LOGIO=<<<_DATA_BOUNDARY
}
}
_DATA_BOUNDARY;
$MAPIO=<<<_DATA_BOUNDARY
{
id: 'report_map',
@ -116,16 +125,10 @@ $MAPIO=<<<_DATA_BOUNDARY
}
}
_DATA_BOUNDARY;
$DUMMY['camera']="{xtype:'panel', id:'pan_ph_ccc_%%ID%%', title: 'Camera Placeholder', frame: true, border: true, draggable: false, layouit: 'fit', items:{$TABA}}";
$DUMMY['sensor']="{xtype:'panel', title: 'Sensor Placeholder', frame: true, border: true, draggable: false, html:'NO SENSOR', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 66+W );}}}";
$DUMMY['map']="{xtype:'panel', title: 'Map Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO MAP'}";
$DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Report Log', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
} else {
$DUMMY['camera']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
$DUMMY['sensor']="{xtype:'panel', title: false, frame: true, draggable: false, html: '&nbsp;', listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}}}";
$DUMMY['map']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
$DUMMY['log']="{xtype:'panel', title: false, frame: true, draggable: false, height: 200, html: '&nbsp;'}";
};
//$DUMMY['map']="{xtype:'panel', title: 'Map Placeholder', frame: true, height: 200, border: true, draggable: false, html:'NO MAP'}";
$DUMMY['map']="{xtype:'panel', title: '{$Labels->GetLabel('_MAP_')}', frame: true, border: true, draggable: false, collapsible: false, tools: [{ id:'toggle', handler: function( a, b, p ){ fullScreen( 'report_map' ); }}], items:[{$MAPIO}],listeners:{ afterrender: function(p){ var W=p.getWidth(); p.setHeight( 32+(W/16)*9);}} }";
$DUMMY['log']="{xtype:'panel', id: 'lg_panel', title: 'Report Log', frame: true, border: true, draggable: false, items:[{$LOGIO}] }";
$STA = array();
$END="]}";
$OUT = array();
@ -221,7 +224,7 @@ _DATA_BOUNDARY;
$STA[3]="{ columnWidth: .55, stylse:'padding:10px 0 10px 10px', items:[";
};
$OUT[]= $STA[0] . $MAPIO . $END;
$OUT[]= $STA[0] . $DUMMY['map'] . $END;
$QS = "SELECT * FROM `nodes` WHERE `type`>9 AND `type`< 14 AND `enable`=1";
$R = $DATABASE->Query( $QS );
$idx = 0;

21
lib/controller/getVideoInfo.php

@ -1,23 +1,24 @@
<?php
require_once('../ajax_asm.php');
if( $CUser->Data['id'] > 1 ){
$VID = intval( $_POST['VID'] );
$EID = intval( $_POST['ID'] );
$DTS = intval( $_POST['TS'] );
if( $VID ){
if( $EID ){
$DS = date("Y/m/d", $DTS );
$QS = "SELECT * FROM `videos` WHERE `id` = {$VID}";
//$QS = "SELECT * FROM `videos` WHERE `id` = {$VID}";
$QS = "SELECT `videos`.`id`, `videos`.`fps`,`videos`.`md5`, `videos`.`media_stream_id`, `events_2_videos`.`frame` FROM `events_2_videos` LEFT JOIN `videos` ON( `videos`.`id` = `events_2_videos`.`video_id` ) WHERE `events_2_videos`.`evt_id`={$EID}";
$ZIZI = new SQLite_DB( '/srv/www/web/lib/controller/data/reports/'.$DS.'/report.db');
$LREC = $ZIZI->Query( $QS );
if( count( $LREC ) ){
$Data = $LREC[0];
$Data['base'] = $DS;
$QS = "SELECT `no`.`id` as `node_id` FROM `nodes` `no` LEFT JOIN `cameras` `ca` ON ( `no`.`aux_id` = `ca`.`id` ) WHERE ( `no`.`type` = 10 OR `no`.`type` = 11 OR `no`.`type` = 12 OR `no`.`type` = 13 )AND `ca`.`stream_id`={$Data['media_stream_id']} LIMIT 1";
$TT = $DATABASE->Query( $QS );
$Data['qs'] = $QS;
$Data['node_id'] = intval( $TT[0]['node_id'] );
echo json_encode( $Data );
$Pack = array();
$Pack['ts'] = $DTS;
$Pack['videos'] = array();
foreach( $LREC as $Data ) $Pack['videos'][] = $Data;
echo json_encode( $Pack );
exit();
};
echo "[]";
exit();
};
};
header('location: /');

92
lib/controller/report/node_13.js

@ -12,46 +12,12 @@
bodyStyle: 'padding: 0px;',
title: '%%%NODENAME%%%',
sukaMineWidth: -1,
/*
{
id: 'db_node_%%%NODEID%%%_pic',
border: true,
width: '100%',
//html: '<div id="img-%%%NODEID%%%" style="display: flex;align-items: center;" ><img id="img-img-%%%NODEID%%%" ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" src="%%%SELURL%%%" width="100%" /><div style="float: left; position: absolute; left: 30px; bottom: 50px; z-index: 1000;"><table width="100%" border=0><tr><td width="24"><img id="img_btn_010_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/010.png"></td><td width="24"><img id="img_btn_032_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/032.png"></td><td width="24"><img id="img_btn_033_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/033.png"></td><td width="24"><img id="img_btn_034_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/034.png"></td><td>&nbsp;</td></tr><tr><td><img id="img_btn_011_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/011.png"></td><td><img id="img_btn_031_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/031.png"></td><td><img id="img_btn_020_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/basic/020.png"></td><td><img id="img_btn_027_%%%NODEID%%%" 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_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/030.png"></td><td><img id="img_btn_029_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/029.png"></td><td><img id="img_btn_028_%%%NODEID%%%" class="ptz_ctrl_btn" src="/style/png/player/028.png"></td><td>&nbsp;</td></tr></table></div></div>'
//html: '<div id="img-%%%NODEID%%%" style="display: flex;align-items: center;" ><img id="img-img-%%%NODEID%%%" ondblclick="fullScreen(\'img-%%%NODEID%%%\');" style="cursor: zoom-in" src="/style/assets/no-signal.png" width="100%" /></div>'
//html: '<video id="video-%%%NODEID%%%" class="video-js" controls preload="auto" width="640" height="264" data-setup="{}"><source src="/lib/controller/data/videos/e4e18614af6059501d88ca39e76db15b.mp4" type="video/mp4"></video>'
html:''
},
*/
items:[{
id: 'db_node_%%%NODEID%%%_pic',
border: true,
width: '100%',
html: '<div id="video-%%%NODEID%%%" width="100%" ></video>'
//html: '<video id="video-%%%NODEID%%%" class="video-js" controls preload="auto" poster="/style/assets/no-signal.png" width="100%" data-setup="{}"></video>'
}/*{
xtype: 'button',
id: 'db_download_video',
scale: 'large',
enableToggle: true,
disabled: true,
text: 'Download Video File',
width: '100%',
handler: function(){
if( DownloadVideoLink!= '' ){
var link = document.createElement("a");
// If you don't know the name or want to use
// the webserver default set name = ''
//link.setAttribute('download', name );
link.setAttribute('download', '' );
link.href = DownloadVideoLink;
document.body.appendChild(link);
link.click();
link.remove();
}
}
}*/],
html: '<div id="video-%%%STREAMID%%%" style="display: flex;align-items: center;" ><img id="video-img-%%%STREAMID%%%" ondblclick="fullScreen(\'video-%%%STREAMID%%%\');" style="cursor: zoom-in" src="/style/assets/no-signal.png" width="100%" /><div id="video-ctl-%%%STREAMID%%%" style="float: left; position: absolute; left: 30px; bottom: 30px; z-index: 1000;"></div></div>'
}],
listeners:{
resize: function( p, adjWidth, adjHeight, rawWidth, rawHeight ){
if( rawWidth!= undefined ){
@ -59,8 +25,7 @@
p.sukaMineWidth = adjWidth;
var XX = p.sukaMineWidth * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( XX + 32 );
//var z = Ext.getCmp('db_download_video');
var z = document.getElementById( 'video-%%%NODEID%%%' );
var z = document.getElementById( 'video-%%%STREAMID%%%' );
z.height = XX;
};
};
@ -68,24 +33,45 @@
afterrender: function( p ){
var xx = p.getWidth() * ( %%%HEIGHT%%% / %%%WIDTH%%% );
p.setHeight( xx + 32 );
VideoLinks[%%%NODEID%%%] = '';
/*
$('#video-%%%NODEID%%%').on('timeupdate', function(){
if( cEventETS > 0 ){
if( this.currentTime > cEventETS ) {
cEventETS = 0;
this.pause();
};
};//console.log('the time was updated to: ' + this.currentTime);
videoElements[videoElements.length] = %%%STREAMID%%%;
var xx = new Ext.Panel({
id: 'video-ctl-panel-%%%STREAMID%%%',
renderTo: 'video-ctl-%%%STREAMID%%%',
border: false,
hidden: true,
frame: false,
width: 400,
height: 42,
layout: 'hbox',
items:[{
xtype: 'button',
width: 32,
iconCls: 'download',
scale: 'medium',
id: 'video-btn-download-%%%STREAMID%%%',
handler: function(){
downloadCurrentVideo( %%%STREAMID%%% );
}
},{
xtype: 'spacer',
width: 20
},{
xtype: 'slider',
width: 250,
id: 'video-slider-%%%STREAMID%%%',
value: 0,
minValue: 0,
maxValue: 100,
listeners:{
change: function( t, b, o ){
setVideoSource( %%%STREAMID%%%, b );
}
}
}]
});
var player = videojs( 'video-%%%NODEID%%%' );
player.fluid(true);
//player.fill(true);
*/
},
beforedestroy: function(){
var oldPlayer = document.getElementById( 'video-%%%NODEID%%%' );
var oldPlayer = document.getElementById( 'video-%%%STREAMID%%%' );
/*
videojs( oldPlayer ).dispose();
*/

273
lib/javascript/jsapi_dynamic/mojo_reports.js

@ -31,7 +31,8 @@ var rep_store = new Ext.data.JsonStore({
{name: 'el', type: 'string'},
{name: 'r', type: 'int'},
{name: 'width', type: 'int'},
{name: 'video_id',type: 'int'},
//{name: 'video_id',type: 'int'},
{name: 'video',type: 'bool'},
{name: 'lat', type: 'float'},
{name: 'lon', type: 'float'}
//{name: 'alt', type: 'float'},
@ -659,43 +660,17 @@ function loadEventProperties( EventRec ){
tPanel.doLayout();
};
var VideoLinks = [];
var VideoPlayer = null;
var cEventTSS = 0;
var cEventETS = 0;
function stop_mjpeg( a ){
if( VideoPlayer != null ){
var tt = document.getElementById( a );
if( tt != undefined ){
//tt.removeAttribute( 'onclick' );
tt.classList.remove('stop_button');
tt.classList.add('play_button');
tt.setAttribute( 'onclick', "cont_mjpeg('"+a+"');" );
};
VideoPlayer.pause();
};
};
function cont_mjpeg( a ){
if( VideoPlayer != null ){
var tt = document.getElementById( a );
if( tt != undefined ){
tt.classList.remove('play_button');
tt.classList.add('stop_button');
tt.setAttribute( 'onclick', "stop_mjpeg('"+a+"');" );
};
VideoPlayer.play();
};
};
function setpos_mjpeg( v ){
if( VideoPlayer != null ){
VideoPlayer.play( v );
};
};
function setpos_s_mjpeg( v ){
if( VideoPlayer != null ){
VideoPlayer.play( v );
var VSRCC ='';
function setVideoSource( mid, frame ){
var video_t = document.getElementById( 'video-img-' + mid );
if( video_t != undefined ){
video_t.src = "/video_view/stream?id="+videoNfo[mid][1]+"&TS="+videoNfo[mid][0]+"&sf=" + frame;
};
};
function loadEventData( record ){
ReportSelectionMode = 3; // Just One Event
cEventTSS = record.ts+record.ms/1000;
@ -703,89 +678,46 @@ function loadEventData( record ){
if( record.type == 13 || record.type == 14 || record.type == 36 ){
markEventOnRadar( record.node_id, record.az, record.r );
};
if( record.video_id > 0 ){
showVideo();
if( record.video ){
showVideos();
Ext.Ajax.request({
url: '/lib/controller/getVideoInfo.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
TS: record.ts,
VID: record.video_id
TS: record.ts,
ID: record.id
},
success: function( response, opts ){
var data = Ext.decode(response.responseText);
var t = Ext.getCmp('db_download_video');
if( t != undefined ){
t.toggle( true, true );
t.enable();
}
var video_t = document.getElementById( 'video-'+data.node_id );
if( video_t != undefined ){
if( cRowSelected+1 < rep_array.length ) {
var ddd = rep_array[cRowSelected+1];
cEventETS = ( ddd.ts + ddd.ms/1000 ) - ( data.uts+data.uts_ms/1000 );
} else {
cEventETS = 0;
};
var tVL = '/lib/controller/data/reports/'+data.base+'/'+data.md5+'.'+data.ext;
if( tVL != VideoLinks[data.node_id] ){
VideoLinks[data.node_id] = tVL;
//alert( tVL );
switch( data.ext ){
case 'mp4':{
ctype = 'video/mp4';
VideoPlayer = videojs( video_t );
VideoPlayer.src({
type: ctype,
fps: data.fps,
src: VideoLinks[data.node_id]
});
VideoPlayer.poster('/style/assets/no-signal.png');
var CT = cEventTSS - ( data.uts+data.uts_ms/1000 );
VideoPlayer.currentTime( CT );
VideoPlayer.play();
break;
};
case 'mjpeg':{
ctype = 'video/x-motion-jpeg';
//var mjpegUrl = "http://127.0.0.1/web/Images/Stream/somevideo.mjpeg";
var fps = data.fps;
var autoloop = true;
setVideoDownloadButton( tVL, data.fps, ( data.uts+data.uts_ms/1000 ) );
$( video_t ).clipchamp_mjpeg_player( VideoLinks[data.node_id] , fps, autoloop,
function( wrapperElement, playerInterface ) {
//playerInterface.finish();
VideoPlayer = playerInterface;
$( wrapperElement ).dblclick(function(){
//playerInterface.finish();
fullScreen( wrapperElement.id );
});
});
break;
if( data.videos != undefined ){
if( data.videos.length ){
for( i=0; i < data.videos.length; i++ ){
//var video_t = document.getElementById( 'video-'+data.videos[i].media_stream_id );
videoNfo[data.videos[i].media_stream_id] = [];
videoNfo[data.videos[i].media_stream_id][0] = data.ts;
videoNfo[data.videos[i].media_stream_id][1] = data.videos[i].md5;
videoNfo[data.videos[i].media_stream_id][2] = data.videos[i].fps;
data.videos[i].frame -= 20;
if( data.videos[i].frame < 0 ) data.videos[i].frame = 0;
setVideoSource( data.videos[i].media_stream_id, data.videos[i].frame );
var slider_t = Ext.getCmp( 'video-slider-'+data.videos[i].media_stream_id );
if( slider_t != undefined ){
slider_t.setMaxValue( 60 * data.videos[i].fps );
slider_t.suspendEvents();
slider_t.setValue( data.videos[i].frame );
slider_t.resumeEvents();
};
};
};
};
};
}
});
} else {
var t = Ext.getCmp('db_download_video');
if( t != undefined ){
alert("ZagZag");
t.toggle( false, true );
t.disable();
}
//var video_t = document.getElementById( 'video-'+record.node_id );
if( VideoPlayer != null ){
//VideoPlayer.dispose();
//VideoPlayer = null;
VideoPlayer.pause();
//VideoPlayer.poster('/style/assets/no-signal.png');
//VideoPlayer.posterImage.show();
};
hideVideos();
};
};
@ -1417,6 +1349,7 @@ function loadReportSegment( ts, bid, eid ){
function loadReportData( ts, bid, eid ){
ReportSelectionMode = 2; // Session Selected
hideVideos();
Ext.Ajax.request({
url: '/lib/controller/getHistoryEvents.php',
params: {
@ -1426,8 +1359,7 @@ function loadReportData( ts, bid, eid ){
BID: bid,
EID: eid,
},
success: function(response, opts ){
hideVideo();
success: function(response, opts ){
var data = Ext.decode( response.responseText );
if( data.log != undefined ){
if( map != undefined ) if( map != null ) showHistoryOnMap( data, true );
@ -1442,9 +1374,9 @@ function loadReportData( ts, bid, eid ){
};
} else {
alert('No Log');
// alert('No Log');
// clear the log
//log_store.removeAll();
rep_store.removeAll();
};
}
});
@ -1526,23 +1458,32 @@ function loadReportDayTree( ts ){
};
var videoElements = [];
var videoNfo=[];
function hideVideo(){
if( videoElements.length ){
for( i = 0; i++; i < videoElements.length ){
var juja = document.getElementById( 'video-'+videoElements[i] );
if( juja != undefined ) juja.style.display = "none";
};
function hideVideos(){
if( videoElements.length ) for( i = 0; i < videoElements.length; i++ ) hideVideo( videoElements[i] );
};
function hideVideo( a ){
var tt = Ext.getCmp( 'video-ctl-panel-' + a );
if( tt != undefined ) tt.hide();
var video_t = document.getElementById( 'video-img-' + a );
if( video_t != undefined ){
video_t.src = "/style/assets/no-signal.png";
};
};
function showVideo( a ){
var tt = Ext.getCmp( 'video-ctl-panel-' + a );
if( tt != undefined ) tt.show();
};
function showVideos(){
if( videoElements.length ) for( i = 0; i < videoElements.length; i++ ) showVideo( videoElements[i] );
};
function showVideo(){
if( videoElements.length ){
for( i = 0; i++; i < videoElements.length ){
var juja = document.getElementById( 'video-'+videoElements[i] );
if( juja != undefined ) juja.style.display = "block";
};
};
function downloadCurrentVideo( stid ){
var d = new Date( videoNfo[stid][0] * 1000 );
var videoFileDownloadTarget = d.getFullYear()+'_'+(d.getMonth()+1)+'_'+d.getDate()+'_'+d.getHours()+'-'+d.getMinutes()+'-'+d.getSeconds()+'.mp4';
// TS, MD5, FPS
downloadVideoFile( videoNfo[stid][0], videoNfo[stid][1], videoNfo[stid][2], videoFileDownloadTarget );
};
function initReportsView(){
@ -1591,6 +1532,9 @@ function initReportsView(){
});
activityMap.render();
ReportMask.hide();
},
error: function(){
ReportMask.hide();
}
});
}
@ -1609,60 +1553,41 @@ function initReportsView(){
sPanel.doLayout();
};
var videoFileDownloadTarget = '';
var videoFileURI = '';
var videoFileFPS = 15;
function setVideoDownloadButton( URI, fps, ts ){
var d = new Date( ts*1000 );
videoFileDownloadTarget = d.getFullYear()+'_'+(d.getMonth()+1)+'_'+d.getDate()+'_'+d.getHours()+'-'+d.getMinutes()+'-'+d.getSeconds()+'.mp4';
videoFileURI = URI;
videoFileFPS = fps;
};
//downloadVideoFile( videoFileURI, videoFileFPS, videoFileDownloadTarget );
function downloadVideoFile( z, b, c ){
//Ext.getCmp('main_content').getEl()
ReportMask = new Ext.LoadMask(Ext.getBody(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."});
function downloadVideoFile( a, b, c, d ){
ReportMask = new Ext.LoadMask( Ext.getBody(), {msg:"<?=$Labels->GetLabel('_Please_Wait_');?>..."} );
ReportMask.show();
const formData = new FormData();
formData.append("UID",<?=$UserID;?>);
formData.append("SID",'<?=$Session;?>');
formData.append("FLOC", z );
formData.append("FFPS", b );
fetch('/lib/controller/downloadVideo.php',{
//headers: {
// 'Accept': 'video/mp4',
// 'Content-Type': 'multipart/form-data',
// 'KAKA': 'JUJA'
//},
method: "POST",
body: formData
})
.then(resp => resp.blob())
.then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
// the filename you want
a.download = c;//'video.mp4';
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
ReportMask.hide();
Ext.Msg.show({
title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
msg: '<?=$Labels->GetLabel('_VIDEO_FILE_HAS_DOWNLOADED_');?>',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
})
.catch(() => {
ReportMask.hide();
Ext.Msg.show({
title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
Ext.Ajax.request({
url: '/lib/controller/downloadVideo.php',
params: {
UID: <?=$UserID;?>,
SID: '<?=$Session;?>',
FTS: a,
FMD: b,
FPS: c
},
success: function(response, opts ){
const a = document.createElement('a');
a.style.display = 'none';
a.href = response.responseText;
a.download = d;
document.body.appendChild(a);
a.click();
ReportMask.hide();
Ext.Msg.show({
title:'<?=$Labels->GetLabel('_SUCCESS_');?>',
msg: '<?=$Labels->GetLabel('_VIDEO_FILE_HAS_DOWNLOADED_');?>',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.INFO
});
},
error: function(){
ReportMask.hide();
Ext.Msg.show({
title:'<?=$Labels->GetLabel('_REQ_FAILURE_');?>',
msg: '<?=$Labels->GetLabel('_AJX_REQFAILURE_');?>',
buttons: Ext.Msg.OK,
icon: Ext.MessageBox.ERROR
});
}
});
};

6
style/style.css

@ -1020,6 +1020,12 @@ A.CalendarDS:hover {
.cog {
background-image: url(wicons/025.png) !important;
}
.download {
background-image: url(wicons/019.png) !important;
background-repeat: no-repeat;
background-position: 0px 0px;
background-size: 24px 24px;
}
.snd0{
background-image: url(wicons/034.png) !important;
}

Loading…
Cancel
Save