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

Revision: 70213
Author:   dale
Date:     2010-07-31 02:26:23 +0000 (Sat, 31 Jul 2010)

Log Message:
-----------
sequencer debug undo redo
minor resource loader fix for ; or \n resource loader request line break
improved error messages
minor fixes to embedPlayer

Modified Paths:
--------------
    branches/MwEmbedStandAlone/ResourceLoader.php
    branches/MwEmbedStandAlone/includes/NamedResourceLoader.php
    branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
    branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
    branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js
    
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
    branches/MwEmbedStandAlone/modules/Playlist/loader.js
    branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
    branches/MwEmbedStandAlone/mwEmbed.js
    branches/MwEmbedStandAlone/tests/selenium_tests/EmbedPlayerLoadsTest.php
    branches/MwEmbedStandAlone/tests/selenium_tests/audio-player-menu.html
    
branches/MwEmbedStandAlone/tests/selenium_tests/audio-player-playback-progress.html
    branches/MwEmbedStandAlone/tests/selenium_tests/player-themable-display.html

Modified: branches/MwEmbedStandAlone/ResourceLoader.php
===================================================================
--- branches/MwEmbedStandAlone/ResourceLoader.php       2010-07-31 00:58:47 UTC 
(rev 70212)
+++ branches/MwEmbedStandAlone/ResourceLoader.php       2010-07-31 02:26:23 UTC 
(rev 70213)
@@ -101,7 +101,7 @@
                try {
                        NamedResourceLoader::loadResourcePaths();
                } catch( Exception $e ) {
-                       $this->errorMsg .= $e->getMessage() ;
+                       $this->errorMsg .= "loadResourcePaths:" . 
$e->getMessage() ;
                }
 
                // Reset the requestKey:
@@ -182,7 +182,7 @@
                if ( $wgUseFileCache && !$this->debug ) {
                        $status = $this->sFileCache->saveToFileCache( 
$this->output );
                        if ( $status !== true ) {
-                               $this->errorMsg .= $status;
+                               $this->errorMsg .= "Could not save file to 
cache::" . $status;
                        }
                }
 
@@ -190,7 +190,7 @@
                if ( $this->errorMsg != '' ) {
                        //just set the content type (don't send cache header)
                        header( 'Content-Type: text/javascript' );
-                       echo 'if(console.log)console.log(\'Error With 
ScriptLoader ::' .
+                       echo 'if(console.log)console.log(\'Error With 
ResourceLoader ::' .
                                         str_replace( "\n", '\'+"\n"+' . "\n'",
                                                xml::escapeJsString( 
$this->errorMsg )
                                         ) . '\');'."\n";
@@ -728,7 +728,7 @@
                try {
                        NamedResourceLoader::loadResourcePaths();
                } catch( Exception $e ) {
-                       $this->errorMsg .= $e->getMessage() ;
+                       $this->errorMsg .= "getPathFromClass: " . 
$e->getMessage() ;
                }
 
                if ( isset( $wgResourceLoaderNamedPaths[ $reqClass ] ) ) {

Modified: branches/MwEmbedStandAlone/includes/NamedResourceLoader.php
===================================================================
--- branches/MwEmbedStandAlone/includes/NamedResourceLoader.php 2010-07-31 
00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/includes/NamedResourceLoader.php 2010-07-31 
02:26:23 UTC (rev 70213)
@@ -17,7 +17,7 @@
        private static $combinedLoadersJs = '';
 
        // Reg Exp that supports extracting classes from loaders
-       private static $classReplaceExp = 
'/mw\.addResourcePaths\s*\(\s*{(.*)}\s*\)\s*\;/siU';
+       private static $classReplaceExp = 
'/mw\.addResourcePaths\s*\(\s*{(.*)}\s*\)\s*[\;\n]/siU';
 
        // Flag to specify if the javascript resource paths have been loaded.
        private static $classesLoaded = false;

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js    2010-07-31 
00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js    2010-07-31 
02:26:23 UTC (rev 70213)
@@ -54,7 +54,7 @@
                // "videojs" will include the source javascript and video tag to
                //              rewrite the player on the remote page DOM  
                //              Video tag embedding is much more mash-up 
friendly but exposes
-               //              the remote site to the mwEmbed js. 
+               //              the remote site to the mwEmbed javascript and 
can be a xss issue. 
                "EmbedPlayer.ShareEmbedMode" : 'object',
                
                // Default player skin name

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js    
2010-07-31 00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js    
2010-07-31 02:26:23 UTC (rev 70213)
@@ -192,7 +192,7 @@
  * The base source attribute checks
  * also see: http://dev.w3.org/html5/spec/Overview.html#the-source-element
  */
-mw.setConfig( 'embedPlayerSourceAttributes', [
+mw.setDefaultConfig( 'embedPlayerSourceAttributes', [
        // source id
        'id',
        
@@ -325,23 +325,29 @@
                        // Run the global hooks that mw.playerManager is ready
                        mw.log( 'EmbedPlayer::trigger: 
EmbedPlayerManagerReady');
                        $j( mw ).trigger( 'EmbedPlayerManagerReady' );
-               }                       
-               
-               // Add the embedPlayer ready callback 
-               if( typeof callback == 'function' ){  
-                       mw.playerManager.addCallback( callback );
-               }                
+               }       
+               var addedToPlayerManager = false;
                // Make sure we have user preference setup ( for setting 
preferences on video selection )                               
                mw.setupUserConfig( function() {                        
                        // Add each selected element to the player manager:     
        
                        $j( playerSelect ).each( function( index, 
playerElement) {              
-                               // Make sure the video tag was not generated by 
our own native player: 
+                               // Make sure the video tag was not generated by 
our library: 
                                if( $j( playerElement ).hasClass( 
'nativeEmbedPlayerPid' ) ){
-                                       mw.log( 'EmbedPlayer::$j.embedPlayer 
skip embedPlayer gennerated video: ' + playerElement );
+                                       mw.log( 'EmbedPlayer::$j.embedPlayer 
skip embedPlayer gennerated video: ' + playerElement );                    
                                } else {
+                                       addedToPlayerManager = true;
+                                       // Add the embedPlayer ready callback
+                                       mw.playerManager.addCallback( callback 
);
+                                       // Add the player
                                        mw.playerManager.addElement( 
playerElement, attributes);
-                               }                       
-                       } );            
+                               }       
+                               
+                       } );
+                       // run the callback directly if no players were added 
to the playerManager 
+                       if( !addedToPlayerManager && callback ){
+                               callback();
+                       }
+                               
                })
        };
 
@@ -376,7 +382,9 @@
        * @param {Function} callback Function to be called once players are 
ready 
        */
        addCallback: function( callback ) {
-               this.callbackFunctions.push( callback );
+               if( typeof callback == 'function' ){
+                       this.callbackFunctions.push( callback );
+               }
        },
        
        /**
@@ -477,8 +485,13 @@
                                $j( '#' + playerInterface.id 
).get(0).checkPlayerSources();     
                        }
                                                        
-                       if( waitForMeta ) {                                     
        
-                               mw.log('EmbedPlayer::WaitForMeta ( video 
missing height (' + $j( playerElement ).attr('height') + '), width (' + $j( 
playerElement ).attr('width') + ') or duration' );
+                       if( waitForMeta ) {                                     
                                        
+                               mw.log('EmbedPlayer::WaitForMeta ( video 
missing height (' + 
+                                               $j( playerElement 
).attr('height') + '), width (' + 
+                                               $j( playerElement 
).attr('width') + ') or duration: ' +
+                                               $j( playerElement 
).attr('duration') 
+                               );
+                               
                                playerElement.removeEventListener( 
"loadedmetadata", runPlayerSwap, true );
                                playerElement.addEventListener( 
"loadedmetadata", runPlayerSwap, true );
                        
@@ -655,7 +668,7 @@
                        mw.log( "EmbedPlayer::All on-page players ready run 
playerMannager callbacks" );
                        // Run queued functions 
                        if( _this.callbackFunctions ) {
-                               while ( _this.callbackFunctions.length ) {
+                               while ( _this.callbackFunctions.length ) {      
                                
                                        _this.callbackFunctions.shift()();
                                }
                        }
@@ -2085,13 +2098,13 @@
                // Set-up the local controlBuilder instance: 
                this.controlBuilder = new mw.PlayerControlBuilder( this );      
        
                var _this = this;
-               // Make sure we have interface_wrap
-               if( $j( this ).parent( '.interface_wrap' ).length == 0 ) {
+               // Make sure we have mwplayer_interface
+               if( $j( this ).parent( '.mwplayer_interface' ).length == 0 ) {
                        // Select "player"                              
                        $j( this )                      
                        .wrap( 
                                $j('<div>')
-                               .addClass( 'interface_wrap ' + 
this.controlBuilder.playerClass )
+                               .addClass( 'mwplayer_interface ' + 
this.controlBuilder.playerClass )
                                .css({                          
                                        'width' : parseInt( this.width ) + 'px',
                                        'height' : parseInt( this.height ) + 
'px',
@@ -2100,8 +2113,8 @@
                        )
                }
                                
-               //Set up local jQuery object reference to "interface_wrap" 
-               this.$interface = $j( this ).parent( '.interface_wrap' );       
                        
+               //Set up local jQuery object reference to "mwplayer_interface" 
+               this.$interface = $j( this ).parent( '.mwplayer_interface' );   
                        
                
                // Update Thumbnail for the "player" 
                this.updatePosterHTML();                
@@ -2810,7 +2823,7 @@
                        this.preMuteVolume = this.volume;                       
                        var percent = 0;
                }       
-               this.setVolume( percent );                              
+               this.setVolume( percent );              
                // Update the interface
                this.setInterfaceVolume( percent );
        },
@@ -2963,8 +2976,8 @@
                this.checkForCurrentTimeSeek();                 
                
                // Update currentTime via embedPlayer
-               _this.currentTime  = _this.getPlayerElementTime();
-                               
+               _this.currentTime  = _this.getPlayerElementTime();              
+                       
                // Update the previousTime ( so we can know if the 
user-javascript changed currentTime )
                _this.previousTime = _this.currentTime;
                
@@ -2984,7 +2997,9 @@
                // update the mute state from the player element
                if( _this.muted != _this.getPlayerElementMuted() ){
                        mw.log("monitor:: muted does not mach embed player" );
-                       this.toggleMute();
+                       _this.toggleMute();
+                       // Make sure they match: 
+                       _this.muted = _this.getPlayerElementMuted(); 
                }
                
                //mw.log( 'Monitor:: ' + this.currentTime + ' duration: ' + ( 
parseInt( this.getDuration() ) + 1 )  + ' is seek: ' + this.seeking );          
  

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js      
2010-07-31 00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js      
2010-07-31 02:26:23 UTC (rev 70213)
@@ -312,12 +312,12 @@
        * Get the embed player time
        */
        getPlayerElementTime: function() {              
-               var _this = this;               
+               var _this = this;       
                // Make sure we have .vid obj
                this.getPlayerElement(); 
                
                if ( !this.playerElement ) {
-                       mw.log( 'could not find video embed: ' + this.id + ' 
stop monitor' );
+                       mw.log( 'Error: mwEmbedPlayer::getPlayerElementTime: 
missing ' + this.id + ' stop monitor' );
                        return false;
                }                                                               
        
                // Return the playerElement currentTime                         
@@ -448,7 +448,7 @@
        /**
        * Get /update the playerElement value 
        */ 
-       getPlayerElement: function () {
+       getPlayerElement: function () {         
                this.playerElement = $j( '#' + this.pid ).get( 0 );
                return this.playerElement;
        },
@@ -519,8 +519,8 @@
        */
        onloadedmetadata: function() {
                this.getPlayerElement();
-               mw.log( 'f:onloadedmetadata metadata ready Update duration:' + 
this.playerElement.duration + ' old dur: ' + this.getDuration() );              
 
-               if ( ! isNaN( this.playerElement.duration ) ) {
+               if (  this.playerElement && ! isNaN( 
this.playerElement.duration ) ) {
+                       mw.log( 'f:onloadedmetadata metadata ready Update 
duration:' + this.playerElement.duration + ' old dur: ' + this.getDuration() ); 
              
                        this.duration = this.playerElement.duration;
                }
                

Modified: 
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
===================================================================
--- 
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js 
    2010-07-31 00:58:47 UTC (rev 70212)
+++ 
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js 
    2010-07-31 02:26:23 UTC (rev 70213)
@@ -65,7 +65,7 @@
                this.embedPlayer = embedPlayer;
 
                // Check for skin overrides for controlBuilder
-               var skinClass =  embedPlayer.skinName[0].toUpperCase() +  
embedPlayer.skinName.substr( 1 );             
+               var skinClass =  embedPlayer.skinName.substr(0,1).toUpperCase() 
+  embedPlayer.skinName.substr( 1 );            
                if ( mw['PlayerSkin' + skinClass  ]) {
                
                        // Clone as to not override prototype with the skin 
config

Modified: branches/MwEmbedStandAlone/modules/Playlist/loader.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Playlist/loader.js       2010-07-31 
00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/modules/Playlist/loader.js       2010-07-31 
02:26:23 UTC (rev 70213)
@@ -30,6 +30,7 @@
                
        // Module loader ( right now its just a stub for mw.MediaRss )
        mw.addModuleLoader( 'Playlist', [ "mw.Playlist", 
"mw.PlaylistHandlerMediaRss" ] );
+               
        
 } )( window.mw );
 

Modified: branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js  2010-07-31 
00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/modules/Playlist/mw.Playlist.js  2010-07-31 
02:26:23 UTC (rev 70213)
@@ -31,9 +31,17 @@
                }
                
                // Set the sourceHandler if provided
-               if( options.sourceHandler )
+               if( options.sourceHandler ) {
                        this.sourceHandler = options.sourceHandler;
+               }
                
+
+               // Set binding to disable "waitForMeta" for playlist items ( we 
know the size and length )
+               $j( mw ).bind( 'addElementWaitForMetaEvent', function(even, 
waitForMetaObject ){                
+                       if( $j( waitForMetaObject[ 'playerElement' ] 
).hasClass( 'mwPlaylist') ){
+                               waitForMetaObject[ 'waitForMeta' ] = false;
+                       }
+               });
                
                this.type = ( options.type ) ? 
                        options.type: 
@@ -102,6 +110,7 @@
                        
                        // Add the player
                        _this.updatePlayer( _this.clipIndex, function(){
+                               
                                // Update the list height ( vertical layout )
                                if( _this.layout == 'vertical' ){
                                        var targetListHeight = ( $j( 
_this.target ).height() - $j( _this.target + ' .media-rss-video-player' 
).height() );
@@ -170,6 +179,7 @@
                
                // Build and output the title
                var $title = $j('<div />' )
+                       .addClass( 'playlist-title')
                        .css( { 
                                'height' : _this.titleHeight,
                                'font-size' : '85%',
@@ -178,14 +188,10 @@
                        .text( 
                                _this.sourceHandler.getClipTitle( clipIndex ) 
                        )
-                       .addClass( 'ui-state-default ui-widget-header' )        
        
-                       
-               $j( _this.target + ' .media-rss-video-player' )
-                       .empty()
-                       .append(
-                               $title
-                       );
+                       .addClass( 'ui-state-default ui-widget-header' )
                
+               $j( _this.target + ' .media-rss-video-player' 
).find('.playlist-title').remove( );
+               $j( _this.target + ' .media-rss-video-player' ).prepend( $title 
);                                              
                
                // Update the player list if present:                    
                $j( _this.target + ' .clipItemBlock')
@@ -200,47 +206,79 @@
                                'id' : 'mrss_' + this.id + '_' + clipIndex,
                                'poster' : _this.sourceHandler.getClipPoster( 
clipIndex ) 
                        })
+                       .addClass( 'mwPlaylist' )
                        .css(
                                playerSize
                        )
                        // Add custom attributes: 
                        .attr(  _this.sourceHandler.getCustomClipAttributes( 
clipIndex ) );
                
-               // if we don't have an api based lookup ( kentryid ) lookup the 
sources from the 
-               // playlist provider: 
-               if( ! $video.attr( 'kentryid' ) ){
-                       this.sourceHandler.getClipSources( clipIndex, function( 
clipSources ){
-                               
-                               if( clipSources ){
-                                       for( var i =0; i < clipSources.length; 
i++ ){                                   
-                                               var $source = $j('<source />')
-                                                       .attr(  clipSources[i] 
);                                                                              
                                         
-                                               $video.append( $source );
-                                       }
+               // lookup the sources from the playlist provider:               
+               this.sourceHandler.getClipSources( clipIndex, function( 
clipSources ){                  
+                       if( clipSources ){
+                               for( var i =0; i < clipSources.length; i++ ){   
                                
+                                       var $source = $j('<source />')
+                                               .attr(  clipSources[i] );       
                                                                                
                                
+                                       $video.append( $source );
                                }
-                               _this.addVideoPlayer( $video , callback);
-                       });
-               } else {
-                       this.addVideoPlayer( $video , callback);
-               }
+                       }                       
+                       _this.addVideoPlayer( $video , callback);
+               });
        },
        
        addVideoPlayer: function( $video , callback){
                var _this = this;
-               $j( _this.target + ' .media-rss-video-player' ).append( $video 
);
+               // 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.isMobileSafari() ){
+                       // Check for a current video:   
+                       var $inDomVideo = $j( _this.target + ' 
.media-rss-video-player video' );                        
+                       if( $inDomVideo.length == 0 ){
+                               addVideoPlayerToDom= true;
+                       } else {
+                               addVideoPlayerToDom = false;
+                               // Update the inDomVideo object:
+                               // NOTE: this hits a lot of internal stuff 
should !  
+                               // 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');
+                               vidInterface.pid = 'pid_' + $video.attr('id');
+                               vidInterface.duration = null;
+                               if( $video.attr('kentryid') ){                  
                        
+                                       vidInterface.kentryid = 
$video.attr('kentryid');
+                               }
+                               // Update the current video target source
+                               $inDomVideo.attr({
+                                       'id' : 'pid_' + $video.attr('id'),
+                                       'src':  $video.find( 
'source').attr('src') 
+                               });
+                               
+                       }
+               } else {
+                       // Remove the old video player ( non-mobile safari ) 
+                       // xxx NOTE: need to check fullscreen support might be 
better to universally swap the src )
+                       $j( _this.target + ' .media-rss-video-player' ).remove( 
'video' );
+               }
                
+               if( addVideoPlayerToDom ) {
+                       // replace the video: 
+                       $j( _this.target + ' .media-rss-video-player' ).append( 
$video );
+               }
+               
                // Update the video tag with the embedPlayer
                $j.embedPlayers( function(){                                    
        
                        // Setup ondone playing binding to play next clip       
                
-                       $j( '#mrss_' + _this.id + '_' + _this.clipIndex ).bind( 
'ended', function(event, onDoneActionObject ){                                  
                                        
+                       $j( '#mrss_' + _this.id + '_' + _this.clipIndex 
).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: 
                                        onDoneActionObject.runBaseControlDone = 
false;
                                        _this.clipIndex++;
                                                                                
-                                       // ( if on ipad update the src and 
don't refresh )                                              
-                                       _this.updatePlayer( _this.clipIndex, 
function(){
+                                       // update the player and play the next 
clip                                             
+                                       _this.updatePlayer( _this.clipIndex, 
function(){                                                
                                                _this.play();
                                        })                                      
                                        
@@ -249,8 +287,7 @@
                                        // Update the onDone action object to 
not run the base control done: 
                                        onDoneActionObject.runBaseControlDone = 
true;
                                }
-                       })
-                                               
+                       })                      
                        // Run the callback if its set
                        if( callback ){
                                callback();
@@ -340,8 +377,10 @@
        */
        play: function(){
                // Get the player and play:
-               var vid = $j( this.target + ' .media-rss-video-player 
.interface_wrap').children().get(0);
-               if( vid && vid.play ){
+               var vid = $j('#mrss_' + this.id + '_' + this.clipIndex 
).get(0);        
+               //alert( 'play: '+ )
+               if( vid && vid.play ){                  
+                       vid.load();
                        vid.play();
                }
        },

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js        
2010-07-31 00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js        
2010-07-31 02:26:23 UTC (rev 70213)
@@ -96,17 +96,19 @@
         * Update the smil xml and then update the interface
         */
        updateSmilXML: function( smilXML ){
-               mw.log("Sequencer::updateSmilXML");
+               mw.log("Sequencer::updateSmilXML" + smilXML);
                var _this = this;
-               
+               alert( 'before update seq len: ' + 
this.getSmil().$dom.find('seq').children().length )
                // Update the embedPlayer smil: 
                this.getSmil().updateFromString( smilXML );
-               
+               alert( 'after update seq len: ' + 
this.getSmil().$dom.find('seq').children().length )
                // Get a duration ( forceRefresh to clear the cache ) 
-               this.getEmbedPlayer().getDuration( true );
-               
+               var dur = this.getEmbedPlayer().getDuration( true );
+               alert( 'restored dur should be: ' + dur);
+               /*              
                // redraw the timeline
                this.getTimeline().drawTimeline();
+               */
        },
        
        /**
@@ -133,8 +135,8 @@
                        // Add the timeline
                        _this.getTimeline().drawTimeline();     
                        
-                       // initialize the edit actions ( stores the initial 
state for undo / redo actions )  
-                       _this.getActionsEdit();
+                       // initialize the edit stack to support undo / redo 
actions  
+                       _this.getActionsEdit().setupEditStack();
                });             
                // Draw the top level menu
                this.getMenu().drawMenu();

Modified: 
branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js     
2010-07-31 00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js     
2010-07-31 02:26:23 UTC (rev 70213)
@@ -23,9 +23,7 @@
        numberOfUndos : mw.getConfig( 'Sequencer.numberOfUndos' ),
        
        init: function( sequencer ) {
-               this.sequencer = sequencer; 
-               // Set the initial edit state: 
-               this.editStack.push(  this.sequencer.getSmil().getXMLString() );
+               this.sequencer = sequencer;             
        },      
        
        selectAll: function(){
@@ -35,6 +33,15 @@
        },
        
        /**
+        * Set up the edit stack
+        */
+       setupEditStack: function(){
+               this.editStack = [];
+               // Set the initial edit state: 
+               this.editStack.push(  this.sequencer.getSmil().getXMLString() );
+       },
+       
+       /**
         * Apply a smil xml transform state ( to support undo / redo ) 
         */
        registerEdit: function(){       
@@ -55,9 +62,10 @@
         * Undo an edit action
         */
        undo: function(){
-               this.editIndex--;               
+               this.editIndex--;
+               mw.log("SequenceActionsEdit:: undo stack index:" + 
this.editIndex);
                // Change to previous state 
-               this.sequencer.updateSmilXML( this.editStack[ this.editIndex ] 
);
+               this.sequencer.updateSmilXML( this.editStack[ this.editIndex ] 
);               
        },
        
        /**

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js        
2010-07-31 00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js        
2010-07-31 02:26:23 UTC (rev 70213)
@@ -59,7 +59,8 @@
                        this.trackLayout.resizeAll();
                }
        },
-       //draw the timeline
+       
+       // Draw the timeline
        drawTimeline: function(){               
                // Empty the timeline container 
                this.getTimelineContainer().empty();
@@ -67,7 +68,7 @@
                // Get the top level sequence tracks 
                var seqTracks = 
this.sequencer.getSmil().getBody().getSeqElements();            
                var trackType = 'video'; 
-               // for now just two tracks first is video second is audio 
+               // For now just two tracks first is video second is audio 
                for( var trackIndex=0; trackIndex < seqTracks.length; 
trackIndex++){
                        
                        if( trackType == 'audio' ){
@@ -83,8 +84,8 @@
        drawSequenceTrack: function( trackIndex, sequenceNode, trackType ){     
                var _this = this;
                mw.log(" drawSequenceTrack: Track inx: " + trackIndex + ' 
trackType:' + trackType );
-               // Check if we already have a container for this track set      
        
-                       
+               // Check if we already have a container for this track set      
                        
+               
                // Add a sequence track Name                    
                this.getTracksContainer().find('.trackNamesContainer').append( 
                        this.getTrackNameInterface( trackIndex, sequenceNode, 
trackType )
@@ -93,12 +94,12 @@
                // Add Sequence clips
                
this.getTracksContainer().find('.clipTrackSetContainer').append( 
                        this.getTrackClipInterface( trackIndex ,sequenceNode , 
trackType )
-               ).click(function(){                     
+               ).click( function(){
                        // xxx todo catch de-select clicks in 
clipTrackSetContainer that are not a click in the timeline
                        
//_this.getTracksContainer().find('.timelineClip').removeClass( 'selectedClip' 
);
                })
                // Load and display all clip thumbnails                 
-               this.drawTrackThumbs(  trackIndex, sequenceNode, trackType );   
        
+               this.drawTrackThumbs(  trackIndex, sequenceNode, trackType );   
                
        },
        
        drawTrackThumbs: function( trackIndex, sequenceNode, trackType ){

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js    2010-07-31 
00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js    2010-07-31 
02:26:23 UTC (rev 70213)
@@ -91,7 +91,7 @@
                this.$dom = $j( smilXmlString );
 
                mw.log("Smil::loadFromString: loaded smil dom: " + 
this.$dom.length + "\n" + smilXmlString );
-
+               /*
                // Clear out the layout
                this.layout = null;
 
@@ -103,10 +103,11 @@
 
                // Clear out the "buffer" object
                this.buffer = null;
+               */
        },
        updateFromString: function( smilXmlString ){
-               var tmpDom = $j( smilXmlString );
-               // merge in xml changes? 
+               delete this.$dom; 
+               this.$dom = $j( smilXmlString ); 
        },
        /**
         * Internal function to get the jQuery smil dom
@@ -269,6 +270,7 @@
                }
                return this.duration;
        },
+       
        removeById: function ( smilElementId ) {
                var $smilElement =  this.$dom.find( '#' + smilElementId );
 

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js        
2010-07-31 00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js        
2010-07-31 02:26:23 UTC (rev 70213)
@@ -50,13 +50,16 @@
                if( !$node.attr('id')
                        && !$node.attr( 'xml:id' )
                ){
+                       var idString = _this.getNodeSmilType( $node ) + '_' + 
_this.idIndex;
                        // Make sure the id does not already exist ( should be 
a rare case ) 
-                       var idString = _this.getNodeSmilType( $node ) + '_' + 
_this.idIndex;
-                       if( this.$dom.find( '#' + idString ).length != 0 ){
-                               idString+= '_' + Math.random();
+                       while( this.$dom.find( '#' + idString ).length != 0 ){
+                               _this.idIndex++;
+                               idString = _this.getNodeSmilType( $node ) + '_' 
+ _this.idIndex;
                        }
+                       // Apply the unique id attribute 
                        $node.attr('id',  idString);
                        mw.log('SmilBody:: gave: ' + $node.get(0).nodeName + ' 
id: ' + $node.attr('id') );
+                       // Increment the index: 
                        _this.idIndex++;
                }
                

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js      
2010-07-31 00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js      
2010-07-31 02:26:23 UTC (rev 70213)
@@ -403,7 +403,7 @@
                
                var $vid = $j ( '#' +  assetId);
                var vid = $vid.get(0);
-               // Add the asset to the loading set
+               // Add the asset to the loading set (if not there already )
                _this.addAssetLoading( $vid.attr('id' ) );
                var seekCallbackDone = false;
                var runSeekCallback = function(){

Modified: branches/MwEmbedStandAlone/mwEmbed.js
===================================================================
--- branches/MwEmbedStandAlone/mwEmbed.js       2010-07-31 00:58:47 UTC (rev 
70212)
+++ branches/MwEmbedStandAlone/mwEmbed.js       2010-07-31 02:26:23 UTC (rev 
70213)
@@ -1216,7 +1216,6 @@
         *            string String to output to console
         */
        mw.log = function( string ) {
-
                // Add any prepend debug strings if necessary
                if ( mw.getConfig( 'pre-append-log' ) ){
                        string = mw.getConfig( 'pre-append-log' ) + string;     
        
@@ -1227,17 +1226,18 @@
                } else {        
                        /**
                         * Old IE and non-Firebug debug: ( commented out for 
now )
-                        */                     
-                       /*
-                        * var log_elm = document.getElementById('mv_js_log'); 
if(!log_elm) {
-                        * document.getElementsByTagName("body")[0].innerHTML =
-                        * document.getElementsByTagName("body")[0].innerHTML + 
'<div
-                        * 
style="position:absolute;z-index:500;bottom:0px;left:0px;right:0px;height:200px;">'+
 '<textarea
-                        * id="mv_js_log" cols="120" rows="12"></textarea>'+ 
'</div>';
-                        * 
-                        * var log_elm = document.getElementById('mv_js_log'); 
} if(log_elm) {
-                        * log_elm.value+=string+"\n"; }
-                        */     
+                        */                                             
+                       /*var log_elm = document.getElementById('mv_js_log'); 
+                       if(!log_elm) {                          
+                               
document.getElementsByTagName("body")[0].innerHTML += '<div ' +
+                                       
'style="position:absolute;z-index:500;bottom:0px;left:0px;right:0px;height:200px;">'
 + 
+                                       '<textarea id="mv_js_log" cols="120" 
rows="12"></textarea>' + 
+                               '</div>';
+                       }
+                       var log_elm = document.getElementById('mv_js_log'); 
+                       if(log_elm) {
+                               log_elm.value+=string+"\n"; 
+                       }*/                     
                }
        }
        
@@ -2417,7 +2417,7 @@
 /**
  * Set DOM-ready call We copy jQuery( document ).ready here since sometimes
  * mwEmbed.js is included without jQuery and we need our own "ready" system so
- * that mwEmbed interfaces can support async built out and the inclution of
+ * that mwEmbed interfaces can support async built out and the include of
  * jQuery.
  */
 var mwDomIsReady = false;

Modified: 
branches/MwEmbedStandAlone/tests/selenium_tests/EmbedPlayerLoadsTest.php
===================================================================
--- branches/MwEmbedStandAlone/tests/selenium_tests/EmbedPlayerLoadsTest.php    
2010-07-31 00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/tests/selenium_tests/EmbedPlayerLoadsTest.php    
2010-07-31 02:26:23 UTC (rev 70213)
@@ -20,8 +20,8 @@
     
     $this->waitForPageToLoad(10000);
     
-    $this->isElementPresent("//d...@class='interface_wrap k-player']", 10000);
-    $this->isElementPresent("//d...@class='interface_wrap mv-player']", 10000);
+    $this->isElementPresent("//d...@class='mwplayer_interface k-player']", 
10000);
+    $this->isElementPresent("//d...@class='mwplayer_interface mv-player']", 
10000);
     $this->isElementPresent("//d...@class='ui-state-default play-btn-large']", 
10000);
 
        }

Modified: branches/MwEmbedStandAlone/tests/selenium_tests/audio-player-menu.html
===================================================================
--- branches/MwEmbedStandAlone/tests/selenium_tests/audio-player-menu.html      
2010-07-31 00:58:47 UTC (rev 70212)
+++ branches/MwEmbedStandAlone/tests/selenium_tests/audio-player-menu.html      
2010-07-31 02:26:23 UTC (rev 70213)
@@ -18,7 +18,7 @@
 </tr>
 <tr>
        <td>waitForElementPresent</td>
-       <td>//d...@class='interface_wrap k-player']</td>
+       <td>//d...@class='mwplayer_interface k-player']</td>
        <td>9000</td>
 </tr>
 <tr>

Modified: 
branches/MwEmbedStandAlone/tests/selenium_tests/audio-player-playback-progress.html
===================================================================
--- 
branches/MwEmbedStandAlone/tests/selenium_tests/audio-player-playback-progress.html
 2010-07-31 00:58:47 UTC (rev 70212)
+++ 
branches/MwEmbedStandAlone/tests/selenium_tests/audio-player-playback-progress.html
 2010-07-31 02:26:23 UTC (rev 70213)
@@ -18,7 +18,7 @@
 </tr>
 <tr>
        <td>waitForElementPresent</td>
-       <td>//d...@class='interface_wrap k-player']</td>
+       <td>//d...@class='mwplayer_interface k-player']</td>
        <td>9000</td>
 </tr>
 <tr>

Modified: 
branches/MwEmbedStandAlone/tests/selenium_tests/player-themable-display.html
===================================================================
--- 
branches/MwEmbedStandAlone/tests/selenium_tests/player-themable-display.html    
    2010-07-31 00:58:47 UTC (rev 70212)
+++ 
branches/MwEmbedStandAlone/tests/selenium_tests/player-themable-display.html    
    2010-07-31 02:26:23 UTC (rev 70213)
@@ -18,12 +18,12 @@
 </tr>
 <tr>
        <td>waitForElementPresent</td>
-       <td>//d...@class=&quot;interface_wrap k-player&quot;]</td>
+       <td>//d...@class=&quot;mwplayer_interface k-player&quot;]</td>
        <td>9000</td>
 </tr>
 <tr>
        <td>waitForElementPresent</td>
-       <td>//d...@class=&quot;interface_wrap mv-player&quot;]</td>
+       <td>//d...@class=&quot;mwplayer_interface mv-player&quot;]</td>
        <td>9000</td>
 </tr>
 <tr>



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

Reply via email to