Hello ,
I am writing a plugin which will catch players events and then i will calculate different parameter(s). But i seen that i am not getting all the events in plugin. Following is the snap shot of the code:
on HTML page:
<script rc="http://cdnapi.kaltura.com/p/XXXXX/sp/YYYYYY00/embedIframeJs/uiconf_id/41082561/partner_id/YYYYY"></script>
-------------------------------------------------------------
main.js
kWidget.embed({
'targetId': TARGET_ID,
'wid': PARTNER_ID,
'uiconf_id': UICONF_ID,
'autoPlay': true,
'flashvars': {
'disableHLSOnJs': true,
'Dash.plugin': true,
'UseAppleAdaptive': false,
"myPlugin": {
'requiresJQuery': true,
"position" : "before",
"plugin": true, // plugins should be enabled with plugin=true attribute
"iframeHTML5Js": "/Kaltura_client/js/myPlugin.js", // Kaltrua Plugin component in javascript.
"configuration": "share_some_configuration",
"playerID": "kaltura_player"
},
"IframeCustomPluginJs1": "/Kaltura_client/lib/dependentLib.js", // library in javascript.
},
"cache_st": 1511762926,
});
myPlugin.js
mw.kalturaPluginWrapper(function() {
//Global variables
...
...
var events = [ 'alert', 'bufferchange', 'bufferprogress', 'bytesdownloadedchange',
'bytestotalchange', 'cancelalerts', 'changevolume', 'closefullscreen',
'dointelligentseek', 'dopause', 'doplay', 'doplayentry',
'doseek', 'dostop', 'doswitch', 'durationchange',
'enablealerts', 'enablegui', 'endentrysession', 'endpostsession',
'endpresession', 'entryfailed', 'entryready', 'fastforward',
'freepreviewend', 'hasclosefullscreen', 'hasopenedfullscreen', 'kdpempty',
'kdpready', 'layoutready', 'loadmedia', 'mediaerror',
'medialoaderror', 'medialoading', 'mediaready', 'mediaunloaded',
'mediaviewablechange', 'openfullscreen', 'playercontainerready', 'playerdimensionchange',
'playerdownloadcomplete', 'playerpaused', 'playerplayed', 'playerplayend',
'playerready', 'playerseekend', 'playerseekstart', 'playerstatechange',
'playerupdateplayhead', 'post1start', 'pre1start', 'rootresize',
'scrubberdragend', 'scrubberdragstart', 'showuielement', 'skinloaded',
'skinloadfailed', 'sourceready', 'stopfastforward', 'switchingchange',
'volumechanged', 'firstplay', 'bufferchange', 'bufferendevent',
'bytestotalchange', 'medialoaded', 'mediaready', 'mute',
'onchangemedia', 'onchangemediadone', 'openfullscreen', 'playerpaused',
'playerplayed', 'playerplayend', 'switchingchangestarted', 'unmute',
'userinitiatedseek', 'playerupdateplayhead', 'bufferstartevent', 'bytesdownloadedchange',
'changemedia', 'cleanmedia', 'closefullscreen', 'cuepointreached',
'initiatapp', 'layoutbuilddone', 'mediaerror',
'metadatareceived', 'playerdownloadcomplete','playerplayed', 'playerready',
'playerseekend', 'playerseekstart', 'playerstatechange', 'preseek',
'scrubberdragend', 'scrubberdragstart', 'seek', 'seeked',
'startup', 'switchingchangecomplete','userinitiatedpause', 'userinitiatedplay'];
mw.PluginManager.add('empkalturaPlugin', mw.KBaseScreen.extend({
defaultConfig: {
.
.
},
isSafeEnviornment: function() {
return mw.supportsHTML5();
},
setup: function() {
this.addBindings();
},
addBindings: function() {
for (var i = 0; i < events.length; i++) {
//console.log(events[i]);
this.bind(events[i] + ".test", function(data) {
switch (data.type) {
case 'playerSeekStart':
case 'playerSeekEnd':
case 'playerPlayEnd':
case 'bufferStartEvent':
case 'onChangeMediaDone':
case 'bufferEndEvent':
case 'userInitiatedPause':
case 'userInitiatedPlay':
case 'userInitiatedSeek':
case 'seeked':
case 'doStop':
case 'preSeek':
// Setup event handlers for the video playback view states
handleViewStates(data.type);
break;
case 'firstPlay':
openSession();
break;
case 'mediaLoaded':
console.log("ON_Event ==>" + data.type); // + "currentBitrate"+ data.currentTarget.currentBitrate);
handleMetrics(data.currentTarget);
break;
default:
console.log("default ON_Event ==>" + data.type);
break;
}
});
}
},