Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js |
— | — | @@ -1991,7 +1991,7 @@ |
1992 | 1992 | * Abstract method to be run post embedding the player Generally should be |
1993 | 1993 | * overwritten by the plug-in / player |
1994 | 1994 | */ |
1995 | | - postEmbedJS:function() { |
| 1995 | + postEmbedActions:function() { |
1996 | 1996 | return ; |
1997 | 1997 | }, |
1998 | 1998 | |
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayerVlc.js |
— | — | @@ -2,8 +2,6 @@ |
3 | 3 | * VLC embed based on: http://people.videolan.org/~damienf/plugin-0.8.6.html |
4 | 4 | * javascript api: http://www.videolan.org/doc/play-howto/en/ch04.html |
5 | 5 | * assume version > 0.8.5.1 |
6 | | -* |
7 | | -* mark for deletion |
8 | 6 | */ |
9 | 7 | ( function( mw, $ ) { |
10 | 8 | |
— | — | @@ -53,36 +51,22 @@ |
54 | 52 | '<embed pluginspage="http://www.videolan.org" type="application/x-vlc-plugin" ' + |
55 | 53 | 'progid="VideoLAN.VLCPlugin.2" name="' + this.pid + '" ' + |
56 | 54 | 'height="' + this.getHeight() + '" width="' + this.getWidth() + '" ' + |
57 | | - // set the style too 'just to be sure' |
| 55 | + // Set the style for IE layout issues ) |
58 | 56 | 'style="width:' + this.getWidth() + 'px;height:' + this.getHeight() + 'px;" ' + |
59 | 57 | '>' + |
60 | 58 | '</object>' |
61 | 59 | ) |
62 | | - /* |
63 | | - $( this ).html( |
64 | | - '<embed type="application/x-vlc-plugin" pluginspage="http://www.videolan.org" version="VideoLAN.VLCPlugin.2" '+ |
65 | | - 'width="' + this.width +'" ' + |
66 | | - 'height="' + this.height + '" ' + |
67 | | - 'id="' + this.pid + '"> ' + |
68 | | - '</embed>' |
69 | | - );*/ |
70 | | - |
71 | | - |
72 | | - // give VLC 150ms to initialize before we start playback |
73 | | - // @@todo should be able to do this as an ready event |
74 | | - this.waitForVlcCount = 0; |
75 | | - setTimeout( function() { |
76 | | - _this.postEmbedJS(); |
77 | | - }, 150 ); |
| 60 | + // Call postEmbedActions directly ( postEmbedJs will wait for player ready ) |
| 61 | + _this.postEmbedActions(); |
78 | 62 | }, |
79 | 63 | |
80 | 64 | /** |
81 | 65 | * Javascript to run post vlc embedding |
82 | 66 | * Inserts the requested src to the embed instance |
83 | 67 | */ |
84 | | - postEmbedJS: function() { |
| 68 | + postEmbedActions: function() { |
85 | 69 | var _this = this; |
86 | | - // load a pointer to the vlc into the object (this.playerElement) |
| 70 | + // Load a pointer to the vlc into the object (this.playerElement) |
87 | 71 | this.getPlayerElement(); |
88 | 72 | if ( this.playerElement && this.playerElement.playlist) { |
89 | 73 | // manipulate the dom object to make sure vlc has the correct size: |
— | — | @@ -93,27 +77,26 @@ |
94 | 78 | // VLC likes absolute urls: |
95 | 79 | var src = mw.absoluteUrl( this.getSrc() ) ; |
96 | 80 | |
97 | | - // @@todo if client supports seeking no need to send seek_offset to URI |
98 | | - mw.log( 'vlc play::' + src ); |
| 81 | + mw.log( "EmbedPlayerVlc:: postEmbedActions play src:" + src ); |
99 | 82 | var itemId = this.playerElement.playlist.add( src ); |
100 | 83 | if ( itemId != -1 ) { |
101 | 84 | // Play |
102 | 85 | this.playerElement.playlist.playItem( itemId ); |
103 | 86 | } else { |
104 | | - mw.log( "error:cannot play at the moment !" ); |
| 87 | + mw.log( "Error:: EmbedPlayerVlc can not play" ); |
105 | 88 | } |
106 | 89 | setTimeout( function() { |
107 | 90 | _this.monitor(); |
108 | 91 | }, 100 ); |
109 | 92 | } else { |
110 | | - mw.log( 'postEmbedJS: vlc not ready' ); |
| 93 | + mw.log( 'EmbedPlayerVlc:: postEmbedActions: vlc not ready' ); |
111 | 94 | this.waitForVlcCount++; |
112 | 95 | if ( this.waitForVlcCount < 10 ) { |
113 | 96 | setTimeout( function() { |
114 | | - _this.postEmbedJS(); |
| 97 | + _this.postEmbedActions(); |
115 | 98 | }, 100 ); |
116 | 99 | } else { |
117 | | - mw.log( 'vlc never ready' ); |
| 100 | + mw.log( 'EmbedPlayerVlc:: vlc never ready' ); |
118 | 101 | } |
119 | 102 | } |
120 | 103 | }, |
— | — | @@ -125,15 +108,16 @@ |
126 | 109 | */ |
127 | 110 | seek : function( percent ) { |
128 | 111 | this.getPlayerElement(); |
| 112 | + // Use the parent (re) embed with new seek url method if urlTimeEncoding is supported. |
129 | 113 | if ( this.supportsURLTimeEncoding() ) { |
130 | 114 | this.parent_seek( percent ); |
131 | 115 | } else if ( this.playerElement ) { |
132 | 116 | this.seeking = true; |
133 | | - mw.log( "do vlc http seek to: " + percent ) |
| 117 | + mw.log( "EmbedPlayerVlc:: seek to: " + percent ) |
134 | 118 | if ( ( this.playerElement.input.state == 3 ) && ( this.playerElement.input.position != percent ) ) |
135 | 119 | { |
136 | 120 | this.playerElement.input.position = percent; |
137 | | - this.controlBuilder.setStatus( 'seeking...' ); |
| 121 | + this.controlBuilder.setStatus( gM('mwe-embedplayer-seeking') ); |
138 | 122 | } |
139 | 123 | } else { |
140 | 124 | this.doPlayThenSeek( percent ); |
— | — | @@ -147,23 +131,23 @@ |
148 | 132 | * @param {Float} percent Seek to this percent of the stream after playing |
149 | 133 | */ |
150 | 134 | doPlayThenSeek:function( percent ) { |
151 | | - mw.log( 'doPlayThenSeekHack' ); |
| 135 | + mw.log( 'EmbedPlayerVlc:: doPlayThenSeek' ); |
152 | 136 | var _this = this; |
153 | 137 | this.play(); |
154 | | - var rfsCount = 0; |
| 138 | + var seekCount = 0; |
155 | 139 | var readyForSeek = function() { |
156 | 140 | _this.getPlayerElement(); |
157 | 141 | var newState = _this.playerElement.input.state; |
158 | | - // if playing we are ready to do the |
| 142 | + // If playing we are ready to do the seek |
159 | 143 | if ( newState == 3 ) { |
160 | 144 | _this.seek( percent ); |
161 | 145 | } else { |
162 | | - // try to get player for 10 seconds: |
163 | | - if ( rfsCount < 200 ) { |
| 146 | + // Try to get player for 10 seconds: |
| 147 | + if ( seekCount < 200 ) { |
164 | 148 | setTimeout( readyForSeek, 50 ); |
165 | 149 | rfsCount++; |
166 | 150 | } else { |
167 | | - mw.log( 'error:doPlayThenSeek failed' ); |
| 151 | + mw.log( 'Error: EmbedPlayerVlc doPlayThenSeek failed' ); |
168 | 152 | } |
169 | 153 | } |
170 | 154 | } |
— | — | @@ -175,12 +159,11 @@ |
176 | 160 | */ |
177 | 161 | monitor: function() { |
178 | 162 | this.getPlayerElement(); |
179 | | - if ( !this.playerElement ) |
| 163 | + if ( ! this.playerElement ){ |
180 | 164 | return ; |
| 165 | + } |
| 166 | + // Try to get relay vlc log messages to the console. |
181 | 167 | try{ |
182 | | - //mw.log( 'state:' + this.playerElement.input.state); |
183 | | - //mw.log('time: ' + this.playerElement.input.time); |
184 | | - //mw.log('pos: ' + this.playerElement.input.position); |
185 | 168 | if ( this.playerElement.log.messages.count > 0 ) { |
186 | 169 | // there is one or more messages in the log |
187 | 170 | var iter = this.playerElement.log.messages.iterator(); |
— | — | @@ -228,28 +211,28 @@ |
229 | 212 | this.onPlaying(); |
230 | 213 | } |
231 | 214 | } catch( e ){ |
232 | | - mw.log("EmbedPlayerVlc::Monitor error"); |
| 215 | + mw.log("EmbedPlayerVlc:: Monitor error"); |
233 | 216 | } |
234 | | - // update the status and check timmer via universal parent monitor |
| 217 | + // Update the status and check timer via universal parent monitor |
235 | 218 | this.parent_monitor(); |
236 | 219 | }, |
237 | 220 | |
238 | 221 | /** |
239 | 222 | * Events: |
240 | | - * NOTE : should be localized: |
241 | 223 | */ |
242 | 224 | onOpen: function() { |
243 | | - this.controlBuilder.setStatus( "Opening..." ); |
| 225 | + // Open is considered equivalent to other players buffer status: |
| 226 | + this.controlBuilder.setStatus( gM('mwe-embedplayer-buffering') ); |
244 | 227 | }, |
245 | 228 | onBuffer: function() { |
246 | | - this.controlBuilder.setStatus( "Buffering..." ); |
| 229 | + this.controlBuilder.setStatus( gM('mwe-embedplayer-buffering') ); |
247 | 230 | }, |
248 | 231 | onPlay: function() { |
249 | 232 | this.onPlaying(); |
250 | 233 | }, |
251 | 234 | onPlaying: function() { |
252 | 235 | this.seeking = false; |
253 | | - // for now trust the duration from url over vlc input.length |
| 236 | + // For now trust the duration from url over vlc input.length |
254 | 237 | if ( !this.getDuration() && this.playerElement.input.length > 0 ) |
255 | 238 | { |
256 | 239 | // mw.log('setting duration to ' + this.playerElement.input.length /1000); |
— | — | @@ -266,19 +249,21 @@ |
267 | 250 | }, |
268 | 251 | |
269 | 252 | onPause: function() { |
270 | | - this.parent_pause(); // update the inteface if paused via native control |
| 253 | + // Update the interface if paused via native plugin |
| 254 | + this.parent_pause(); |
271 | 255 | }, |
272 | 256 | onStop: function() { |
273 | | - mw.log( 'vlc:onStop:' ); |
274 | | - if ( !this.seeking ) |
| 257 | + mw.log( 'EmbedPlayerVlc:: onStop' ); |
| 258 | + if ( !this.seeking ){ |
275 | 259 | this.onClipDone(); |
| 260 | + } |
276 | 261 | }, |
277 | 262 | |
278 | 263 | /** |
279 | 264 | * Handles play requests |
280 | 265 | */ |
281 | | - play : function() { |
282 | | - mw.log( 'f:vlcPlay' ); |
| 266 | + play: function() { |
| 267 | + mw.log( 'EmbedPlayerVlc:: play' ); |
283 | 268 | // Update the interface |
284 | 269 | this.parent_play(); |
285 | 270 | if ( this.getPlayerElement() ) { |
— | — | @@ -304,13 +289,13 @@ |
305 | 290 | * Passes the Pause request to the plugin. |
306 | 291 | * calls parent "pause" to update interface |
307 | 292 | */ |
308 | | - pause : function() { |
| 293 | + pause: function() { |
309 | 294 | this.parent_pause(); // update the interface if paused via native control |
310 | 295 | if ( this.getPlayerElement() ) { |
311 | 296 | try{ |
312 | 297 | this.playerElement.playlist.togglePause(); |
313 | 298 | } catch( e ){ |
314 | | - mw.log("EmbedPlayerVlc could not pause video " + e); |
| 299 | + mw.log("EmbedPlayerVlc:: Could not pause video " + e); |
315 | 300 | } |
316 | 301 | } |
317 | 302 | }, |
— | — | @@ -321,16 +306,17 @@ |
322 | 307 | */ |
323 | 308 | toggleMute:function() { |
324 | 309 | this.parent_toggleMute(); |
325 | | - if ( this.getPlayerElement() ) |
| 310 | + if ( this.getPlayerElement() ){ |
326 | 311 | this.playerElement.audio.toggleMute(); |
| 312 | + } |
327 | 313 | }, |
328 | 314 | |
329 | 315 | /** |
330 | 316 | * Update the player volume |
331 | | - * @pram {Float} percent Percent of total volume |
| 317 | + * @parm {Float} percent Percent of total volume |
332 | 318 | */ |
333 | 319 | setPlayerElementVolume: function ( percent ) { |
334 | | - if ( this.getPlayerElement() ) { |
| 320 | + if ( this.getPlayerElement() && this.playerElement.audio ) { |
335 | 321 | this.playerElement.audio.volume = percent * 100; |
336 | 322 | } |
337 | 323 | }, |
— | — | @@ -340,8 +326,9 @@ |
341 | 327 | * @return {Float} percent percent of total volume |
342 | 328 | */ |
343 | 329 | getVolumen:function() { |
344 | | - if ( this.getPlayerElement() ) |
| 330 | + if ( this.getPlayerElement() ){ |
345 | 331 | return this.playerElement.audio.volume / 100; |
| 332 | + } |
346 | 333 | }, |
347 | 334 | |
348 | 335 | /** |
— | — | @@ -353,7 +340,7 @@ |
354 | 341 | try{ |
355 | 342 | this.playerElement.video.toggleFullscreen(); |
356 | 343 | } catch ( e ){ |
357 | | - mw.log("VlcEmbed:: toggle fullscreen : possible error: " + e); |
| 344 | + mw.log("EmbedPlayerVlc:: toggle fullscreen : possible error: " + e); |
358 | 345 | } |
359 | 346 | } |
360 | 347 | } |
— | — | @@ -368,4 +355,4 @@ |
369 | 356 | } |
370 | 357 | }; |
371 | 358 | |
372 | | -} )( window.mediaWiki, window.jQuery ); |
\ No newline at end of file |
| 359 | +} )( mediaWiki, jQuery ); |
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayerNative.js |
— | — | @@ -90,14 +90,14 @@ |
91 | 91 | this.isFirstEmbedPlay = true; |
92 | 92 | |
93 | 93 | if( vid && $( vid ).attr('src') == this.getSrc( this.currentTime ) ){ |
94 | | - _this.postEmbedJS(); |
| 94 | + _this.postEmbedActions(); |
95 | 95 | return ; |
96 | 96 | } |
97 | 97 | mw.log( "EmbedPlayerNative::embedPlayerHTML > play url:" + this.getSrc( this.currentTime ) + ' startOffset: ' + this.start_ntp + ' end: ' + this.end_ntp ); |
98 | 98 | |
99 | 99 | // Check if using native controls and already the "pid" is already in the DOM |
100 | 100 | if( this.isPersistentNativePlayer() && vid ) { |
101 | | - _this.postEmbedJS(); |
| 101 | + _this.postEmbedActions(); |
102 | 102 | return ; |
103 | 103 | } |
104 | 104 | |
— | — | @@ -109,8 +109,8 @@ |
110 | 110 | _this.getNativePlayerHtml() |
111 | 111 | ); |
112 | 112 | |
113 | | - // Directly run postEmbedJS ( if playerElement is not available it will retry ) |
114 | | - _this.postEmbedJS(); |
| 113 | + // Directly run postEmbedActions ( if playerElement is not available it will retry ) |
| 114 | + _this.postEmbedActions(); |
115 | 115 | }, |
116 | 116 | |
117 | 117 | /** |
— | — | @@ -160,9 +160,9 @@ |
161 | 161 | /** |
162 | 162 | * Post element javascript, binds event listeners and starts monitor |
163 | 163 | */ |
164 | | - postEmbedJS: function() { |
| 164 | + postEmbedActions: function() { |
165 | 165 | var _this = this; |
166 | | - mw.log( "f:native:postEmbedJS:" ); |
| 166 | + mw.log( "f:native:postEmbedActions:" ); |
167 | 167 | |
168 | 168 | // Setup local pointer: |
169 | 169 | var vid = this.getPlayerElement(); |
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayerKplayer.js |
— | — | @@ -74,7 +74,7 @@ |
75 | 75 | |
76 | 76 | var orgJsReadyCallback = window.jsCallbackReady; |
77 | 77 | window.jsCallbackReady = function( playerId ){ |
78 | | - _this.postEmbedJS(); |
| 78 | + _this.postEmbedActions(); |
79 | 79 | window.jsCallbackReady = orgJsReadyCallback; |
80 | 80 | }; |
81 | 81 | // attributes and params: |
— | — | @@ -93,10 +93,10 @@ |
94 | 94 | |
95 | 95 | // Flash player loses its bindings once it changes sizes:: |
96 | 96 | $(_this).bind('onOpenFullScreen', function() { |
97 | | - _this.postEmbedJS(); |
| 97 | + _this.postEmbedActions(); |
98 | 98 | }); |
99 | 99 | $(_this).bind('onCloseFullScreen', function() { |
100 | | - _this.postEmbedJS(); |
| 100 | + _this.postEmbedActions(); |
101 | 101 | }); |
102 | 102 | }, |
103 | 103 | |
— | — | @@ -106,7 +106,7 @@ |
107 | 107 | /** |
108 | 108 | * javascript run post player embedding |
109 | 109 | */ |
110 | | - postEmbedJS : function() { |
| 110 | + postEmbedActions : function() { |
111 | 111 | var _this = this; |
112 | 112 | this.getPlayerElement(); |
113 | 113 | |
— | — | @@ -135,7 +135,7 @@ |
136 | 136 | return ; |
137 | 137 | } |
138 | 138 | setTimeout(function() { |
139 | | - _this.postEmbedJS(); |
| 139 | + _this.postEmbedActions(); |
140 | 140 | }, 10); |
141 | 141 | } |
142 | 142 | }, |