removed output-disable in dbms-output fetching procedure
[mediawiki.git] / js2 / mwEmbed / libEmbedVideo / kplayerEmbed.js
blobd61161bf6a950fd4ff8f5905c1362c80448b4db4
1 var kplayerEmbed = {
2         instanceOf:'kplayerEmbed',
3         supports: {
4                 'play_head':true,
5                 'pause':true,
6                 'stop':true,
7                 'time_display':true,
8                 'volume_control':true,
9                 'overlay':false,
10                 'fullscreen':false
11         },
12         getEmbedHTML : function () {
13                 var embed_code =  this.getEmbedObj();
14                 alert
15                 var _this = this;
16                 setTimeout(function(){
17                         _this.postEmbedJS();
18                 }, 50);
19                 js_log( "return embed html" );
20                 return this.wrapEmebedContainer( embed_code );
21         },
22         getEmbedObj:function() {        
23                 var player_path = mv_embed_path + 'libEmbedVideo/binPlayers/kaltura-player';
24                 return '<object width="' + this.width + '" height="' + this.height + '" '+ 
25                          'data="' + player_path + '/wrapper.swf" allowfullscreen="true" '+ 
26                          'allownetworking="all" allowscriptaccess="always" '+
27                          'type="application/x-shockwave-flash" '+ 
28                          'id="' + this.pid + '" name="' + this.pid + '">'+
29                                 '<param value="always" name="allowScriptAccess"/>'+
30                                 '<param value="all" name="allowNetworking"/>'+
31                                 '<param value="true" name="allowFullScreen"/>'+
32                                 '<param value="#000000" name="bgcolor"/>'+
33                                 '<param value="wrapper.swf" name="movie"/>'+
34                                 '<param value="' + 
35                                         'kdpUrl=' + player_path + '/kdp.swf' +
36                                         '&ks=dummy&partner_id=0&subp_id=0' +
37                                         '&uid=0&emptyF=onKdpEmpty&readyF=onKdpReady' +
38                                         '" ' + 
39                                         'name="flashVars"/>'+
40                           '<param value="opaque" name="wmode"/>'+
41                          '</object>';           
42         },
43         postEmbedJS:function() {
44                 var _this = this;
45                 this.getKDP();  
46                 //alert(        this.kdp );
47                 if( this.kdp && this.kdp.insertMedia){
48                         // Add KDP listeners
49                         
50                         //this.kdp.addJsListener("doPlay","kdpDoOnPlay");
51                         //this.kdp.addJsListener("doStop","kdpDoOnStop");
52                         //myKdp.addJsListener("fastForward","kdpDoOnFF");
53                                                 
54                         _this.bindKdpFunc( 'doPause', 'kdpPause' );
55                         _this.bindKdpFunc( 'doPlay', 'play' );
56                         _this.bindKdpFunc( 'playerPlayEnd', 'onClipDone' );
57                                                 
58                         // KDP player likes an absolute url for the src:
59                         var src = mw.absoluteUrl( _this.getSrc() );
60                         js_log('play src: ' + src);
61                         // Insert the src:      
62                         this.kdp.insertMedia("-1", src, 'true' );                       
63                         this.kdp.dispatchKdpEvent('doPlay');
64                         
65                         // Start the monitor
66                         this.monitor();
67                 }else{
68                         js_log('insert media: not defiend' + typeof this.kdp.insertMedia );
69                         setTimeout( function(){
70                                 _this.postEmbedJS();
71                         }, 25);
72                 }               
73         },      
74         /**
75         * bindKdpFunc
76         * 
77         * @param {String} flash binding name
78         * @param {String} function callback name
79         */
80         bindKdpFunc:function( bName, fName ){
81                 var cbid = fName + '_cb_' + this.id.replace(' ', '_');
82                 eval( 'window[ \'' + cbid +'\' ] = function(){$j(\'#' + this.id + '\').get(0).'+ fName +'();}' );
83                 this.kdp.addJsListener( bName , cbid);
84         },
85         kdpPause:function(){            
86                 this.parent_pause();
87         },
88         play:function() {
89                 if( this.kdp && this.kdp.dispatchKdpEvent )
90                         this.kdp.dispatchKdpEvent('doPlay');
91                 this.parent_play();
92         },
93         pause:function() {
94                 this.kdp.dispatchKdpEvent('doPause');
95                 this.parent_pause();
96         },
97         doSeek:function( prec ){
98                 var _this = this;
99                 if( this.kdp ){
100                         var seek_time = prec * this.getDuration(); 
101                         this.kdp.dispatchKdpEvent('doSeek',  seek_time);
102                         // Kdp is missing seek done callback
103                         setTimeout(function(){
104                                 _this.seeking= false;
105                         },500);
106                 }
107                 this.monitor();
108         },
109         updateVolumen:function( perc ) {
110                 if( this.kdp && this.kdp.dispatchKdpEvent )
111                         this.kdp.dispatchKdpEvent('volumeChange', perc);
112         },
113         monitor:function() {    
114                 if( this.kdp && this.kdp.getMediaSeekTime ){
115                         this.currentTime = this.kdp.getMediaSeekTime();
116                 }
117                 this.parent_monitor();
118         },
119         // get the embed fla object
120         getKDP: function () {
121                 this.kdp = document.getElementById( this.pid );
122         }
125 function kdpDoOnPause( player ){
126         var cat = player
127         debugger;
130 function onKdpReady( playerId ) {
131          js_log( "IN THEORY PLAYER IS READY:" + playerId);
132          /*
133          window.myKdp=get(playerId);
134          get("Player_State").innerHTML="<br>&nbsp; READY (Id=" + playerId + ")";
135          get("nowPlaying").innerHTML=(myKdp.evaluate('{entryId}'));
136          getDuration();
137          attachKdpEvents();
138          addKdpListners();
139          */