r113738 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113737‎ | r113738 | r113739 >
Date:18:12, 13 March 2012
Author:dale
Status:ok
Tags:
Comment:
added in some missing methods from kaltura branch ( getTextTracks )
fixed getDownload sources to not be dependent on timedText binding
add text binding at loader.js time
Modified paths:
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaElement.js (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/kskin/mw.PlayerSkinKskin.js (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/TimedText.loader.js (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/TimedText.loader.js
@@ -17,7 +17,12 @@
1818 classRequest = $.merge( classRequest, ['mw.TimedText'] );
1919 }
2020 } );
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+ });
2227 /**
2328 * Check timedText is active for a given embedPlayer
2429 * @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 @@
7373 },
7474
7575 /**
 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+ /**
7688 * Check for Timed Text tracks
7789 *
7890 * @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 @@
309309 */
310310 showMenuItem:function( menuItem ) {
311311 var embedPlayer = this.embedPlayer;
312 - //handle special k-skin specific display;
 312+ // Handle special k-skin specific display;
313313 switch( menuItem ){
314314 case 'credits':
315315 this.showCredits();
@@ -319,9 +319,8 @@
320320 );
321321 break;
322322 case 'download' :
323 - embedPlayer.$interface.find( '.menu-download').text(
324 - gM('mwe-loading' )
325 - );
 323+ embedPlayer.$interface.find( '.menu-download')
 324+ .loadingSpinner();
326325 // Call show download with the target to be populated
327326 this.showDownload(
328327 embedPlayer.$interface.find( '.menu-download')
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/skins/mw.PlayerControlBuilder.js
@@ -1684,32 +1684,11 @@
16851685 * Loads sources and calls showDownloadWithSources
16861686 * @param {Object} $target jQuery target to output to
16871687 */
1688 - showDownload: function( $target ) {
 1688+ showDownload: function( $targetContainer ) {
16891689 var _this = this;
16901690 var embedPlayer = this.embedPlayer;
16911691
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 );
17141693 // Empty the target:
17151694 $targetContainer.empty();
17161695 $targetContainer.append( $('<div />') );
@@ -1719,7 +1698,7 @@
17201699 var $textList = $( '<ul />' );
17211700 $.each( embedPlayer.mediaElement.getSources(), function( index, source ) {
17221701 if( source.getSrc() ) {
1723 - mw.log("showDownloadWithSources:: Add src: " + source.getTitle() );
 1702+ mw.log("PlayerControlBuilder::showDownload: Add src: " + source.getTitle() );
17241703 var $dl_line = $( '<li />').append(
17251704 $('<a />')
17261705 .attr( 'href', source.getSrc() )

Status & tagging log