r65976 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r65975‎ | r65976 | r65977 >
Date:02:22, 6 May 2010
Author:dale
Status:deferred (Comments)
Tags:
Comment:
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js
@@ -248,11 +248,11 @@
249249 * @param [ Optional ] {Function} callback Function to be called once video interfaces are ready
250250 *
251251 */
252 - $.fn.embedPlayer = function( attributes, callback ) {
 252+ $.fn.embedPlayer = function( attributes, callback ) {
253253 mw.log('embedPlayer on: ' + this.selector);
254 - var player_select = this.selector;
 254+ var playerSelect = this.selector;
255255
256 - // Handle optional include of attributes argument:
 256+ //Handle optional include of attributes argument:
257257 if( typeof attributes == 'function' ){
258258 callback = attributes;
259259 }
@@ -263,16 +263,16 @@
264264 mw.playerManager = new EmbedPlayerManager();
265265
266266 // Run the global hooks that mw.playerManager is ready
267 - mw.runHook( 'EmbedPlayerManagerReady' );
 267+ $j( mw ).trigger( 'EmbedPlayerManagerReady' );
268268 }
269269
270 - // Add the embedPlayer ready callback
271 - if( typeof callback == 'function' ) {
 270+ //Add the embedPlayer ready callback
 271+ if( typeof callback == 'function' ){
272272 mw.playerManager.addCallback( callback );
273 - }
274 -
 273+ }
 274+
275275 // Add each selected element to the player manager:
276 - $j( player_select ).each( function(na, playerElement) {
 276+ $j( playerSelect ).each( function(na, playerElement) {
277277 mw.playerManager.addElement( playerElement, attributes);
278278 } );
279279 }
@@ -299,7 +299,6 @@
300300 init: function( ) {
301301 this.callbackFunctions = [];
302302 this.playerList = [];
303 - mw.addHookSystem ( this );
304303 },
305304
306305 /**
@@ -372,11 +371,12 @@
373372 var playlistPlayer = new mw.PlayList( element, attributes );
374373
375374 // Swap in playlist player interface
376 - _this.swapEmbedPlayerElement( element, playlistPlayer );
 375+ _this.swapEmbedPlayerElement( element, playerInterface );
377376
378 - // Pass the id to any hook that needs to interface prior to showPlayer code
379 - _this.runHook( 'swapedPlayerId', playerInterface.id );
 377+ // Pass the id to any hook that needs to interface prior to checkPlayerSources
 378+ $j( _this ).trigger ( 'swapedPlayerId', playerInterface.id );
380379
 380+
381381 // Issue the checkPlayerSources call to the new playlist interface:
382382 $j( '#' + playlistPlayer.id ).get(0).showPlayer();
383383 } );
@@ -394,10 +394,10 @@
395395 mw.log("runPlayerSwap::" + $j( element ).attr('id') );
396396 ranPlayerSwapFlag = true;
397397 var playerInterface = new mw.EmbedPlayer( element , attributes);
398 - _this.swapEmbedPlayerElement( element, playerInterface );
 398+ _this.swapEmbedPlayerElement( element, playerInterface );
399399
400400 // Pass the id to any hook that needs to interface prior to checkPlayerSources
401 - _this.runHook( 'swapedPlayerId', playerInterface.id );
 401+ $j( _this ).trigger ( 'swapedPlayerId', playerInterface.id );
402402
403403 // Issue the checkPlayerSources call to the new player interface:
404404 // make sure to use the element that is in the DOM:
@@ -560,10 +560,9 @@
561561 // Remove the player loader spinner:
562562 $j('#loadSpiner_' + player.id ).remove();
563563
564 - // Run the player ready hook
565 - player.runHook( 'playerReady' );
 564+ // Run the player ready trigger
 565+ $j( player ).trigger( 'playerReady' );
566566
567 - // Check if all the players are ready
568567 var is_ready = true;
569568 for ( var i = 0; i < this.playerList.length; i++ ) {
570569 var currentPlayer = $j( '#' + this.playerList[i] ).get( 0 );
@@ -595,7 +594,7 @@
596595
597596 mediaSource.prototype = {
598597 // MIME type of the source.
599 - mimeType: null,
 598+ mimeType:null,
600599
601600 // URI of the source.
602601 uri:null,
@@ -648,7 +647,7 @@
649648 if ( typeof pUrl[ 'queryKey' ][ 't' ] != 'undefined' ) {
650649 this[ 'URLTimeEncoding' ] = true;
651650 }
652 - // Set the source attributes local var
 651+
653652 var sourceAttr = mw.getConfig( 'embedPlayerSourceAttributes' );
654653
655654 for ( var i = 0; i < sourceAttr.length; i++ ) { // array loop:
@@ -973,15 +972,15 @@
974973 * @return mediaSource elements.
975974 * @type Array
976975 */
977 - getSources: function( mime_filter ) {
978 - if ( !mime_filter ) {
 976+ getSources: function( mimeFilter ) {
 977+ if ( !mimeFilter ) {
979978 return this.sources;
980979 }
981980 // Apply mime filter:
982981 var source_set = new Array();
983982 for ( var i = 0; i < this.sources.length ; i++ ) {
984983 if ( this.sources[i].mimeType &&
985 - this.sources[i].mimeType.indexOf( mime_filter ) != -1 )
 984+ this.sources[i].mimeType.indexOf( mimeFilter ) != -1 )
986985 source_set.push( this.sources[i] );
987986 }
988987 return source_set;
@@ -1144,7 +1143,7 @@
11451144 // make sure an existing element with the same src does not already exist:
11461145 for ( var i = 0; i < this.sources.length; i++ ) {
11471146 if ( this.sources[i].src == newSrc ) {
1148 - // Source already exists update any new attributes:
 1147+ // Source already exists update any new attr:
11491148 this.sources[i].updateSource( element );
11501149 return this.sources[i];
11511150 }
@@ -1152,8 +1151,8 @@
11531152 }
11541153 // Create a new source
11551154 var source = new mediaSource( element );
1156 -
1157 - this.sources.push( source );
 1155+
 1156+ this.sources.push( source );
11581157 mw.log( 'tryAddSource: added source ::' + source + 'sl:' + this.sources.length );
11591158 return source;
11601159 },
@@ -1169,7 +1168,7 @@
11701169 if ( this.isPlayableType( this.sources[i].mimeType ) ) {
11711170 playableSources.push( this.sources[i] );
11721171 } else {
1173 - mw.log( "type " + this.sources[i].mimeType + 'is not playable' );
 1172+ //mw.log( "type " + this.sources[i].mimeType + 'is not playable' );
11741173 }
11751174 };
11761175 return playableSources;
@@ -1244,9 +1243,6 @@
12451244 // Stores the loading errors
12461245 'loadError' : false,
12471246
1248 - // Loading external data flag ( for delaying interface updates )
1249 - 'loading_external_data' : false,
1250 -
12511247 // Thumbnail updating flag ( to avoid rewriting an thumbnail thats already being updated)
12521248 'thumbnail_updating' : false,
12531249
@@ -1285,12 +1281,10 @@
12861282 init: function( element, customAttributes ) {
12871283 var _this = this;
12881284 // Set customAttributes if unset:
1289 - if ( !customAttributes )
 1285+ if ( !customAttributes ) {
12901286 customAttributes = { };
 1287+ }
12911288
1292 - //Add a hook system to the embedPlayer
1293 - mw.addHookSystem( _this );
1294 -
12951289 var playerAttributes = mw.getConfig( 'embedPlayerAttributes' );
12961290 // Setup the player Interface from supported attributes:
12971291 for ( var attr in playerAttributes ) {
@@ -1371,8 +1365,8 @@
13721366 }
13731367
13741368 // Add the mediaElement object with the elements sources:
1375 - this.mediaElement = new mediaElement( element );
1376 -
 1369+ this.mediaElement = new mediaElement( element );
 1370+
13771371 },
13781372
13791373 /**
@@ -1431,6 +1425,7 @@
14321426 ) {
14331427 var defaultSize = mw.getConfig( 'videoSize' ).split( 'x' );
14341428 this['width'] = defaultSize[0];
 1429+
14351430 // Special height default for audio tag ( if not set )
14361431 if( element.tagName.toLowerCase() == 'audio' ) {
14371432 this['height'] = 0;
@@ -1464,7 +1459,7 @@
14651460 * If we need to get media sources form an external file
14661461 * that request is issued here
14671462 */
1468 - checkPlayerSources: function( callbackChain ) {
 1463+ checkPlayerSources: function() {
14691464 mw.log( 'f:checkPlayerSources: ' + this.id );
14701465 var _this = this;
14711466 var sourceCount = this.mediaElement.getPlayableSources().length;
@@ -1482,19 +1477,16 @@
14831478 } );
14841479 return ;
14851480 }
1486 - // Check for hooks to handle checkPlayerSources
1487 - if( this.hooks[ 'checkPlayerSources' ].length ) {
1488 - this.runHook( 'checkPlayerSources', function(){
1489 - _this.checkForTimedText();
1490 - });
1491 - } else {
1492 - // no hooks run check for timed text directly
1493 - _this.checkForTimedText();
1494 - }
14951481
 1482+ // Run embedPlayer sources hook
 1483+ $j( this ).trigger ( 'checkPlayerSources', function(){
 1484+ // Continue application flow and check for Timed Text
 1485+ _this.checkForTimedText();
 1486+ });
14961487 },
 1488+
14971489 /**
1498 - * Load Source video info From Api title key ( this.apiTitleKey )
 1490+ * Load Source video info from mediaWiki Api title key ( this.apiTitleKey )
14991491 * @param {Function} callback Function called once loading is complete
15001492 */
15011493 loadSourceFromApi: function( callback ){
@@ -1610,7 +1602,7 @@
16111603 // Auto select player based on default order
16121604 if ( !this.mediaElement.selectedSource ) {
16131605 // check for parent clip:
1614 - if ( typeof this.pc != 'undefined' ) {
 1606+ if ( typeof this.pc != 'undefined' ) {
16151607 mw.log( 'no sources, type:' + this.type + ' check for html' );
16161608 // debugger;
16171609 // do load player if just displaying innerHTML:
@@ -1629,7 +1621,6 @@
16301622 // Inherit the playback system of the selected player:
16311623 this.inheritEmbedPlayer();
16321624 } else {
1633 -
16341625 // No source's playable
16351626 var missingType = '';
16361627 var or = '';
@@ -1637,7 +1628,6 @@
16381629 missingType += or + this.mediaElement.sources[i].mimeType;
16391630 or = ' or ';
16401631 }
1641 -
16421632 // Get from parent playlist if set:
16431633 if ( this.pc ){
16441634 missingType = this.pc.type;
@@ -1780,32 +1770,21 @@
17811771 mw.log( 'updated seek_time_sec: ' + mw.seconds2npt ( this.seek_time_sec ) );
17821772 this.stop();
17831773 this.didSeekJump = true;
1784 -
17851774 // Update the slider
17861775 this.updatePlayHead( percent );
1787 -
1788 - // Do play request in 100ms ( give the dom time to swap out the embed player )
1789 - setTimeout( function() {
1790 - _this.play()
1791 - }, 100 );
17921776 }
 1777+ // Do play request in 100ms ( give the dom time to swap out the embed player )
 1778+ setTimeout( function() {
 1779+ _this.play()
 1780+ }, 100 );
17931781
17941782 // Run the onSeeking interface update
1795 - this.onSeek();
1796 -
1797 - },
 1783+ // NOTE ctrlBuilder should really bind to html5 events rather
 1784+ // than explicitly calling it or inheriting stuff.
 1785+ this.ctrlBuilder.onSeek();
 1786+ },
17981787
17991788 /**
1800 - * function fired once seeking is taking place
1801 - */
1802 - onSeek: function(){
1803 - // Update the interface:
1804 - this.setStatus( gM( 'mwe-seeking' ) );
1805 - // Run the seeking hook
1806 - this.runHook( 'onSeek' );
1807 - },
1808 -
1809 - /**
18101789 * Seeks to the requested time and issues a callback when ready
18111790 * (should be overwritten by client that supports frame serving)
18121791 */
@@ -1839,7 +1818,7 @@
18401819 this.bufferStartFlag = false;
18411820 this.bufferEndFlag = false;
18421821
1843 -
 1822+ // Make sure the player is
18441823 mw.log( 'performing embed for ' + _this.id );
18451824 // mw.log('should embed:' + embed_code);
18461825 _this.doEmbedHTML()
@@ -1851,7 +1830,8 @@
18521831 * On clip done action. Called once a clip is done playing
18531832 */
18541833 onClipDone: function() {
1855 - mw.log( 'base:onClipDone' );
 1834+ mw.log( 'base:onClipDone' );
 1835+
18561836
18571837 // Stop the clip (load the thumbnail etc)
18581838 this.stop();
@@ -1870,11 +1850,11 @@
18711851 }
18721852 // Do the ctrlBuilder onClip done interface
18731853 this.ctrlBuilder.onClipDone();
1874 -
1875 - // Fire the html5 ended binding / event
 1854+
 1855+ // Fire the html5 ended binding
18761856 $j( this ).trigger( 'ended' );
18771857
1878 - //Set the clip done playing count:
 1858+ // Update the clip done playing count:
18791859 this.donePlayingCount ++;
18801860 },
18811861
@@ -1897,8 +1877,8 @@
18981878 // Make sure the ctrlBuilder bindings are up-to-date
18991879 this.ctrlBuilder.addControlHooks();
19001880
1901 - // Once the thumbnail is shown run the mediaReady hook
1902 - this.runHook( 'mediaLoaded' );
 1881+ // Once the thumbnail is shown run the mediaReady trigger
 1882+ $j( this ).trigger( 'mediaLoaded' );
19031883 },
19041884
19051885 /**
@@ -1923,7 +1903,6 @@
19241904 this.ctrlBuilder = new ctrlBuilder( this );
19251905
19261906 var _this = this;
1927 -
19281907 // Make sure we have interface_wrap
19291908 if( $j( this ).parent( '.interface_wrap' ).length == 0 ) {
19301909 // Select "player"
@@ -1966,9 +1945,9 @@
19671946 * @param {String} [misssingType] missing type mime
19681947 */
19691948 showPluginMissingHTML : function( misssingType ) {
1970 - //remove the loading spinner if present:
 1949+ // Remove the loading spinner if present:
19711950 $j('#loadSpiner_' + this.id ).remove();
1972 -
 1951+
19731952 // If the native video is already displayed hide it:
19741953 if( $j( '#' + this.pid ).length != 0 ){
19751954 $j('#loadSpiner_' + this.id ).remove();
@@ -2026,7 +2005,7 @@
20272006 this.mediaElement.updateSourceTimes( start_npt, end_npt );
20282007
20292008 // update mv_time
2030 - this.setStatus( start_npt + '/' + end_npt );
 2009+ this.ctrlBuilder.setStatus( start_npt + '/' + end_npt );
20312010
20322011 // reset slider
20332012 this.updatePlayHead( 0 );
@@ -2178,8 +2157,9 @@
21792158 mw.log( 'embedPlayer:updateThumbnailHTML::' + this.id );
21802159 var thumb_html = '';
21812160 var class_atr = '';
2182 - var style_atr = '';
 2161+ var style_atr = '';
21832162
 2163+
21842164 if( this.useNativeControls() ){
21852165 this.showNativePlayer();
21862166 return ;
@@ -2187,9 +2167,9 @@
21882168
21892169 // Set by default thumb value if not found
21902170 var posterSrc = ( this.poster ) ? this.poster :
2191 - mw.getConfig( 'images_path' ) + 'vid_default_thumb.jpg';
 2171+ mw.getConfig( 'imagesPath' ) + 'vid_default_thumb.jpg';
21922172
2193 - // Poster support is not very good in all browsers
 2173+ // Poster support is not very consistant in browsers
21942174 // use a jpg poster image:
21952175 $j( this ).html(
21962176 $j( '<img />' )
@@ -2204,7 +2184,7 @@
22052185 })
22062186 .addClass( 'playerPoster' )
22072187 );
2208 -
 2188+
22092189 if ( this.controls
22102190 && this.height > this.ctrlBuilder.getComponentHeight( 'playButtonLarge' )
22112191 ) {
@@ -2217,7 +2197,7 @@
22182198 /**
22192199 * Checks if native controls should be used
22202200 *
2221 - * @param [player] Object Optional player object to check controls attribute
 2201+ * @param [player] Object Optional player object to check controls attribute
22222202 * @returns boolean true if the mwEmbed player interface should be used
22232203 * false if the mwEmbed player interface should not be used
22242204 */
@@ -2507,14 +2487,12 @@
25082488 this.doPlayTracking();
25092489 }
25102490
2511 - // Run play hook:
2512 - this.runHook( 'play' );
2513 -
2514 - // If we previusly finished playing this clip run the "replay hook"
 2491+ //Run play hook:
 2492+ $j( this ).trigger( 'onPlay' );
 2493+ // If we previusly finished playing this clip run the "replay hook"
25152494 if( this.donePlayingCount > 0 ){
2516 - this.runHook( 'replay' );
 2495+ $j( this ).trigger( 'onReplay' );
25172496 }
2518 -
25192497 },
25202498
25212499 /**
@@ -2587,7 +2565,7 @@
25882566 this.showThumbnail();
25892567 this.bufferedPercent = 0; // reset buffer state
25902568 this.updatePlayHead( 0 );
2591 - this.setStatus( this.getTimeRange() );
 2569+ this.ctrlBuilder.setStatus( this.getTimeRange() );
25922570 }
25932571
25942572 //Bind play-btn-large play
@@ -2710,14 +2688,13 @@
27112689 if ( parseInt( this.startOffset ) != 0 ) {
27122690 // If start offset include that calculation
27132691 this.updatePlayHead( ( this.currentTime - this.startOffset ) / this.duration );
2714 - var et = ( this.ctrlBuilder.longTimeDisp ) ? '/' + mw.seconds2npt( parseFloat( this.startOffset ) +
2715 - parseFloat( this.duration ) ) : '';
2716 - this.setStatus( mw.seconds2npt( this.currentTime ) + et );
 2692+ var et = ( this.ctrlBuilder.longTimeDisp ) ? '/' + mw.seconds2npt( parseFloat( this.startOffset ) + parseFloat( this.duration ) ) : '';
 2693+ this.ctrlBuilder.setStatus( mw.seconds2npt( this.currentTime ) + et );
27172694 } else {
27182695 this.updatePlayHead( this.currentTime / this.duration );
27192696 // Only include the end time if longTimeDisp is enabled:
27202697 var et = ( this.ctrlBuilder.longTimeDisp ) ? '/' + mw.seconds2npt( this.duration ) : '';
2721 - this.setStatus( mw.seconds2npt( this.currentTime ) + et );
 2698+ this.ctrlBuilder.setStatus( mw.seconds2npt( this.currentTime ) + et );
27222699 }
27232700 }
27242701 // Check if we are "done"
@@ -2729,16 +2706,16 @@
27302707 } else {
27312708 // Media lacks duration just show end time
27322709 if ( this.isStoped() ) {
2733 - this.setStatus( this.getTimeRange() );
 2710+ this.ctrlBuilder.setStatus( this.getTimeRange() );
27342711 } else if ( this.isPaused() ) {
2735 - this.setStatus( gM( 'mwe-paused' ) );
 2712+ this.ctrlBuilder.setStatus( gM( 'mwe-paused' ) );
27362713 } else if ( this.isPlaying() ) {
27372714 if ( this.currentTime && ! this.duration )
2738 - this.setStatus( mw.seconds2npt( this.currentTime ) + ' /' );
 2715+ this.ctrlBuilder.setStatus( mw.seconds2npt( this.currentTime ) + ' /' );
27392716 else
2740 - this.setStatus( " - - - " );
 2717+ this.ctrlBuilder.setStatus( " - - - " );
27412718 } else {
2742 - this.setStatus( this.getTimeRange() );
 2719+ this.ctrlBuilder.setStatus( this.getTimeRange() );
27432720 }
27442721 }
27452722
@@ -2751,14 +2728,13 @@
27522729 }, 250 )
27532730 }
27542731
2755 - this.runHook( 'monitor' );
 2732+ $j( this ).trigger( 'onMonitor' );
27562733 },
27572734
27582735 /**
27592736 * Update the buffer status based on the local bufferedPercent var
27602737 */
27612738 updateBufferStatus: function() {
2762 -
27632739 // Get the buffer target based for playlist vs clip
27642740 $buffer = this.$interface.find( '.mw_buffer' );
27652741
@@ -2778,15 +2754,14 @@
27792755 // if we have not already run the buffer start hook
27802756 if( this.bufferedPercent > 0 && !this.bufferStartFlag ) {
27812757 this.bufferStartFlag = true;
2782 - this.runHook( 'bufferStart' );
 2758+ $j( this ).trigger( 'onBufferStart' );
27832759 }
27842760
27852761 // if we have not already run the buffer end hook
27862762 if( this.bufferedPercent == 1 && !this.bufferEndFlag){
27872763 this.bufferEndFlag = true;
2788 - this.runHook( 'bufferEnd' );
 2764+ $j( this ).trigger( 'onBufferEnd' );
27892765 }
2790 -
27912766 },
27922767
27932768 /**
@@ -2846,7 +2821,7 @@
28472822 this.jump_time = options['start'];
28482823 this.seek_time_sec = mw.npt2seconds( options['start'] );
28492824 // trim output to
2850 - this.setStatus( gM( 'mwe-seek_to', mw.seconds2npt( this.seek_time_sec ) ) );
 2825+ this.ctrlBuilder.setStatus( gM( 'mwe-seek_to', mw.seconds2npt( this.seek_time_sec ) ) );
28512826 mw.log( 'DO update: ' + this.jump_time );
28522827 this.updateThumbTime( rel_start_sec );
28532828 },
@@ -2857,20 +2832,10 @@
28582833 hideHighlight: function() {
28592834 var eid = ( this.pc ) ? this.pc.pp.id:this.id;
28602835 $j( '#mv_seeker_' + eid + ' .mv_highlight' ).hide();
2861 - this.setStatus( this.getTimeRange() );
2862 - },
 2836+ this.ctrlBuilder.setStatus( this.getTimeRange() );
 2837+ },
28632838
2864 - /**
2865 - * Updates the player status that displays short text msgs and the play clock
2866 - * @param {String} value Status string value to update
2867 - */
2868 - setStatus: function( value ) {
2869 - // update status:
2870 - this.$interface.find( '.time-disp' ).html( value );
2871 - },
28722839
2873 -
2874 -
28752840 /**
28762841 * Helper Functions for selected source
28772842 */
@@ -3072,9 +3037,9 @@
30733038 /**
30743039 * Checks if a player is supported by id
30753040 */
3076 - isSupportedPlayer: function( player_id ){
 3041+ isSupportedPlayer: function( playerId ){
30773042 for( var i=0; i < this.players.length; i++ ){
3078 - if( this.players[i].id == player_id ){
 3043+ if( this.players[i].id == playerId ){
30793044 return true;
30803045 }
30813046 }
@@ -3133,26 +3098,26 @@
31343099 /**
31353100 * Sets the format preference.
31363101 *
3137 - * @param {String} mime_format Prefered format
 3102+ * @param {String} mimeFormat Prefered format
31383103 */
3139 - setFormatPreference : function ( mime_format ) {
3140 - this.preference['format_preference'] = mime_format;
 3104+ setFormatPreference : function ( mimeFormat ) {
 3105+ this.preference['format_preference'] = mimeFormat;
31413106 mw.setUserConfig( 'playerPref', this.preference);
31423107 },
31433108
31443109 /**
31453110 * Sets the player preference
31463111 *
3147 - * @param {String} player_id Prefered player id
 3112+ * @param {String} playerId Prefered player id
31483113 * @param {String} mimeType Mime type for the associated player stream
31493114 */
3150 - setPlayerPreference : function( player_id, mimeType ) {
 3115+ setPlayerPreference : function( playerId, mimeType ) {
31513116 var selected_player = null;
31523117 for ( var i = 0; i < this.players.length; i++ ) {
3153 - if ( this.players[i].id == player_id ) {
 3118+ if ( this.players[i].id == playerId ) {
31543119 selected_player = this.players[i];
3155 - mw.log( 'choosing ' + player_id + ' for ' + mimeType );
3156 - this.preference[ mimeType ] = player_id;
 3120+ mw.log( 'choosing ' + playerId + ' for ' + mimeType );
 3121+ this.preference[ mimeType ] = playerId;
31573122 mw.setUserConfig( 'playerPref', this.preference );
31583123 break;
31593124 }
@@ -3211,12 +3176,12 @@
32123177 /**
32133178 * If the browsers supports a given mimetype
32143179 *
3215 - * @param {String} mimetype Mime type for browser plug-in check
 3180+ * @param {String} mimeType Mime type for browser plug-in check
32163181 */
3217 - supportedMimeType: function( mimetype ) {
3218 - for ( var i = navigator.plugins.length; i-- > 0; ) {
 3182+ supportedMimeType: function( mimeType ) {
 3183+ for ( var i =0; i < navigator.plugins.length; i++ ) {
32193184 var plugin = navigator.plugins[i];
3220 - if ( typeof plugin[mimetype] != "undefined" )
 3185+ if ( typeof plugin[ mimeType ] != "undefined" )
32213186 return true;
32223187 }
32233188 return false;
@@ -3226,23 +3191,23 @@
32273192 * Detects what plug-ins the client supports
32283193 */
32293194 detect: function() {
3230 - mw.log( "embedPlayer: running detect" );
 3195+ mw.log( "embedPlayer: running detect" );
32313196 this.players = new mediaPlayers();
32323197 // every browser supports html rendering:
32333198 this.players.addPlayer( htmlPlayer );
3234 - // In Mozilla, navigator.javaEnabled() only tells us about preferences, we need to
3235 - // search navigator.mimeTypes to see if it's installed
3236 - var javaEnabled = navigator.javaEnabled();
3237 - // Some browsers filter out duplicate mime types, hiding some plugins
3238 - var uniqueMimesOnly = $j.browser.opera || $j.browser.safari;
3239 - // Opera will switch off javaEnabled in preferences if java can't be found.
3240 - // And it doesn't register an application/x-java-applet mime type like Mozilla does.
3241 - if ( javaEnabled ) {
3242 - this.players.addPlayer( cortadoPlayer );
3243 - }
 3199+ // In Mozilla, navigator.javaEnabled() only tells us about preferences, we need to
 3200+ // search navigator.mimeTypes to see if it's installed
 3201+ var javaEnabled = navigator.javaEnabled();
 3202+ // Some browsers filter out duplicate mime types, hiding some plugins
 3203+ var uniqueMimesOnly = $j.browser.opera || $j.browser.safari;
 3204+ // Opera will switch off javaEnabled in preferences if java can't be found.
 3205+ // And it doesn't register an application/x-java-applet mime type like Mozilla does.
 3206+ if ( javaEnabled ) {
 3207+ this.players.addPlayer( cortadoPlayer );
 3208+ }
32443209
3245 - // ActiveX plugins
3246 - if ( $j.browser.msie ) {
 3210+ // ActiveX plugins
 3211+ if ( $j.browser.msie ) {
32473212 // check for flash
32483213 if ( this.testActiveX( 'ShockwaveFlash.ShockwaveFlash' ) ) {
32493214 // try to get the flash version for omtk include:

Comments

#Comment by Mdale (talk | contribs)   03:44, 6 May 2010

note this should have been part of the r65977 commit

Status & tagging log