Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js |
— | — | @@ -160,7 +160,7 @@ |
161 | 161 | |
162 | 162 | // If the player controls should be overlayed |
163 | 163 | //( Global default via config overlayControls in module loader.js) |
164 | | - "overlayControls" : mw.getConfig( 'overlayControls' ), |
| 164 | + "overlayControls" : true, |
165 | 165 | |
166 | 166 | // ROE url ( for xml based metadata ) |
167 | 167 | // also see: http://wiki.xiph.org/ROE |
— | — | @@ -407,6 +407,7 @@ |
408 | 408 | mw.log("runPlayerSwap::" + $j( playerElement ).attr('id') ); |
409 | 409 | ranPlayerSwapFlag = true; |
410 | 410 | var playerInterface = new mw.EmbedPlayer( playerElement , attributes); |
| 411 | + |
411 | 412 | _this.swapEmbedPlayerElement( playerElement, playerInterface ); |
412 | 413 | |
413 | 414 | |
— | — | @@ -1311,9 +1312,10 @@ |
1312 | 1313 | } |
1313 | 1314 | |
1314 | 1315 | var playerAttributes = mw.getConfig( 'embedPlayerAttributes' ); |
| 1316 | + |
1315 | 1317 | // Setup the player Interface from supported attributes: |
1316 | 1318 | for ( var attr in playerAttributes ) { |
1317 | | - if ( customAttributes[ attr ] ) { |
| 1319 | + if ( customAttributes[ attr ] || customAttributes[ attr ] === false ) { |
1318 | 1320 | this[ attr ] = customAttributes[ attr ]; |
1319 | 1321 | } else if ( element.getAttribute( attr ) ) { |
1320 | 1322 | this[ attr ] = element.getAttribute( attr ); |
— | — | @@ -1370,7 +1372,8 @@ |
1371 | 1373 | // Set the source duration ( if provided in the element metaData or durationHint ) |
1372 | 1374 | if ( $j( element ).attr( 'duration' ) ) { |
1373 | 1375 | _this.duration = $j( element ).attr( 'duration' ); |
1374 | | - } |
| 1376 | + } |
| 1377 | + |
1375 | 1378 | if ( !_this.duration && $j( element ).attr( 'durationHint' ) ) { |
1376 | 1379 | _this.durationHint = $j( element ).attr( 'durationHint' ); |
1377 | 1380 | // Convert duration hint if needed: |
— | — | @@ -2008,7 +2011,7 @@ |
2009 | 2012 | |
2010 | 2013 | // If the native video is already displayed hide it: |
2011 | 2014 | if( $j( '#' + this.pid ).length != 0 ){ |
2012 | | - $j('#loadSpiner_' + this.id ).remove(); |
| 2015 | + $j('#loadingSpinner_' + this.id ).remove(); |
2013 | 2016 | $j( '#' + this.pid ).hide() |
2014 | 2017 | } |
2015 | 2018 | if( this.mediaElement.sources.length == 0 ){ |
— | — | @@ -2286,13 +2289,14 @@ |
2287 | 2290 | $j(this).empty(); |
2288 | 2291 | |
2289 | 2292 | // Remove the player loader spiner if it exists |
2290 | | - $j('#loadSpiner_' + this.id ).remove(); |
| 2293 | + $j('#loadingSpinner_' + this.id ).remove(); |
2291 | 2294 | |
2292 | 2295 | // Check if we need to refresh mobile safari |
2293 | 2296 | /*var mobileSafairNeedsRefresh = false; |
2294 | 2297 | if( $j( '#' + this.pid ).attr('controls') === false ){ |
2295 | 2298 | mobileSafairNeedsRefresh = true; |
2296 | 2299 | }*/ |
| 2300 | + |
2297 | 2301 | // For now always refersh ( buggy display control behavior in iPad ) |
2298 | 2302 | mobileSafairNeedsRefresh = true; |
2299 | 2303 | |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js |
— | — | @@ -638,6 +638,7 @@ |
639 | 639 | if( mw.getConfig( 'overlayControls' ) === false){ |
640 | 640 | return false; |
641 | 641 | } |
| 642 | + |
642 | 643 | // If disabled via the player |
643 | 644 | if( this.embedPlayer.overlayControls === false ){ |
644 | 645 | return false; |
Index: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js |
— | — | @@ -183,7 +183,7 @@ |
184 | 184 | var vid = _this.getPlayerElement(); |
185 | 185 | |
186 | 186 | // Update the bufferedPercent |
187 | | - if( vid.buffered && vid.buffered.end && vid.duration ) { |
| 187 | + if( vid && vid.buffered && vid.buffered.end && vid.duration ) { |
188 | 188 | this.bufferedPercent = (vid.buffered.end(0) / vid.duration); |
189 | 189 | } |
190 | 190 | _this.parent_monitor(); |
Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | */ |
6 | 6 | var urlparts = getRemoteEmbedPath(); |
7 | 7 | var mwEmbedHostPath = urlparts[0]; |
8 | | -var mwRemoteVersion = 'r128'; |
| 8 | +var mwRemoteVersion = 'r129'; |
9 | 9 | var mwUseScriptLoader = true; |
10 | 10 | |
11 | 11 | // Log the mwRemote version makes it easy to debug cache issues |
— | — | @@ -27,7 +27,6 @@ |
28 | 28 | if( mwReqParam['debug'] ) { |
29 | 29 | mwUseScriptLoader = false; |
30 | 30 | } |
31 | | -mwUseScriptLoader = true; |
32 | 31 | |
33 | 32 | // Setup up some globals to wrap mwEmbed mw.ready and mw.setConfig functions |
34 | 33 | |
— | — | @@ -318,6 +317,7 @@ |
319 | 318 | // Check if file is from commons and therefore should explicitly set apiProvider to commons: |
320 | 319 | var apiProviderAttr = ( src.indexOf( 'wikipedia\/commons' ) != -1 )?'apiProvider="commons" ': ''; |
321 | 320 | |
| 321 | + var autoPlayAttr = ''; |
322 | 322 | // If in a gallery box we will be displaying the video larger in a lightbox |
323 | 323 | if( $j( '#' + vidId ).parents( '.gallerybox' ).length ){ |
324 | 324 | // Update the width to 400 and keep scale |
— | — | @@ -325,18 +325,20 @@ |
326 | 326 | if( pheight != 0 ) { |
327 | 327 | pheight = pwidth * ( $j( '#' + vidId ).height() / $j( '#' + vidId ).width() ); |
328 | 328 | } |
| 329 | + autoPlayAttr = ' autoplay="true" '; |
329 | 330 | } |
330 | | - |
| 331 | + |
331 | 332 | if ( src ) { |
332 | 333 | var html_out = ''; |
333 | 334 | |
334 | 335 | var common_attr = ' id="mwe_' + vidId + '" ' + |
335 | | - 'apiTitleKey="' + apiTitleKey + '" ' + |
336 | | - 'src="' + src + '" ' + |
337 | | - apiProviderAttr + |
338 | | - duration_attr + |
339 | | - offset_attr + ' ' + |
340 | | - 'class="kskin" '; |
| 336 | + 'apiTitleKey="' + apiTitleKey + '" ' + |
| 337 | + 'src="' + src + '" ' + |
| 338 | + autoPlayAttr + |
| 339 | + apiProviderAttr + |
| 340 | + duration_attr + |
| 341 | + offset_attr + ' ' + |
| 342 | + 'class="kskin" '; |
341 | 343 | |
342 | 344 | if ( tag_type == 'audio' ) { |
343 | 345 | if( pwidth < 250 ){ |
— | — | @@ -376,17 +378,31 @@ |
377 | 379 | .css( { |
378 | 380 | 'position' : 'absolute', |
379 | 381 | 'top' : ( parseInt( $pimg.attr( 'height' ) ) /2 ) -25, |
380 | | - 'left' : ( parseInt( $pimg.attr( 'height' ) ) /2 ) - 45 |
| 382 | + 'maring-left' : 'auto', |
| 383 | + 'maring-right' : 'auto' |
381 | 384 | }) |
| 385 | + |
382 | 386 | .addClass( 'play-btn-large' ) |
383 | 387 | .buttonHover() |
384 | | - .click( function(){ |
| 388 | + .click( function(){ |
| 389 | + var _this = this; |
| 390 | + |
385 | 391 | var dialogHeight = ( $j( this ).data( 'playerHeight') == 0 )? 175 : |
386 | | - ( $j( this ).data( 'playerHeight') - 75 ); |
| 392 | + ( $j( this ).data( 'playerHeight') - 25 ); |
| 393 | + var buttons = {}; |
| 394 | + buttons[ gM( 'mwe-ok' ) ] = function(){ |
| 395 | + var embedPlayer = $j( '#mwe_' + $j( _this ).data( 'playerId' ) ).get(0); |
| 396 | + // stop the player ( more healthy way to remove the video from the dom ) |
| 397 | + if( embedPlayer ) { |
| 398 | + embedPlayer.stop(); |
| 399 | + } |
| 400 | + // close the dialog |
| 401 | + $j(this).dialog( 'close' ).remove(); |
| 402 | + }; |
387 | 403 | mw.addDialog( |
388 | 404 | decodeURIComponent( $j( this ).data( 'title' ).replace(/_/g, ' ') ), |
389 | 405 | $j( this ).data( 'embedCode' ), |
390 | | - gM( 'mwe-ok' ) |
| 406 | + buttons |
391 | 407 | ) |
392 | 408 | // Dialog size setup is a bit strange: |
393 | 409 | .css( { |
— | — | @@ -396,9 +412,20 @@ |
397 | 413 | // we hard code the default resolution to 400 above |
398 | 414 | 'width' : '435px', |
399 | 415 | } ) |
400 | | - // Update the embed code to use the mwEmbed player: |
401 | | - $j.embedPlayers(); |
| 416 | + |
| 417 | + alert( $j('#mwTempLoaderDialog').html() ); |
| 418 | + |
| 419 | + // Update the embed code to use the mwEmbed player: |
| 420 | + $j.embedPlayers( function(){ |
| 421 | + var embedPlayer = $j( '#mwe_' + $j( _this ).data( 'playerId' ) ).get(0); |
| 422 | + // Show the control bar for two seconds (auto play is confusing without it ) |
| 423 | + embedPlayer.controlBuilder.showControlBar(); |
| 424 | + setTimeout( function(){ |
| 425 | + embedPlayer.controlBuilder.hideControlBar(); |
| 426 | + }, 4000 ); |
| 427 | + }); |
402 | 428 | }) |
| 429 | + .data( 'playerId', vidId ) |
403 | 430 | .data( 'embedCode', html_out ) |
404 | 431 | .data( 'title' , apiTitleKey ) |
405 | 432 | .data( 'playerHeight', pheight ) |
— | — | @@ -508,8 +535,17 @@ |
509 | 536 | rurl += '&' + mwGetReqArgs(); |
510 | 537 | importScriptURI( rurl ); |
511 | 538 | } else { |
512 | | - // Ignore classSet (will be loaded onDemand ) |
| 539 | + // load mwEmbed js |
513 | 540 | importScriptURI( mwEmbedHostPath + '/mwEmbed.js?' + mwGetReqArgs() ); |
| 541 | + |
| 542 | + // Load the class set as part of mwReady callback |
| 543 | + var instanceCallback = callback; |
| 544 | + var callback = function(){ |
| 545 | + mw.load( classSet, function(){ |
| 546 | + instanceCallback(); |
| 547 | + }) |
| 548 | + } |
| 549 | + |
514 | 550 | } |
515 | 551 | } |
516 | 552 | waitMwEmbedReady( callback ); |