Browse Source

MJPEG Stage 2

master
Evgeny Gagua 3 years ago
parent
commit
456919e8ac
  1. 2
      lib/controller/getHistoryEvents.php
  2. 7
      lib/controller/report/node_13.js
  3. 20
      lib/javascript/clipchamp/player.js
  4. 22
      lib/javascript/jsapi_dynamic/mojo_reports.js

2
lib/controller/getHistoryEvents.php

@ -18,7 +18,7 @@
foreach( $LREC as $REC ){
$CR['id'] = intval( $REC['id'] );
$CR['node_id'] = intval( $REC['node_id'] );
$CR['node_name'] = $NodeNames[$CR['node_id']];
$CR['node_name'] = 'koko';//$NodeNames[$CR['node_id']];
$CR['ts'] = intval( $REC['ts'] );
$CR['ms'] = intval( $REC['ts_ms'] );
$CR['dts'] = date( "H:i:s.{$CR['ms']}", $CR['ts'] );

7
lib/controller/report/node_13.js

@ -28,7 +28,8 @@
id: 'db_node_%%%NODEID%%%_pic',
border: true,
width: '100%',
html: '<video id="video-%%%NODEID%%%" class="video-js" controls preload="auto" poster="/style/assets/no-signal.png" width="100%" data-setup="{}"></video>'
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',
@ -68,6 +69,7 @@
var xx = p.getWidth() * %%%HEIGHT%%% / %%%WIDTH%%%;
p.setHeight( xx + 32 );
VideoLinks[%%%NODEID%%%] = '';
/*
$('#video-%%%NODEID%%%').on('timeupdate', function(){
if( cEventETS > 0 ){
if( this.currentTime > cEventETS ) {
@ -80,10 +82,13 @@
player.fluid(true);
//player.fill(true);
*/
},
beforedestroy: function(){
var oldPlayer = document.getElementById( 'video-%%%NODEID%%%' );
/*
videojs( oldPlayer ).dispose();
*/
}
}
}

20
lib/javascript/clipchamp/player.js

@ -13,7 +13,7 @@
* Released under the MIT license
*/
(function($) {
var DEFAULT_FPS = 24,
var DEFAULT_FPS = 15,
DEFAULT_AUTOLOOP = true,
JPEG_MAGIG_NUMBER = [0xff, 0xd8, 0xff];
@ -56,11 +56,13 @@
imageElement.setAttribute('style', 'width:100%;');
wrapperElement.appendChild(imageElement);
//Show SLADKIY_BUBALEKH
splitMJPEG(mjpegUrl, function(jpegFiles) {
//Hide SLADKIY_BUBALEKH -> or error!
alert( jpegFiles.length );
if (jpegFiles.length > 0) {
var nextFrameIndex = 0;
function showNextFrame() {
if (imageElement) {
if (jpegUrl) {
@ -80,7 +82,7 @@
}
};
imageElement.setAttribute('src', jpegUrl);
}
};
};
setTimeout(function() {
@ -96,6 +98,16 @@
wrapperElement.removeChild(imageElement);
imageElement = undefined;
}
},
pause: function(){
},
play: function( fromBegin ){
},
stop: function(){
pause();
},
alertInfo: function(){
alert( jpegFiles.length );
}
};
};

22
lib/javascript/jsapi_dynamic/mojo_reports.js

@ -650,17 +650,31 @@ function loadEventData( record ){
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;
$( video_t ).clipchamp_mjpeg_player( VideoLinks[data.node_id] , fps, autoloop,
function( wrapperElement, playerInterface ) {
//playerInterface.finish();
$( wrapperElement ).dblclick(function(){
//playerInterface.finish();
fullScreen( wrapperElement.id );
});
});
break;
};
};
};
var CT = cEventTSS - ( data.uts+data.uts_ms/1000 );
VideoPlayer.currentTime( CT );
VideoPlayer.play();
};
};
}
});

Loading…
Cancel
Save