http://www.mediawiki.org/wiki/Special:Code/MediaWiki/73720

Revision: 73720
Author:   dale
Date:     2010-09-25 05:39:21 +0000 (Sat, 25 Sep 2010)

Log Message:
-----------
* stubs for IE activeX swarm transport support

Modified Paths:
--------------
    branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
    branches/MwEmbedStandAlone/modules/SwarmTransport/mw.SwarmTransport.js

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js    
2010-09-25 05:38:34 UTC (rev 73719)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js    
2010-09-25 05:39:21 UTC (rev 73720)
@@ -3545,12 +3545,13 @@
                         // VLC
                         if ( this.testActiveX( 'VideoLAN.VLCPlugin.2' ) ) {
                                 this.players.addPlayer( vlcPlayer );
-                        }
+                        }                       
                                 
                         // Java ActiveX
                         if ( this.testActiveX( 'JavaWebStart.isInstalled' ) ) {
                                 this.players.addPlayer( cortadoPlayer );
                         }
+       
                         // quicktime (currently off) 
                         // if ( this.testActiveX( 
'QuickTimeCheckObject.QuickTimeCheck.1' ) )
                         //     this.players.addPlayer(quicktimeActiveXPlayer); 
                 
@@ -3669,7 +3670,7 @@
        * @param {String} name Name of ActiveXObject to look for 
        */
        testActiveX : function ( name ) {
-               mw.log(" test testActiveX: " + name);
+               mw.log("EmbedPlayer::detect: test testActiveX: " + name);
                var hasObj = true;
                try {
                        // No IE, not a class called "name", it's a variable

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js      
2010-09-25 05:38:34 UTC (rev 73719)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js      
2010-09-25 05:39:21 UTC (rev 73720)
@@ -284,7 +284,7 @@
                                .find( 'canvas')
                                        .get(0) 
                                        .getContext('2d')
-                                       .drawImage( drawElement, 0, 0)          
                
+                                       .drawImage( drawElement, 0, 0);         
        
                        } catch (e){
                                mw.log("Error:: getVideoCanvasThumb : could not 
draw canvas image");
                        }
@@ -310,7 +310,7 @@
                                drawFrame( drawElement );
                                // Remove the temporary node from dom
                                $j( drawElement ).remove();
-                       })                      
+                       });             
                }
        },
        
@@ -337,11 +337,13 @@
         * Hide a smilElement in the layout
         */     
        hideElement: function( smilElement ){
-               // Check that the element is already in the dom
-               var $targetElement = this.$rootLayout.find( '#' + 
this.smil.getSmilElementPlayerID( smilElement ) );
-               if( $targetElement.length ){
-                       // Issue a quick hide request
-                       $targetElement.hide();
+               if( this.$rootLayout ){
+                       // Check that the element is already in the dom
+                       var $targetElement = this.$rootLayout.find( '#' + 
this.smil.getSmilElementPlayerID( smilElement ) );
+                       if( $targetElement.length ){
+                               // Issue a quick hide request
+                               $targetElement.hide();
+                       }
                }
        },
        

Modified: branches/MwEmbedStandAlone/modules/SwarmTransport/mw.SwarmTransport.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SwarmTransport/mw.SwarmTransport.js      
2010-09-25 05:38:34 UTC (rev 73719)
+++ branches/MwEmbedStandAlone/modules/SwarmTransport/mw.SwarmTransport.js      
2010-09-25 05:39:21 UTC (rev 73720)
@@ -19,7 +19,7 @@
                        // Setup the "embedCode" binding to swap in an updated 
url                      
                        $j( embedPlayer ).bind( 'checkPlayerSourcesEvent', 
function( event, callback ) {                
                                // Confirm SwarmTransport add-on is available ( 
defines swarmTransport var )  
-                               if( typeof window['swarmTransport'] != 
'undefined' ){                                   
+                               if( _this.getPluginLibrary() ){                 
                
                                        // Add the swarm source
                                        mw.log(" SwarmTransport :: 
checkPlayerSourcesEvent " + swapedPlayerId);
                                        _this.addSwarmSource( embedPlayer, 
function(){
@@ -36,10 +36,7 @@
                        // Check if we have a "recommend" binding and provide 
an xpi install link                       
                        mw.log('SwarmTransport::bind:addControlBindingsEvent');
                        $j( embedPlayer ).bind( 'addControlBindingsEvent', 
function(){
-                               if( mw.getConfig( 'SwarmTransport.Recommend' ) 
&&  
-                                       typeof window['swarmTransport'] == 
'undefined' &&
-                                       $j.browser.mozilla ) 
-                               {
+                               if( mw.getConfig( 'SwarmTransport.Recommend' )  
&& _this.getPluginLibrary() ){
                                        
embedPlayer.controlBuilder.doWarningBindinng( 
                                                'recommendSwarmTransport',
                                                _this.getRecomendSwarmMessage() 
                                        
@@ -52,17 +49,30 @@
                
                // Add the swarmTransport player to available player types: 
                $j( mw ).bind( 'EmbedPlayerManagerReady', function( event ) {
+                       var playerLib = _this.getPluginLibrary();
                        // Add the swarmTransport playerType    
-                       
mw.EmbedTypes.players.defaultPlayers['video/swarmTransport'] = ['Native'];
+                       
mw.EmbedTypes.players.defaultPlayers['video/swarmTransport'] = [ playerLib ];
                        
                        // Build the swarm Transport Player
-                       var swarmTransportPlayer = new mediaPlayer( 
'swarmTransportPlayer', ['video/swarmTransport' ], 'Native' );
+                       var swarmTransportPlayer = new mediaPlayer( 
'swarmTransportPlayer', ['video/swarmTransport' ], playerLib );
                        
                        // Add the swarmTransport "player"
                        mw.EmbedTypes.players.addPlayer( swarmTransportPlayer 
);        
                });
                                        
        },
+       // check if the swam player exists and return its associated player 
library 
+       getPluginLibrary: function(){
+               // Check for swarmTransport global in javascript ( firefox ) 
+               if( typeof window['swarmTransport'] != 'undefined' ){
+                       return 'Native';
+               }
+               // Look for swarm player:
+               if( mw.EmbedTypes.testActiveX( 'P2PNext.SwarmPlayer' ) ){
+                       return 'Vlc';
+               }
+               return false;
+       },
        
        addSwarmSource: function( embedPlayer, callback ) {
                var _this = this;



_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to