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

Revision: 74011
Author:   dale
Date:     2010-09-30 02:30:06 +0000 (Thu, 30 Sep 2010)

Log Message:
-----------
minor fixes to add media wizard, temp stopped ui binding, sync with kaltura svn 
updates. 

Modified Paths:
--------------
    branches/MwEmbedStandAlone/ResourceLoader.php
    branches/MwEmbedStandAlone/includes/noMediaWikiConfig.php
    branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js
    branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
    branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
    branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerHtml.js
    branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerJava.js
    branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js
    branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js
    branches/MwEmbedStandAlone/modules/Playlist/mw.PlaylistHandlerMediaRss.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js
    
branches/MwEmbedStandAlone/modules/SwarmTransport/tests/SwarmTransprot_Url.html
    branches/MwEmbedStandAlone/mwEmbed.js
    branches/MwEmbedStandAlone/skins/common/mw.style.mwCommon.css

Modified: branches/MwEmbedStandAlone/ResourceLoader.php
===================================================================
--- branches/MwEmbedStandAlone/ResourceLoader.php       2010-09-30 02:25:24 UTC 
(rev 74010)
+++ branches/MwEmbedStandAlone/ResourceLoader.php       2010-09-30 02:30:06 UTC 
(rev 74011)
@@ -16,14 +16,19 @@
 
 // Check if we are an entry point or being used as part of MEDIAWIKI:
 if ( !defined( 'MEDIAWIKI' ) && !defined( 'SCRIPTLOADER_MEDIAWIKI') ) {
+       // Load stand alone Resource Loader config
+       // ( if running as a remote, mediaWiki variables / functions are 
already included as part of mediaWiki )
+       require_once( realpath( dirname( __FILE__ ) ) . 
'/includes/noMediaWikiConfig.php' );
+
+    // Allow an installation an optional PHP customization/overrides file
+       if ( is_file ( dirname( __FILE__ ) .'/../localSettings.php' ) ) {
+         require_once dirname( __FILE__ ) .'/../localSettings.php';
+       }
+
        $myResourceLoader = new ResourceLoader();
        if( $myResourceLoader->outputFromCache() ) {
                exit();
        }
-       // No cache hit, load stand alone Resource Loader config
-
-       // ( if running as a remote, mediaWiki variables / functions are 
already included as part of mediaWiki )
-       require_once( realpath( dirname( __FILE__ ) ) . 
'/includes/noMediaWikiConfig.php' );
        $myResourceLoader->doResourceLoader();
 }
 

Modified: branches/MwEmbedStandAlone/includes/noMediaWikiConfig.php
===================================================================
--- branches/MwEmbedStandAlone/includes/noMediaWikiConfig.php   2010-09-30 
02:25:24 UTC (rev 74010)
+++ branches/MwEmbedStandAlone/includes/noMediaWikiConfig.php   2010-09-30 
02:30:06 UTC (rev 74011)
@@ -82,10 +82,12 @@
        return false;
 }
 
-function wfTempDir(){
-       return realpath( dirname( __FILE__ ) ) . '/includes/cache';
+if (!function_exists('wfTempDir'))
+{
+       function wfTempDir(){
+               return realpath( dirname( __FILE__ ) ) . '/includes/cache';
+       }
 }
-
 /**
  * Make directory, and make all parent directories if they don't exist
  *

Modified: branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js
===================================================================
--- branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js        
2010-09-30 02:25:24 UTC (rev 74010)
+++ branches/MwEmbedStandAlone/modules/AddMedia/mw.RemoteSearchDriver.js        
2010-09-30 02:30:06 UTC (rev 74011)
@@ -280,7 +280,7 @@
                        'apiUrl':  ( wgServer && wgScriptPath ) ? 
                                wgServer + wgScriptPath + '/api.php' : null,    
                
                        
-                       'detailsUrl' :  wgServer + wgArticlePath,
+                       'detailsUrl' :  ( wgServer &&  wgArticlePath )? 
wgServer + wgArticlePath : null,
                        
                        'lib': 'mediaWiki',
                        'homepage' : ( wgServer && wgScript ) ? 
@@ -866,8 +866,8 @@
                        bgiframe: true,
                        autoOpen: true,
                        modal: true,
-                       width: $j(window).width()-10,
-                       height: $j(window).height()-10,
+                       width: $j(window).width()-50,
+                       height: $j(window).height()-50,
                        position : 'center',
                        draggable: false,
                        resizable: false,
@@ -2029,7 +2029,7 @@
                                'position' : 'absolute',
                                'top' : '0px',
                                'left' : '0px', 
-                               'bottom' : '0px',
+                               'bottom' : '30px',
                                'right' : '4px',
                                'background-color' : '#FFF'
                        } )

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js    2010-09-30 
02:25:24 UTC (rev 74010)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js    2010-09-30 
02:30:06 UTC (rev 74011)
@@ -177,10 +177,10 @@
                                // Add JSON lib if browsers does not define 
"JSON" natively
                                'JSON',
                                '$j.ui',
-                               '$j.widget',
-                               '$j.ui.mouse'
+                               '$j.widget'
                        ],
-                       [                                                       
+                       [                               
+                               '$j.ui.mouse',
                                '$j.fn.menu',                   
                                'mw.style.jquerymenu',
                                '$j.ui.slider'

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js    
2010-09-30 02:25:24 UTC (rev 74010)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js    
2010-09-30 02:30:06 UTC (rev 74011)
@@ -12,11 +12,10 @@
  */
  
 mw.includeAllModuleMessages();
-
 /*
 * The default video attributes supported by embedPlayer
 */ 
-mw.setConfig( 'EmbedPlayer.Attributes', {
+mw.setDefaultConfig( 'EmbedPlayer.Attributes', {
        /* 
        * Base html element attributes: 
        */      
@@ -231,10 +230,14 @@
                        attributes = {};
                }
                
-               
-               // If we are dynamically embedding on a "div" check if we can 
-               // add a poster image behind the loader:
                $j( playerSelect ).each( function( index, playerElement) {      
                                
+                       // make sure the playerElement has an id: 
+                       if( $j( playerElement ).attr('id') =='' ){
+                               $j( playerElement ).attr( "id",  'mwe_v' + ( 
index ) );
+                       }
+                       
+                       // If we are dynamically embedding on a "div" check if 
we can 
+                       // add a poster image behind the loader:
                        if( playerElement.nodeName.toLowerCase() == 'div' 
                                && ( attributes.poster || 
$j(playerElement).attr( 'poster' ) ) ){
                                var posterSrc =  ( attributes.poster ) ? 
attributes.poster : $j(playerElement).attr( 'poster' );
@@ -402,7 +405,7 @@
                        // Let extensions determine if its worthwhile to wait 
for metadata:
                        // We pass an object to the trigger to preserve 
reference values                
                        var eventObject = { 
-                               'playerElement':playerElement, 
+                               'playerElement' : playerElement, 
                                'waitForMeta' : waitForMeta
                        };                      
                        $j( mw ).trigger( 'addElementWaitForMetaEvent', 
eventObject );
@@ -426,13 +429,21 @@
                                ranPlayerSwapFlag = true;       
                                mw.log("EmbedPlayer::runPlayerSwap::" + $j( 
playerElement ).attr('id') );
                                
-                               var playerInterface = new mw.EmbedPlayer( 
playerElement , attributes);
+                               var playerInterface = new mw.EmbedPlayer( 
playerElement , attributes);                          
+                               var swapPlayer = _this.swapEmbedPlayerElement( 
playerElement, playerInterface );                                               
                 
                                
-                               _this.swapEmbedPlayerElement( playerElement, 
playerInterface );                                                         
-                                                                               
+                               // Copy over any data attributes from the 
playerElement 
+                               if( mw.getConfig( 'EmbedPlayer.DataAttributes' 
) ) {
+                                       var dataAttr = mw.getConfig( 
'EmbedPlayer.DataAttributes' )
+                                       for( var i in dataAttr ){
+                                               if( $j( playerElement ).data( i 
) ){
+                                                       $j( '#' + 
playerInterface.id ).data( i, $j( playerElement ).data( i ) );
+                                               }
+                                       }
+                               }
                                
                                // Pass the id to any hook that needs to 
interface prior to checkPlayerSources
-                               mw.log("EmbedPlayer::addElement :trigger :: 
newEmbedPlayerEvent");
+                               mw.log("EmbedPlayer::addElement :trigger " + 
playerInterface.id );
                                $j( mw ).trigger ( 'newEmbedPlayerEvent',  
playerInterface.id );
                                
                                // Issue the checkPlayerSources call to the new 
player interface:
@@ -546,7 +557,7 @@
                // Create a new element to swap the player interface into
                var swapPlayerElement = document.createElement('div');          
                
                                
-               // get properties / methods from playerInterface
+               // Get properties / methods from playerInterface
                for ( var method in playerInterface ) {                 
                        if ( method != 'readyState' ) { // readyState crashes 
IE ( don't include )                      
                                swapPlayerElement[ method ] = playerInterface[ 
method ];
@@ -554,13 +565,13 @@
                }
                
                // Check if we are using native controls ( should keep the 
video embed around )
-               if( playerInterface.shouldUseNativeControls() ) {
+               if( playerInterface.useNativePlayerControls() ) {
                        $j( targetElement )
-                       .attr('id', playerInterface.pid )
+                       .attr( 'id', playerInterface.pid )
                        .addClass( 'nativeEmbedPlayerPid' )
                        .show()
                        .after( 
-                               $j( swapPlayerElement ).css('display', 'none')
+                               $j( swapPlayerElement ).css( 'display', 'none' )
                        )
                } else {
                        $j( targetElement ).replaceWith( swapPlayerElement );
@@ -575,7 +586,7 @@
                
                // If we don't already have a loadSpiner add one: 
                if( $j('#loadingSpinner_' + playerInterface.id ).length == 0 ){
-                       if( playerInterface.shouldUseNativeControls() ) {
+                       if( playerInterface.useNativePlayerControls() ) {
                                $j( targetElement )
                                        .getAbsoluteOverlaySpinner()
                                        .attr('id', 'loadingSpinner_' + 
playerInterface.id ) 
@@ -586,7 +597,7 @@
                                );
                        }
                }
-               return true;
+               return swapPlayerElement;
        },
        
        
@@ -862,7 +873,7 @@
                
                // Return the mime type string if not known type.
                return this.mimeType;
-       },      
+       },
        
        /** 
         * 
@@ -1357,7 +1368,7 @@
                }               
                
                var playerAttributes = mw.getConfig( 'EmbedPlayer.Attributes' 
);                
-               // Setup the player Interface from supported attributes:
+               // Setup the player Interface from supported attributes:        
        
                for ( var attr in playerAttributes ) {
                        if ( customAttributes[ attr ] || customAttributes[ attr 
] === false ) {
                                this[ attr ] = customAttributes[ attr ];
@@ -1374,14 +1385,14 @@
                        // string -> boolean
                        if( this[ attr ] == "false" ) this[attr] = false;
                        if( this[ attr ] == "true" ) this[attr] = true;
-               }
+               }               
                
                if( this.apiTitleKey ){
                        this.apiTitleKey = unescape( this.apiTitleKey );
                }
                                
                // Hide "controls" if using native player controls: 
-               if( this.shouldUseNativeControls() ){
+               if( this.useNativePlayerControls() ){
                        _this.controls = false;
                }
                
@@ -1607,9 +1618,19 @@
                        finishCheckPlayerSources();
                }
        },
+       /**
+        * Insert and play a video source ( useful for ads or bumper videos )
+        * 
+        * Only works while video is in active play back.
+        * Only tested with native playback atm.   
+        */
+       insertAndPlaySource: function( source ){
+               mw.log("Error: only native playback supports 
insertAndPlaySource right now");
+       },
        
        /**
        * Load Source video info from mediaWiki Api title key (  
this.apiTitleKey )
+       * @@todo move this to mediaWiki 'api' module
        * @param {Function} callback Function called once loading is complete
        */
        loadSourceFromApi: function( callback ){
@@ -2023,7 +2044,7 @@
                this.controlBuilder.addControlBindings();
                
                // Once the thumbnail is shown run the mediaReady trigger (if 
not using native controls)
-               if( !this.shouldUseNativeControls() ){
+               if( !this.useNativePlayerControls() ){
                        mw.log("mediaLoaded");
                        $j( this ).trigger( 'mediaLoaded' );
                }
@@ -2301,7 +2322,7 @@
                var style_atr = '';
                
                
-               if( this.shouldUseNativeControls() ){
+               if( this.useNativePlayerControls() ){
                        this.showNativePlayer();
                        return ;
                }               
@@ -2342,7 +2363,7 @@
         * @returns boolean true if the mwEmbed player interface should be used
         *                                      false if the mwEmbed player 
interface should not be used
         */
-       shouldUseNativeControls: function() {           
+       useNativePlayerControls: function() {           
                if( this.usenativecontrols === true ){
                        return true;
                }
@@ -2483,6 +2504,7 @@
                } else if( this.apiTitleKey ) {                 
                        iframeUrl += 'apiTitleKey=' + escape( this.apiTitleKey 
) + '&';
                        if ( this.apiProvider ) {
+                               // Commons always uses the commons api provider 
( special hack should refactor ) 
                                if( mw.parseUri( document.URL ).host == 
'commons.wikimedia.org'){
                                         this.apiProvider = 'commons';
                                }
@@ -2645,9 +2667,8 @@
        * Starts the "monitor" 
        */
        play: function() {
-               var _this = this;
-               mw.log( "EmbedPlayer:: play" );         
-         
+               var _this = this;                       
+               mw.log( "EmbedPlayer:: play" );                   
                // Hide any overlay:
                this.controlBuilder.closeMenuOverlay();
                
@@ -2669,7 +2690,7 @@
                 // Run play hook (if we were previously in paused state ) 
                if( this.paused ){
                        this.paused = false;
-                       mw.log("trigger play event::");
+                       mw.log("trigger play event::");                 
                        $j( this ).trigger( 'play' );
                }
                
@@ -2714,12 +2735,13 @@
        *  must be overwritten by embed object to support this functionality.
        */
        pause: function( event ) {
-               var _this = this;       
+               var _this = this;
+
                // only trigger the pause event if not already in paused state: 
                if( this.paused === false ){
                        this.paused = true;
                        mw.log('EmbedPlayer:trigger pause');
-                       $j( this ).trigger('pause');
+                       //$j( this ).trigger('pause' );
                }               
                                
                // update the ctrl "paused state"                               
@@ -2747,7 +2769,7 @@
        */
        stop: function() {
                var _this = this;
-               mw.log( 'mvEmbed:stop:' + this.id );                    
+               mw.log( 'EmbedPlayer::stop:' + this.id );                       
                
                // no longer seeking:
                this.didSeekJump = false;
@@ -2808,7 +2830,7 @@
        * Update volume function ( called from interface updates )
        * @param {float} percent Percent of full volume
        */
-       setVolume: function( percent, dissableTrigger ) {
+       setVolume: function( percent ) {
                // ignore NaN percent:
                if( isNaN( percent ) ){
                        return ;

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerHtml.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerHtml.js        
2010-09-30 02:25:24 UTC (rev 74010)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerHtml.js        
2010-09-30 02:30:06 UTC (rev 74011)
@@ -92,8 +92,8 @@
        * @param {Float} perc Percentage to seek into the virtual player
        * @param {Function} callback Function called once time has been updated
        */
-       setCurrentTime:function( perc, callback ) {
-               this.pauseTime = perc * this.getDuration();
+       setCurrentTime:function( time, callback ) {
+               this.pauseTime = time;
                if( callback )
                        callback();
        },

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerJava.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerJava.js        
2010-09-30 02:25:24 UTC (rev 74010)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerJava.js        
2010-09-30 02:30:06 UTC (rev 74011)
@@ -220,7 +220,7 @@
                this.parent_play();
                if ( this.playerElement ) {
                        try{
-                       this.playerElement.play();
+                               this.playerElement.play();
                        }catch( e ){
                                mw.log("EmbedPlayerJava::Could not issue play 
request");
                        }

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js      
2010-09-30 02:25:24 UTC (rev 74010)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js      
2010-09-30 02:30:06 UTC (rev 74011)
@@ -40,6 +40,9 @@
                'volumeControl' : true,         
                'overlays' : true
        },      
+       
+       insertAndPlayingConfig : false,
+       
        /** 
         * updates the supported features given the "type of player" 
         */
@@ -64,7 +67,7 @@
                mw.log( "native play url:" + this.getSrc() + ' startOffset: ' + 
this.start_ntp + ' end: ' + this.end_ntp );
                
                // Check if using native controls and already the "pid" is 
already in the DOM
-               if( this.shouldUseNativeControls() && $j( '#' + this.pid 
).length &&
+               if( this.useNativePlayerControls() && $j( '#' + this.pid 
).length &&
                        typeof $j( '#' + this.pid ).get(0).play != 'undefined' 
) {
                        _this.postEmbedJS();
                        return ;
@@ -205,9 +208,8 @@
                mw.log( 'Native::doSeek p: ' + percentage + ' : '  + 
this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + 
this.seek_time_sec );
                this.seeking = true;
                // Run the seeking hook
-               $j( this.embedPlayer ).trigger( 'onSeek' );
+               $j( this.embedPlayer ).trigger( 'onSeek' );             
                
-               
                // Run the onSeeking interface update
                this.controlBuilder.onSeek();
                
@@ -239,12 +241,81 @@
                mw.log( 'native::doNativeSeek::' + percentage );
                this.seeking = true;
                this.seek_time_sec = 0;         
-               this.doSeekedCallback( ( percentage * this.duration ) , 
function(){
+               this.setCurrentTime( ( percentage * this.duration ) , 
function(){
                        _this.seeking = false;
                        _this.monitor();
-               })
+               })                      
+       },
+       
+       insertAndPlaySource: function( src , options ){
+               mw.log("NativeEmbed:: insertAndPlaySource: " + src  + ' 
insertAndPlayingConfig:' + this.insertAndPlayingConfig);
+               if(!options)
+                       options = {};
                
+               if( options.lockUI  ){
+                       this.playerElement.controls = false;
+               }
+               
+               // Make sure to capture the original source
+               if(! this.insertAndPlayingConfig ){
+                       //alert( 'setup this.insertAndPlayingConfig ');
+                       this.insertAndPlayingConfig = {
+                               'src' : this.getSrc(),
+                               'time' : this.currentTime,
+                               'callback' : options.callback,
+                               'restoreControls' : options.lockUI
+                       }
+               }
+               // Try to directly playback the source 
+               this.switchSrc( src );
+               
        },
+       restoreSourcePlayback: function( ){
+               var _this = this;
+               mw.log( "RestoreSourcePlayback:: empty out 
insertAndPlayingConfig" );           
+               if( !this.insertAndPlayingConfig) {
+                       mw.log("Error: called restored playback with empty 
insertAndPlayingConfig")
+                       return;
+               }                       
+               this.switchSrc( this.insertAndPlayingConfig.src );              
+               //this.playerElement.play();
+               // Remove insert and playing config flag
+               this.insertAndPlayingConfig = false;                            
+               
+               var time = this.insertAndPlayingConfig.time;
+               var callback = this.insertAndPlayingConfig.callback;
+               
+               // run the seek: 
+               this.setCurrentTime( time ,function(){                  
+                       if( this.insertAndPlayingConfig.restoreControls ){
+                               this.playerElement.controls = true;
+                       }                       
+               });
+               // Give some time for ipad to figure out whats going on: 
+               setTimeout(function(){                  
+                       _this.playerElement.load();
+                       _this.playerElement.play();
+               },100);
+                       
+               //alert("insertAndPlayingConfig:: " + 
this.insertAndPlayingConfig);
+               // Run the callback 
+               if( callback ){
+                       callback();
+               }
+       },
+       switchSrc: function( src ){
+               mw.log( 'switchSrc' )
+               if( this.getPlayerElement() ){
+                       try{
+                               //this.playerElement.pause();
+                               this.playerElement.src = src;           
+                               this.playerElement.load();
+                               this.playerElement.play();
+                       } catch( e ){
+                               mw.log("Error: possible error in swiching 
source playback");
+                       }
+               }
+       },
        
        /**
        * Seek in a existing stream
@@ -281,37 +352,36 @@
        * @param {Float} position Seconds to set the time to
        * @param {Function} callback Function called once time has been set. 
        */
-       setCurrentTime: function( position , callback ) {       
-               var _this = this;
-               //mw.log( 'native:setCurrentTime::: ' + position + ' :  dur: ' 
+ _this.getDuration() );
-               this.getPlayerElement();
-               if ( !this.playerElement ) {
-                       this.load( function() {                         
-                               _this.doSeekedCallback( position, callback );   
        
-                       } );
-               } else {
-                       _this.doSeekedCallback( position, callback );           
-               }
-       },
-       
-       /**
-       * Do the seek request with a callback
-       * 
-       * @param {Float} position Position in seconds
-       * @param {Function} callback Function to call once seeking completes
-       */
-       doSeekedCallback : function( position, callback ) {
+       setCurrentTime: function( time , callback, callbackCount ) {    
                var _this = this;                       
+               if( !callbackCount )
+                       callbackCount = 0;
                this.getPlayerElement();                
-               var once = function( event ) {                  
-                       callback();
-                       _this.playerElement.removeEventListener( 'seeked', 
once, false );
-               };              
-               // Assume we will get to add the Listener before the seek is 
done
-               _this.playerElement.currentTime = position;
-               _this.playerElement.addEventListener( 'seeked', once, false );  
                                        
+               if( _this.playerElement.readyState >= 1 ){
+                       if( _this.playerElement.currentTime == time ){
+                               callback();
+                               return; 
+                       }                       
+                       var once = function( event ) {          
+                               if( callback ){
+                                       callback();
+                               }
+                               _this.playerElement.removeEventListener( 
'seeked', once, false );
+                       };                              
+                       // Assume we will get to add the Listener before the 
seek is done               
+                       _this.playerElement.addEventListener( 'seeked', once, 
false );
+                       _this.playerElement.currentTime = time;
+               } else {                        
+                       if( callbackCount >= 300 ){
+                               mw.log("Error with seek request, media never in 
ready state");
+                               return ; 
+                       }
+                       setTimeout( function(){
+                               _this.setCurrentTime( time, callback , 
callbackCount++);
+                       }, 10 );
+               }
        },
-       
+
        /**
        * Get the embed player time
        */
@@ -343,11 +413,13 @@
        * Pause the video playback
        * calls parent_pause to update the interface
        */
-       pause: function() {
-               this.getPlayerElement();
+       pause: function( ) {
+               this.getPlayerElement();                
                this.parent_pause(); // update interface                
                if ( this.playerElement ) { // update player
-                       this.playerElement.pause();
+                       if( !this.playerElement.paused ){
+                               this.playerElement.pause();
+                       }
                }
        },
        
@@ -355,11 +427,15 @@
        * Play back the video stream
        *  calls parent_play to update the interface
        */
-       play: function() {
-               this.getPlayerElement();
+       play: function( ) {
+                       
+               this.getPlayerElement();                
                this.parent_play(); // update interface
                if ( this.playerElement && this.playerElement.play ) {
-                       this.playerElement.play();
+                       // issue a play request if the media is paused:
+                       if( this.playerElement.paused ){
+                               this.playerElement.play();
+                       }
                        // re-start the monitor: 
                        this.monitor();
                }
@@ -508,18 +584,17 @@
        * Handle the native paused event
        */ 
        onPaused: function(){
-               mw.log( "embedPlayer:native:paused" );
-               this.pause();           
+               mw.log( "EmbedPlayer:native: OnPaused" );
+               this.parent_pause();    
        },
        
        /**
        * Handle the native play event 
        */
        onPlay: function(){
-               mw.log("embedPlayer:native::play");
-               if( !this.isPlaying () ){
-                       this.play();
-               }
+               mw.log("EmbedPlayer:native:: OnPlay");          
+               // Update the interface
+               this.parent_play();
        },
        
        /**     
@@ -568,8 +643,15 @@
        *  Used to update the bufferedPercent
        */      
        onended: function() {
-               var _this = this;
-               mw.log( 'EmbedPlayer:native:onended:' + 
this.playerElement.currentTime + ' real dur:' +  this.getDuration() );          
        
+               var _this = this;       
+               mw.log( 'EmbedPlayer:native: onended:' + 
this.playerElement.currentTime + ' real dur:' +  this.getDuration() +
+                               ' insertAndPlayingConfig: ' + 
this.insertAndPlayingConfig);
+               
+               if( this.insertAndPlayingConfig ){
+                       this.restoreSourcePlayback();
+                       this.insertAndPlayingConfig = false;
+                       return ;
+               }                       
                this.onClipDone();
        }
 };

Modified: branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js  2010-09-30 
02:25:24 UTC (rev 74010)
+++ branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js  2010-09-30 
02:30:06 UTC (rev 74011)
@@ -129,10 +129,10 @@
                                );
                                $j( _this.target ).append( $plListContainer );
                                
-                               var $plListSet = $j( _this.target ).find(  
'.playlistSet-list' );
+                               var $plListSet = $j( _this.target ).find( 
'.playlistSet-list' );
                                
                                $j.each( playlistSet, function( inx, playlist){
-                                       // add a divider
+                                       // Add a divider
                                        if( inx != 0 ){
                                                $plListSet.append( $j('<span 
/>').text( ' | ') )
                                        }
@@ -264,7 +264,7 @@
                                        var myScroll = iScroll( _this.id + 
'_videolist' );              
                                        setTimeout(function () { 
myScroll.refresh(); }, 0);
                                        */ 
-                                       // add space for scroll buttons: 
+                                       // Add space for scroll buttons: 
                                        var curTop = $j( _this.target + ' 
.media-rss-video-list' ).css('top');
                                        if(!curTop) curTop = '0px';
                                        $j( _this.target + ' 
.media-rss-video-list' ).css( {
@@ -276,7 +276,7 @@
                                        })
                                        if( _this.layout == 'vertical' ){
                                                $j( _this.target + ' 
.media-rss-video-list' ).css({
-                                                       'top' :  $j( 
_this.target + ' .media-rss-video-player' ).height()                            
                           
+                                                       'top' :  $j( 
_this.target + ' .media-rss-video-player' ).height() + 8                        
                           
                                                })
                                        }
                                        // Add scroll buttons:
@@ -404,17 +404,19 @@
                
                // Build the video tag object: 
                var $video = $j( '<video />' )
-                       .attr({
-                               'id' : 'mrss_' + this.id + '_' + clipIndex,
-                               'poster' : _this.sourceHandler.getClipPoster( 
clipIndex ) 
-                       })
-                       .addClass( 'mwPlaylist' )
-                       .css(
-                               playerSize
-                       )
-                       // Add custom attributes: 
-                       .attr(  _this.sourceHandler.getCustomClipAttributes( 
clipIndex ) );
+               .attr({
+                       'id' : _this.getVideoPlayerId( clipIndex ),
+                       'poster' : _this.sourceHandler.getClipPoster( clipIndex 
) 
+               })
+               .addClass( 'mwPlaylist' )
+               .css(
+                       playerSize
+               )
                
+               // Add custom attributes: 
+               _this.sourceHandler.applyCustomClipData( $video, clipIndex );
+               
+               
                // lookup the sources from the playlist provider:               
                this.sourceHandler.getClipSources( clipIndex, function( 
clipSources ){                  
                        if( clipSources ){
@@ -424,39 +426,61 @@
                                        $video.append( $source );
                                }
                        }                       
-                       _this.addVideoPlayer( $video , callback);
+                       _this.updateVideoPlayer( $video , callback);
                });
        },
        
-       addVideoPlayer: function( $video , callback){
-               var _this = this;
+       getVideoPlayerId: function( clipIndex ){
+               if( ! clipIndex ) {
+                       clipIndex = this.clipIndex;
+               }
+               return 'mrss_' + this.id + '_' + clipIndex;
+       },
+       
+       updateVideoPlayer: function( $video , callback){
+               var _this = this;               
                // If on mobile safari just swap the sources ( don't replace 
the video ) 
                // ( mobile safari can't javascript start the video ) 
                // see: 
http://developer.apple.com/iphone/search/search.php?simp=1&num=10&Search=html5+autoplay
-               var addVideoPlayerToDom = true;                         
-               if( mw.isMobileHTML5() ){
+               var updateVideoPlayerToDom = true;                      
+               
+               if( mw.isMobileHTML5() ){       
                        // Check for a current video:   
                        var $inDomVideo = $j( _this.target + ' 
.media-rss-video-player video' );                        
                        if( $inDomVideo.length == 0 ){
-                               addVideoPlayerToDom= true;
+                               updateVideoPlayerToDom = true;
                        } else {
-                               addVideoPlayerToDom = false;
+                               updateVideoPlayerToDom = false;
                                // Update the inDomVideo object:
-                               // NOTE: this hits a lot of internal stuff 
should !  
+                               // NOTE: this hits a lot of internal stuff 
                                // XXX Should refactor to use embedPlayer 
interfaces!
                                var vidInterface = $j( _this.target + ' 
.media-rss-video-player' ).find('.mwplayer_interface div').get(0)
-                               vidInterface.id = $video.attr('id');
+                               // Copy over the video attributes to the the 
videoInterface 
+                               $j( $video[0].attributes ).each( 
function(attrName, attrValue){                                         
+                                       vidInterface[ attrName ] = attrValue;
+                               })
                                vidInterface.pid = 'pid_' + $video.attr('id');
-                               vidInterface.duration = null;
-                               if( $video.attr('kentryid') ){                  
                        
-                                       vidInterface.kentryid = 
$video.attr('kentryid');
+                               // Update the interface restore source ( xxx 
this is a pretty ugly hack )
+                               vidInterface.mediaElement.sources = [];
+                               $video.find('source').each(function(inx, 
source){
+                                       vidInterface.mediaElement.tryAddSource( 
source ) ;
+                               });                              
+                               
+                               // Update the video interface id: 
+                               $j(  vidInterface ).attr('id', 
$video.attr('id'));                                      
+                               
+                               
+                               if( $video.data('kuiconf') ){
+                                       $j( vidInterface ).data( 'kuiconf', 
$video.data('kuiconf') )
                                }
+                               
                                // Update the current video target source
                                $inDomVideo.attr({
                                        'id' : 'pid_' + $video.attr('id'),
                                        'src':  $video.find( 
'source').attr('src') 
                                });
-                               
+                               // issue the load request 
+                               $inDomVideo.get(0).load();
                        }
                } else {
                        // Remove the old video player ( non-mobile safari ) 
@@ -464,16 +488,18 @@
                        $j( _this.target + ' .media-rss-video-player' ).remove( 
'video' );
                }
                
-               if( addVideoPlayerToDom ) {
+               if( updateVideoPlayerToDom ) {
                        // replace the video: 
                        $j( _this.target + ' .media-rss-video-player' ).append( 
$video );
                }
                
                // Update the video tag with the embedPlayer
-               $j.embedPlayers( function(){                                    
        
+               $j.embedPlayers( function(){                            
+                       var embedPlayer =  $j('#' +_this.getVideoPlayerId( 
_this.clipIndex ) ).get(0);  
+                               
                        // Setup ondone playing binding to play next clip (if 
autoContinue is true )                    
                        if( _this.sourceHandler.autoContinue == true ){
-                               $j( '#mrss_' + _this.id + '_' + _this.clipIndex 
).unbind('ended').bind( 'ended', function(event, onDoneActionObject ){          
                                                                
+                               $j( embedPlayer ).unbind('ended').bind( 
'ended', function(event, onDoneActionObject ){                                  
                                        
                                        // Play next clip
                                        if( _this.clipIndex + 1 < 
_this.sourceHandler.getClipCount() ){
                                                // Update the onDone action 
object to not run the base control done: 
@@ -492,6 +518,7 @@
                                        }
                                })
                        }
+                       mw.log("player should be readY: " + _this.clipIndex + ' 
' + $j('#' +_this.getVideoPlayerId() ) );
                        // Run the callback if its set
                        if( callback ){
                                callback();
@@ -561,11 +588,19 @@
                        } )
                        .click( function(){
                                mw.log( 'clicked on: ' + $j( this ).data( 
'clipIndex') ); 
+                               // Make sure the existing player is "playing " 
(safari can't play async with javascript )
+                               /*if( mw.isMobileHTML5() ){                     
+                                       var embedPlayer = $j('#' + 
_this.getVideoPlayerId() ).get(0);
+                                       //embedPlayer.playerElement.play();
+                               }*/                             
+                               
                                // Update _this.clipIndex
                                _this.clipIndex = $j( this ).data( 'clipIndex' 
);
+                                       
                                _this.updatePlayer( _this.clipIndex, function(){
                                        _this.play();
                                } );
+                               
                        }) //close $itemBlock
 
                        // Add the itemBlock to the targetItem list
@@ -574,22 +609,17 @@
                        )
                        mw.log("added item block : " + 
$targetItemList.children().length );
                });
-       },
+       },      
        
-       /**
-       * Start playback for current clip
-       */
        play: function(){
-               // Get the player and play:
-               var vid = $j('#mrss_' + this.id + '_' + this.clipIndex 
).get(0);        
-               //alert( 'play: '+ )
-               if( vid && vid.play ){                  
-                       vid.load();
-                       vid.play();
+               var embedPlayer = $j('#' + this.getVideoPlayerId() ).get(0);
+               if( mw.isMobileHTML5() ){                                       
                        
+                       embedPlayer.playerElement.play();
+               } else{ 
+                       embedPlayer.play();
                }
        },
        
-       
        /**
         * Load the playlist driver from a source
         */

Modified: 
branches/MwEmbedStandAlone/modules/Playlist/mw.PlaylistHandlerMediaRss.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Playlist/mw.PlaylistHandlerMediaRss.js   
2010-09-30 02:25:24 UTC (rev 74010)
+++ branches/MwEmbedStandAlone/modules/Playlist/mw.PlaylistHandlerMediaRss.js   
2010-09-30 02:30:06 UTC (rev 74011)
@@ -72,7 +72,7 @@
                callback( clipSources );
        }, 
        
-       getCustomClipAttributes: function( clipIndex ){
+       applyCustomClipData: function( embedPlayer, clipIndex ){
                return {};
        },
        

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js    
2010-09-30 02:25:24 UTC (rev 74010)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerMenu.js    
2010-09-30 02:30:06 UTC (rev 74011)
@@ -63,6 +63,14 @@
                                        return (  
_this.sequencer.getServer().isConfigured() )
                                }
                        },
+                       'help_divider': 'divider',
+                       'help': {
+                               'icon' : 'info',
+                               'action' : function(){                          
        
+                                       // follow link to 
+                                       //$j( this ).attr('href', )
+                               }       
+                       },
                        'exit_divider': 'divider',
                        'exit' : {
                                'icon' : 'power',

Modified: 
branches/MwEmbedStandAlone/modules/SwarmTransport/tests/SwarmTransprot_Url.html
===================================================================
--- 
branches/MwEmbedStandAlone/modules/SwarmTransport/tests/SwarmTransprot_Url.html 
    2010-09-30 02:25:24 UTC (rev 74010)
+++ 
branches/MwEmbedStandAlone/modules/SwarmTransport/tests/SwarmTransprot_Url.html 
    2010-09-30 02:30:06 UTC (rev 74011)
@@ -25,7 +25,7 @@
  <table border="1" cellpadding="6" width="950">
   
        <tr>            
-       <td id="apiExample" valign="top" width="410">           
+       <td valign="top" width="410">           
                <video
                
poster="http://footage.stealthisfilm.com/video/5/frame/0:03:56.640.jpg"; 
                
src="http://footage.stealthisfilm.com/stream/Yochai%20Benkler%20-%20On%20Autonomy%2C%20Control%20and%20Cultureal%20Experience.ogg";
                      
@@ -35,13 +35,13 @@
        <td valign="top">
                        Simple Video Tag usage<br> 
 
-       <textarea id="apiExampleTextArea" style="width:600px;height:180px">
+       <textarea style="width:600px;height:180px">
 <video
 poster="http://footage.stealthisfilm.com/video/5/frame/0:03:56.640.jpg"; 
 
src="http://footage.stealthisfilm.com/stream/Yochai%20Benkler%20-%20On%20Autonomy%2C%20Control%20and%20Cultureal%20Experience.ogg";
                     
 class="kskin">
        <track srclang="en" 
src="Yochai_Benkler_-_On_Autonomy,_Control_and_Cultural_Experience.srt" />
-</video>
+</video>s
        </textarea> 
        </td>
        </tr>

Modified: branches/MwEmbedStandAlone/mwEmbed.js
===================================================================
--- branches/MwEmbedStandAlone/mwEmbed.js       2010-09-30 02:25:24 UTC (rev 
74010)
+++ branches/MwEmbedStandAlone/mwEmbed.js       2010-09-30 02:30:06 UTC (rev 
74011)
@@ -107,11 +107,20 @@
                        }
                        return ;
                }       
-               // Only update the controls if undefined ( ie don't override 
false
-               // properties )
-               if( typeof mwConfig[ name ] == 'undefined') {
-                       mwConfig[ name ] = value;
+               // Only update the controls if undefined 
+               
+               if( typeof mwConfig[ name ] == 'undefined' ) {                  
+                       mwConfig[ name ] = value;       
+                       return ;
                }
+               // Check if we should "merge" the config
+               if( typeof value == 'object' && typeof mwConfig[ name ] == 
'object' ) {
+                       for( var i in value ){
+                               if( typeof mwConfig[ name ][ i ] == 'undefined' 
){
+                                       mwConfig[ name ][ i ] = value[ i ];
+                               }
+                       }
+               }
        };
        
        /**

Modified: branches/MwEmbedStandAlone/skins/common/mw.style.mwCommon.css
===================================================================
--- branches/MwEmbedStandAlone/skins/common/mw.style.mwCommon.css       
2010-09-30 02:25:24 UTC (rev 74010)
+++ branches/MwEmbedStandAlone/skins/common/mw.style.mwCommon.css       
2010-09-30 02:30:06 UTC (rev 74011)
@@ -188,7 +188,7 @@
 .mv-player .play-btn-large {
        width : 130px; 
        height : 96px; 
-       background : url(images/player_big_play_button.png) !important; 
+       background : url(images/player_big_play_button.png); 
        position : absolute; 
        cursor : pointer; 
        border : none !important;



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

Reply via email to