|
|
@ -1255,7 +1255,358 @@ function getSize( i ){ |
|
|
var k = 75.0 / max_grad_levels; |
|
|
var k = 75.0 / max_grad_levels; |
|
|
return 25+parseInt( k * i ); |
|
|
return 25+parseInt( k * i ); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
class argusSessionPlayer{ |
|
|
class argusSessionPlayer{ |
|
|
|
|
|
sessionId; |
|
|
|
|
|
mMapID; |
|
|
|
|
|
startTime; |
|
|
|
|
|
endTime; |
|
|
|
|
|
currentTime; |
|
|
|
|
|
rVideoJS = null; |
|
|
|
|
|
lVideoJS = null; |
|
|
|
|
|
rVideoJS_id = null; |
|
|
|
|
|
lVideoJS_id = null; |
|
|
|
|
|
rVideoJS_playing = false; |
|
|
|
|
|
lVideoJS_playing = false; |
|
|
|
|
|
rVideoJS_cid = -1; |
|
|
|
|
|
lVideoJS_cid = -1; |
|
|
|
|
|
mapLayout; |
|
|
|
|
|
lVideos; |
|
|
|
|
|
rVideos; |
|
|
|
|
|
Events; |
|
|
|
|
|
basePath; |
|
|
|
|
|
mTimer = null; |
|
|
|
|
|
mPaused = true; |
|
|
|
|
|
mLooping = true; |
|
|
|
|
|
mAutoPlay = false; |
|
|
|
|
|
nextRTimestamp = 0.0; |
|
|
|
|
|
nextLTimestamp = 0.0; |
|
|
|
|
|
mSvgElements;//076.png
|
|
|
|
|
|
|
|
|
|
|
|
checkLVideoTime(){ |
|
|
|
|
|
const t = mSesPlay.lVideoJS.currentTime(); // seconds
|
|
|
|
|
|
while( t >= mSesPlay.nextLTimestamp ){ |
|
|
|
|
|
mSesPlay.lVideoJS.trigger({ type: 'videotick', timestamp: mSesPlay.nextLTimestamp }); |
|
|
|
|
|
mSesPlay.nextLTimestamp += 0.1; // next 100 ms of video time
|
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
checkRVideoTime(){ |
|
|
|
|
|
const t = mSesPlay.rVideoJS.currentTime(); // seconds
|
|
|
|
|
|
while( t >= mSesPlay.nextRTimestamp ){ |
|
|
|
|
|
mSesPlay.rVideoJS.trigger({ type: 'videotick', timestamp: mSesPlay.nextRTimestamp }); |
|
|
|
|
|
mSesPlay.nextRTimestamp += 0.1; // next 100 ms of video time
|
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
constructor( session_id, autoplay ) { |
|
|
|
|
|
this.sessionId = session_id; |
|
|
|
|
|
this.currentTime = 0; |
|
|
|
|
|
this.startTime = 0; |
|
|
|
|
|
this.endTime = 0; |
|
|
|
|
|
this.lVideos = []; |
|
|
|
|
|
this.rVideos = []; |
|
|
|
|
|
this.Events = []; |
|
|
|
|
|
this.mSvgElements = []; |
|
|
|
|
|
if( autoplay != undefined ) this.mAutoPlay = autoplay; |
|
|
|
|
|
Ext.Ajax.request({ |
|
|
|
|
|
url: '/lib/controller/getSessionData.php', |
|
|
|
|
|
params: { |
|
|
|
|
|
SESSION: this.sessionId, |
|
|
|
|
|
UID: <?=$UserID;?>, |
|
|
|
|
|
SID: '<?=$Session;?>' |
|
|
|
|
|
}, |
|
|
|
|
|
success: function( response, opts ){ |
|
|
|
|
|
var data = Ext.decode( response.responseText ); |
|
|
|
|
|
//debugger;
|
|
|
|
|
|
if( data.status == 'ok' ){ |
|
|
|
|
|
mSesPlay.mapLayout = data.layout; |
|
|
|
|
|
//mSesPlay.rVideoJS = document.getElementById( 'video_obj_'+data.r_module_id );
|
|
|
|
|
|
//mSesPlay.lVideoJS = document.getElementById( 'video_obj_'+data.l_module_id );
|
|
|
|
|
|
mSesPlay.mMapID = document.getElementById( 'plat_map_'+data.track_id ); |
|
|
|
|
|
//debugger;
|
|
|
|
|
|
if( data.data_ok ){ |
|
|
|
|
|
mSesPlay.startTime = data.start_ts; |
|
|
|
|
|
mSesPlay.endTime = data.start_ts + data.length; |
|
|
|
|
|
mSesPlay.basePath = window.location.origin + data.basepath +'/'; |
|
|
|
|
|
mSesPlay.rVideos = []; |
|
|
|
|
|
mSesPlay.lVideos = []; |
|
|
|
|
|
mSesPlay.nextRTimestamp = 0.0; |
|
|
|
|
|
mSesPlay.nextLTimestamp = 0.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.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] ); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
if( mSesPlay.rVideos.length ) { //data.r_module_id ){
|
|
|
|
|
|
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
|
|
|
|
|
|
mSesPlay.rVideoJS.on('play', () => { |
|
|
|
|
|
mSesPlay.nextRTimestamp = Math.floor( mSesPlay.rVideoJS.currentTime() * 10) / 10 + 0.1; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
mSesPlay.rVideoJS.on( 'timeupdate', mSesPlay.checkRVideoTime ); |
|
|
|
|
|
|
|
|
|
|
|
mSesPlay.rVideoJS.on('seeking', () => { |
|
|
|
|
|
mSesPlay.nextRTimestamp = Math.floor( mSesPlay.rVideoJS.currentTime() * 10) / 10 + 0.1; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
mSesPlay.rVideoJS.on('videotick', (e) => { |
|
|
|
|
|
console.log("Video timestamp:", e.timestamp.toFixed(1)); |
|
|
|
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
//correct empty Video Placeholder
|
|
|
|
|
|
}; |
|
|
|
|
|
if( mSesPlay.lVideos.length ){ //data.l_module_id ){
|
|
|
|
|
|
mSesPlay.lVideoJS_id = 'video_player_'+data.l_module_id; |
|
|
|
|
|
mSesPlay.lVideoJS = videojs( mSesPlay.lVideoJS_id ); |
|
|
|
|
|
|
|
|
|
|
|
mSesPlay.lVideoJS.on("click", function(){ mSesPlay.play(); }); |
|
|
|
|
|
mSesPlay.lVideoJS.on("dblclick", function(){ fullScreen( mSesPlay.lVideoJS_id );}); |
|
|
|
|
|
// New imp
|
|
|
|
|
|
mSesPlay.lVideoJS.on('play', () => { |
|
|
|
|
|
mSesPlay.nextLTimestamp = Math.floor( mSesPlay.lVideoJS.currentTime() * 10) / 10 + 0.1; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
mSesPlay.lVideoJS.on( 'timeupdate', mSesPlay.checkLVideoTime ); |
|
|
|
|
|
|
|
|
|
|
|
mSesPlay.lVideoJS.on('seeking', () => { |
|
|
|
|
|
mSesPlay.nextLTimestamp = Math.floor( mSesPlay.lVideoJS.currentTime() * 10) / 10 + 0.1; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
mSesPlay.lVideoJS.on('videotick', (e) => { |
|
|
|
|
|
console.log("Video timestamp:", e.timestamp.toFixed(1)); |
|
|
|
|
|
}); |
|
|
|
|
|
} else { |
|
|
|
|
|
//correct empty Video Placeholder
|
|
|
|
|
|
}; |
|
|
|
|
|
drawSessionDataOnSlider( mSesPlay.startTime/1000, mSesPlay.endTime/1000, data.events, data.videos ); |
|
|
|
|
|
mSesPlay.setPosition( 0 ); |
|
|
|
|
|
if( mSesPlay.mAutoPlay ) mSesPlay.play(); |
|
|
|
|
|
} else { |
|
|
|
|
|
Ext.Msg.show({ |
|
|
|
|
|
title:'<?=$Labels->GetLabel('_SESSION_DATA_');?>', |
|
|
|
|
|
msg: '<?=$Labels->GetLabel('_SESS_DATA_NOTF_');?>', |
|
|
|
|
|
buttons: Ext.Msg.OK, |
|
|
|
|
|
icon: Ext.MessageBox.ERROR |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
|
|
|
}, |
|
|
|
|
|
failure: failureAJAXFunction |
|
|
|
|
|
}); |
|
|
|
|
|
} |
|
|
|
|
|
action(){ |
|
|
|
|
|
if( !this.mPaused ){ |
|
|
|
|
|
if( this.currentTime == 0 ) this.currentTime = this.startTime; |
|
|
|
|
|
//debugger;
|
|
|
|
|
|
var zz = document.getElementById('hpl_time_mon'); |
|
|
|
|
|
if( zz != undefined ){ |
|
|
|
|
|
zz.innerHTML = ts2dts( this.currentTime ); |
|
|
|
|
|
}; |
|
|
|
|
|
//Check videos
|
|
|
|
|
|
if( this.rVideos.length ){ |
|
|
|
|
|
var fid = -1; |
|
|
|
|
|
for(var i=0; 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; |
|
|
|
|
|
} 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.rVideoJS_playing ) this.rVideoJS.currentTime( ( this.currentTime - this.rVideos[this.rVideoJS_cid].sts ) / 1000 ); |
|
|
|
|
|
}; |
|
|
|
|
|
if( this.lVideos.length ){ |
|
|
|
|
|
var fid = -1; |
|
|
|
|
|
for(var i=0; i<this.lVideos.length; 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; |
|
|
|
|
|
} 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 ); |
|
|
|
|
|
}; |
|
|
|
|
|
if( this.Events.length ){ |
|
|
|
|
|
var sid = -1; |
|
|
|
|
|
for( var i= this.Events.length-1; i > -1; i--) if( this.Events[i].ts < this.currentTime ) { |
|
|
|
|
|
sid = i; |
|
|
|
|
|
break; |
|
|
|
|
|
}; |
|
|
|
|
|
if( sid > -1 ){ |
|
|
|
|
|
for( var i=0; i< max_grad_levels; i++ ){ |
|
|
|
|
|
var cid = sid-i; |
|
|
|
|
|
var csize = getSize( i ); |
|
|
|
|
|
//debugger;
|
|
|
|
|
|
if( typeof this.mSvgElements[i] === 'undefined') { |
|
|
|
|
|
if( cid > -1 ){ |
|
|
|
|
|
var svgns = "http://www.w3.org/2000/svg"; |
|
|
|
|
|
this.mSvgElements[i] = document.createElementNS(svgns, 'rect'); |
|
|
|
|
|
this.mSvgElements[i].setAttribute('x', this.Events[cid].x+'%'); |
|
|
|
|
|
this.mSvgElements[i].setAttribute('y', ''+(50+(100-csize)/2) ); |
|
|
|
|
|
this.mSvgElements[i].setAttribute('height', ''+csize); |
|
|
|
|
|
this.mSvgElements[i].setAttribute('width', ''+csize); |
|
|
|
|
|
this.mSvgElements[i].setAttribute('fill', '#FF0000'+getTransperecy(i)); |
|
|
|
|
|
var tt = document.getElementById('svgTrackMap'); |
|
|
|
|
|
var zz = document.getElementById('scheme_anch'); |
|
|
|
|
|
tt.insertBefore( this.mSvgElements[i], zz ); |
|
|
|
|
|
//document.getElementById('svgTrackMap').appendChild(this.mSvgElements[i]);
|
|
|
|
|
|
}; |
|
|
|
|
|
} else { |
|
|
|
|
|
if( cid > -1 ){ |
|
|
|
|
|
this.mSvgElements[i].setAttribute('x', this.Events[cid].x+'%'); |
|
|
|
|
|
this.mSvgElements[i].setAttribute('y', ''+(50+(100-csize)/2) ); |
|
|
|
|
|
this.mSvgElements[i].setAttribute('height', ''+csize); |
|
|
|
|
|
this.mSvgElements[i].setAttribute('width', ''+csize); |
|
|
|
|
|
this.mSvgElements[i].setAttribute('fill', '#FF0000'+getTransperecy(i) ); |
|
|
|
|
|
} else { |
|
|
|
|
|
this.mSvgElements[i].setAttribute('fill', '#FF000000'); |
|
|
|
|
|
}; |
|
|
|
|
|
}; |
|
|
|
|
|
}; |
|
|
|
|
|
} else |
|
|
|
|
|
for( var i=0; i< max_grad_levels; i++ ) |
|
|
|
|
|
if( typeof this.mSvgElements[i] !== 'undefined') this.mSvgElements[i].setAttribute('fill', '#FF000000'); |
|
|
|
|
|
}; |
|
|
|
|
|
var tt = Ext.getCmp('hpl_slider'); |
|
|
|
|
|
if( tt!= undefined ){ |
|
|
|
|
|
tt.suspendEvents(); |
|
|
|
|
|
tt.setValue( ( this.currentTime - this.startTime ) / 1000, true ); |
|
|
|
|
|
tt.resumeEvents(); |
|
|
|
|
|
}; |
|
|
|
|
|
this.currentTime += 250; |
|
|
|
|
|
if( this.currentTime > this.endTime ) if( this.mLooping ){ |
|
|
|
|
|
this.currentTime = 0; |
|
|
|
|
|
} else { |
|
|
|
|
|
//Stop
|
|
|
|
|
|
this.play(); |
|
|
|
|
|
}; |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
play(){ |
|
|
|
|
|
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(); |
|
|
|
|
|
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(); |
|
|
|
|
|
zz.setIconClass( 'plr_op_play' ); |
|
|
|
|
|
zz.setText('Play'); |
|
|
|
|
|
}; |
|
|
|
|
|
this.action(); |
|
|
|
|
|
//if( this.mTimer == null ) this.mTimer = window.setInterval( this.action.bind(this), 250 );
|
|
|
|
|
|
} |
|
|
|
|
|
pause(){ |
|
|
|
|
|
this.mPaused = true; |
|
|
|
|
|
} |
|
|
|
|
|
toggleLoop(){ |
|
|
|
|
|
this.mLooping = !this.mLooping; |
|
|
|
|
|
if( this.mLooping ) if( this.currentTime > this.endTime ){ |
|
|
|
|
|
this.currentTime = 0; |
|
|
|
|
|
// Start
|
|
|
|
|
|
this.play(); |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
setPosition( pos_time ){ |
|
|
|
|
|
this.currentTime = this.startTime + pos_time*1000; |
|
|
|
|
|
var zz = document.getElementById('hpl_time_mon'); |
|
|
|
|
|
zz.innerHTML = ts2dts( this.currentTime ); |
|
|
|
|
|
} |
|
|
|
|
|
onLVideoEnd(){ |
|
|
|
|
|
} |
|
|
|
|
|
onRVideoEnd(){ |
|
|
|
|
|
} |
|
|
|
|
|
dispose(){ |
|
|
|
|
|
if( this.mTimer != null ) clearInterval( this.mTimer ); |
|
|
|
|
|
this.mTimer = null; |
|
|
|
|
|
if( this.rVideoJS!= null ){ |
|
|
|
|
|
this.rVideoJS.dispose(); |
|
|
|
|
|
this.rVideoJS = null; |
|
|
|
|
|
}; |
|
|
|
|
|
if( this.lVideoJS!= null ){ |
|
|
|
|
|
this.lVideoJS.dispose(); |
|
|
|
|
|
this.lVideoJS = null; |
|
|
|
|
|
}; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// canvas aproach ///////////////////////////////////////////
|
|
|
|
|
|
/* |
|
|
|
|
|
const player = videojs('my-video'); |
|
|
|
|
|
|
|
|
|
|
|
let nextTimestamp = 0; |
|
|
|
|
|
let rafId = null; |
|
|
|
|
|
|
|
|
|
|
|
function tick() { |
|
|
|
|
|
if (player.paused() || player.ended()) |
|
|
|
|
|
return; |
|
|
|
|
|
|
|
|
|
|
|
const t = player.currentTime(); |
|
|
|
|
|
|
|
|
|
|
|
while (t >= nextTimestamp) { |
|
|
|
|
|
player.trigger({ |
|
|
|
|
|
type: 'videotick', |
|
|
|
|
|
timestamp: nextTimestamp |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
nextTimestamp += 0.1; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
rafId = requestAnimationFrame(tick); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
player.on('play', () => { |
|
|
|
|
|
nextTimestamp = Math.floor(player.currentTime() * 10) / 10 + 0.1; |
|
|
|
|
|
cancelAnimationFrame(rafId); |
|
|
|
|
|
rafId = requestAnimationFrame(tick); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
player.on('pause', () => cancelAnimationFrame(rafId)); |
|
|
|
|
|
player.on('ended', () => cancelAnimationFrame(rafId)); |
|
|
|
|
|
|
|
|
|
|
|
player.on('seeking', () => { |
|
|
|
|
|
nextTimestamp = Math.floor(player.currentTime() * 10) / 10 + 0.1; |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
player.on('videotick', (e) => { |
|
|
|
|
|
console.log(e.timestamp); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
*/ |
|
|
|
|
|
|
|
|
|
|
|
class _argusSessionPlayer{ |
|
|
sessionId; |
|
|
sessionId; |
|
|
mMapID; |
|
|
mMapID; |
|
|
startTime; |
|
|
startTime; |
|
|
@ -1554,8 +1905,7 @@ function loadHistorySessionView( session_id ){ |
|
|
Ext.getCmp('main_content').doLayout(); |
|
|
Ext.getCmp('main_content').doLayout(); |
|
|
changeContent( 2, 5, rep_selectedStation+'-'+rep_selectedDateTS+'-'+rep_selectedEventId ); |
|
|
changeContent( 2, 5, rep_selectedStation+'-'+rep_selectedDateTS+'-'+rep_selectedEventId ); |
|
|
updateUserContent(); |
|
|
updateUserContent(); |
|
|
mSesPlay = new argusSessionPlayer( rep_selectedEventId ); |
|
|
|
|
|
mSesPlay.play(); |
|
|
|
|
|
|
|
|
mSesPlay = new argusSessionPlayer( rep_selectedEventId , true ); |
|
|
fetchStatus(); |
|
|
fetchStatus(); |
|
|
}; |
|
|
}; |
|
|
}, |
|
|
}, |
|
|
|