Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/TimedText.loader.js |
— | — | @@ -17,7 +17,12 @@ |
18 | 18 | classRequest = $.merge( classRequest, ['mw.TimedText'] ); |
19 | 19 | } |
20 | 20 | } ); |
21 | | - |
| 21 | + // On new embed player check if we need to add timedText |
| 22 | + $( mw ).bind( 'newEmbedPlayerEvent', function( event, embedPlayer ){ |
| 23 | + if( mw.isTimedTextSupported( embedPlayer ) ){ |
| 24 | + embedPlayer.timedText = new mw.TimedText( embedPlayer ); |
| 25 | + } |
| 26 | + }); |
22 | 27 | /** |
23 | 28 | * Check timedText is active for a given embedPlayer |
24 | 29 | * @param {object} embedPlayer The player to be checked for timedText properties |
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaElement.js |
— | — | @@ -72,6 +72,18 @@ |
73 | 73 | }, |
74 | 74 | |
75 | 75 | /** |
| 76 | + * Get Text tracks |
| 77 | + */ |
| 78 | + getTextTracks: function(){ |
| 79 | + var textTracks = []; |
| 80 | + $.each( this.sources, function(inx, source ){ |
| 81 | + if ( source.nodeName == 'track' || ( source.mimeType && source.mimeType.indexOf('text/') !== -1 )){ |
| 82 | + textTracks.push( source ); |
| 83 | + } |
| 84 | + }); |
| 85 | + return textTracks; |
| 86 | + }, |
| 87 | + /** |
76 | 88 | * Check for Timed Text tracks |
77 | 89 | * |
78 | 90 | * @return {Boolean} True if text tracks exist, false if no text tracks are |
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/kskin/mw.PlayerSkinKskin.js |
— | — | @@ -308,7 +308,7 @@ |
309 | 309 | */ |
310 | 310 | showMenuItem:function( menuItem ) { |
311 | 311 | var embedPlayer = this.embedPlayer; |
312 | | - //handle special k-skin specific display; |
| 312 | + // Handle special k-skin specific display; |
313 | 313 | switch( menuItem ){ |
314 | 314 | case 'credits': |
315 | 315 | this.showCredits(); |
— | — | @@ -319,9 +319,8 @@ |
320 | 320 | ); |
321 | 321 | break; |
322 | 322 | case 'download' : |
323 | | - embedPlayer.$interface.find( '.menu-download').text( |
324 | | - gM('mwe-loading' ) |
325 | | - ); |
| 323 | + embedPlayer.$interface.find( '.menu-download') |
| 324 | + .loadingSpinner(); |
326 | 325 | // Call show download with the target to be populated |
327 | 326 | this.showDownload( |
328 | 327 | embedPlayer.$interface.find( '.menu-download') |
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js |
— | — | @@ -1684,32 +1684,11 @@ |
1685 | 1685 | * Loads sources and calls showDownloadWithSources |
1686 | 1686 | * @param {Object} $target jQuery target to output to |
1687 | 1687 | */ |
1688 | | - showDownload: function( $target ) { |
| 1688 | + showDownload: function( $targetContainer ) { |
1689 | 1689 | var _this = this; |
1690 | 1690 | var embedPlayer = this.embedPlayer; |
1691 | 1691 | |
1692 | | - // Load additional text sources via apiTitleKey: |
1693 | | - // TODO we should move this to timedText bindings |
1694 | | - if( embedPlayer.apiTitleKey ) { |
1695 | | - // Load text interface ( if not already loaded ) |
1696 | | - mw.load( 'TimedText', function() { |
1697 | | - embedPlayer.timedText.setupTextSources(function(){ |
1698 | | - _this.showDownloadWithSources( $target ); |
1699 | | - }); |
1700 | | - }); |
1701 | | - } else { |
1702 | | - _this.showDownloadWithSources( $target ); |
1703 | | - } |
1704 | | - }, |
1705 | | - |
1706 | | - /** |
1707 | | - * Shows the download interface with sources loaded |
1708 | | - * @param {Object} $targetContainer jQuery target to output to |
1709 | | - */ |
1710 | | - showDownloadWithSources : function( $targetContainer ) { |
1711 | | - var _this = this; |
1712 | | - mw.log( 'showDownloadWithSources::' + $targetContainer.length ); |
1713 | | - var embedPlayer = this.embedPlayer; |
| 1692 | + mw.log( 'PlayerControlBuilder::showDownload: ' + $targetContainer.length ); |
1714 | 1693 | // Empty the target: |
1715 | 1694 | $targetContainer.empty(); |
1716 | 1695 | $targetContainer.append( $('<div />') ); |
— | — | @@ -1719,7 +1698,7 @@ |
1720 | 1699 | var $textList = $( '<ul />' ); |
1721 | 1700 | $.each( embedPlayer.mediaElement.getSources(), function( index, source ) { |
1722 | 1701 | if( source.getSrc() ) { |
1723 | | - mw.log("showDownloadWithSources:: Add src: " + source.getTitle() ); |
| 1702 | + mw.log("PlayerControlBuilder::showDownload: Add src: " + source.getTitle() ); |
1724 | 1703 | var $dl_line = $( '<li />').append( |
1725 | 1704 | $('<a />') |
1726 | 1705 | .attr( 'href', source.getSrc() ) |