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

Revision: 72746
Author:   dale
Date:     2010-09-10 20:29:12 +0000 (Fri, 10 Sep 2010)

Log Message:
-----------
* fixed monitor issue for sequencer
* fixed non-sequencer xml page preservation 

Modified Paths:
--------------
    
branches/MwEmbedStandAlone/modules/EmbedPlayer/binPlayers/kaltura-player/kdp3.swf
    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/kskin/mw.style.PlayerSkinKskin.css
    
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
    branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js

Modified: 
branches/MwEmbedStandAlone/modules/EmbedPlayer/binPlayers/kaltura-player/kdp3.swf
===================================================================
(Binary files differ)

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js    2010-09-10 
20:25:46 UTC (rev 72745)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/loader.js    2010-09-10 
20:29:12 UTC (rev 72746)
@@ -128,7 +128,6 @@
                                if ( $j( element ).attr( "id" ) == '' ) {
                                        $j( element ).attr( "id",  'v' + ( 
rewriteElementCount++ ) );
                                }
-                               
                                // Add an absolute positioned loader
                                $j( element )
                                        .getAbsoluteOverlaySpinner()
@@ -163,10 +162,10 @@
                                'mw.style.EmbedPlayer',
                                '$j.cookie',
                                // Add JSON lib if browsers does not define 
"JSON" natively
-                               'JSON'
+                               'JSON',
+                               '$j.widget'
                        ],
-                       [
-                               '$j.widget',
+                       [                        
                                '$j.ui.mouse',
                                '$j.fn.menu',                   
                                'mw.style.jquerymenu',

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js    
2010-09-10 20:25:46 UTC (rev 72745)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayer.js    
2010-09-10 20:29:12 UTC (rev 72746)
@@ -167,6 +167,9 @@
        //( Global default via config EmbedPlayer.OverlayControls in module 
loader.js)  
        "overlayControls" : true,
        
+       // Attribute to use 'native' controls 
+       "usenativecontrols" : false,
+       
        // ROE url ( for xml based metadata )
        // also see: http://wiki.xiph.org/ROE
        "roe" : null,
@@ -302,7 +305,7 @@
                                        var height = ( attributes.height )? 
attributes.height : '100%';
                                }
                                
-                               mw.log('EmbedPlayer:: set loading background 
img' + posterSrc);
+                               mw.log('EmbedPlayer:: set loading background: ' 
+ posterSrc);
                                $j( playerElement ).append(
                                        $j( '<img />' )
                                        .attr( 'src', posterSrc)
@@ -332,9 +335,10 @@
                // 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) {              
+                       $j( playerSelect ).each( function( index, 
playerElement) {                                      
                                // Make sure the video tag was not generated by 
our library: 
                                if( $j( playerElement ).hasClass( 
'nativeEmbedPlayerPid' ) ){
+                                       $j('#loadingSpinner_'  + $j( 
playerElement ).attr('id') ).hide();
                                        mw.log( 'EmbedPlayer::$j.embedPlayer 
skip embedPlayer gennerated video: ' + playerElement );                    
                                } else {
                                        addedToPlayerManager = true;
@@ -519,7 +523,8 @@
        */                       
        waitForMetaCheck: function( playerElement ){
                var waitForMeta = false;                
-               
+               if( !playerElement )
+                       return ;
                // If we don't have a native player don't wait for metadata
                if( !mw.EmbedTypes.players.isSupportedPlayer( 'oggNative') &&
                        !mw.EmbedTypes.players.isSupportedPlayer( 'h264Native' 
) )
@@ -603,8 +608,7 @@
                }
                
                // Check if we are using native controls ( should keep the 
video embed around )
-               // "wrap" the player interface
-               if( playerInterface.useNativeControls() ) {
+               if( playerInterface.shouldUseNativeControls() ) {
                        $j( targetElement )
                        .attr('id', playerInterface.pid )
                        .after( 
@@ -623,7 +627,7 @@
                
                // If we don't already have a loadSpiner add one: 
                if( $j('#loadingSpinner_' + playerInterface.id ).length == 0 ){
-                       if( playerInterface.useNativeControls() ) {
+                       if( playerInterface.shouldUseNativeControls() ) {
                                $j( targetElement )
                                        .getAbsoluteOverlaySpinner()
                                        .attr('id', 'loadingSpinner_' + 
playerInterface.id ) 
@@ -1419,7 +1423,7 @@
                }
                                
                // Hide "controls" if using native player controls: 
-               if( this.useNativeControls() ){
+               if( this.shouldUseNativeControls() ){
                        _this.controls = false;
                }
                
@@ -1580,7 +1584,7 @@
         */
        resizePlayer: function( size , animate){
                this.width = size.width;
-               this.hegith = size.height;
+               this.height = size.height;
                if( animate ){
                        $j(this).animate(size);
                        this.$interface.animate( size );
@@ -1978,56 +1982,9 @@
         */
        setCurrentTime: function( time, callback ) {
                mw.log( 'Error: base embed setCurrentTime can not frame serve 
(override via plugin)' );
-       },
+       },      
        
        /**
-       * Setup the embed player 
-       * issues a loading request
-       */
-       doEmbedPlayer: function() {
-               mw.log( 'EmbedPlayer::doEmbedPlayer::' + this.selectedPlayer.id 
);
-               //mw.log( 'thum disp:' + this.thumbnail_disp );
-               var _this = this;
-               
-               var doEmbedPlayerLocal = function(){
-                       // Set "loading" here ( if displaying controls )
-                       if( ! _this.useNativeControls() ){ 
-                               $j( _this ).html( 
-                                       $j( '<div />' )
-                                       .css({
-                                               'color' : 'black',
-                                               'width' : _this.width + 'px',
-                                               'height' : _this.height + 'px'
-                                       })                                      
-                               );
-                       }
-                       
-                       // Reset some play state flags: 
-                       _this.bufferStartFlag = false;
-                       _this.bufferEndFlag = false;
-                       
-                       // Make sure the player is              
-                       mw.log( 'EmbedPlayer::performing embed for ' + _this.id 
);
-               };
-                               
-               // If no binded events, run the local doEmbedPlayer function 
directly:  
-               if( $j( this ).data('events').length == 0 ){
-                       doEmbedPlayerLocal();
-               } else {
-                       // Trigger the doEmbedPlayer event / hook with callback 
 
-                       $j( this ).trigger( 'doEmbedPlayerEvent', function(){
-                               //done
-                               doEmbedPlayerLocal();
-                       });
-               } 
-               
-               // mw.log('should embed:' + embed_code);                
-               _this.doEmbedHTML()             
-       },
-       
-       
-       
-       /**
        * On clip done action. Called once a clip is done playing
        */
        onClipDone: function() {
@@ -2100,7 +2057,7 @@
                this.controlBuilder.addControlBindings();
                
                // Once the thumbnail is shown run the mediaReady trigger (if 
not using native controls)
-               if( !this.useNativeControls() ){
+               if( !this.shouldUseNativeControls() ){
                        mw.log("mediaLoaded");
                        $j( this ).trigger( 'mediaLoaded' );
                }
@@ -2378,7 +2335,7 @@
                var style_atr = '';
                
                
-               if( this.useNativeControls() ){
+               if( this.shouldUseNativeControls() ){
                        this.showNativePlayer();
                        return ;
                }               
@@ -2419,7 +2376,11 @@
         * @returns boolean true if the mwEmbed player interface should be used
         *                                      false if the mwEmbed player 
interface should not be used
         */
-       useNativeControls: function() {
+       shouldUseNativeControls: function() {
+               if( this.usenativecontrols === true ){
+                       return true;
+               }
+               
                if( mw.getConfig('EmbedPlayer.NativeControls') === true ) {
                        return true;
                }
@@ -2447,31 +2408,31 @@
                // Remove the player loader spinner if it exists
                $j('#loadingSpinner_' + this.id ).remove();
                
+               
                // Check if we need to refresh mobile safari
-               /*var mobileSafairNeedsRefresh = false;
-               if( $j( '#' + this.pid ).attr('controls') === false ){
-                       mobileSafairNeedsRefresh = true;
-               }*/             
+               var mobileSafairNeedsRefresh = false;                           
        
                
-               // For now always refersh ( buggy display control behavior in 
iPad ) 
-               mobileSafairNeedsRefresh = true;
                
                // Unhide the original video element
-               $j( '#' + this.pid )
-               .css( {
-                       'position' : 'absolute'
-               } )
-               .show()
-               .attr('controls', 'true');
+               if( !$j( '#' + this.pid ).hasClass('PlayerThemer') ){
+                       $j( '#' + this.pid )
+                       .css( {
+                               'position' : 'absolute'
+                       } )
+                       .show()
+                       .attr('controls', 'true');
+                       
+                       mobileSafairNeedsRefresh = true;
+               }
                
                // iPad does not handle video tag update for attributes like 
"controls" 
                // so we have to do a full replace ( if controls are not 
included initially )           
                if( mw.isMobileSafari() && mobileSafairNeedsRefresh ) {
                        var source = this.mediaElement.getSources( 'video/h264' 
)[0];
-                       if( ! source.src ){
+                       if( source && ! source.src ){
                                mw.log( 'Error: should have caught no playable 
sources for mobile safari earlier' );
-                       }               
-                                       
+                       }                                       
+                       
                        var videoAttribues = {
                                'id' : _this.pid,
                                'poster': _this.poster,
@@ -2693,7 +2654,8 @@
        */
        play: function() {
                var _this = this;
-               mw.log( "EmbedPlayer:: play" );
+               mw.log( "EmbedPlayer:: play" );         
+         
                // Hide any overlay:
                this.controlBuilder.closeMenuOverlay();
                
@@ -2702,17 +2664,24 @@
                        if ( !this.selectedPlayer ) {
                                mw.log( 'no selectedPlayer' );                  
                
                                this.showPluginMissingHTML();
+                               return; 
                        } else {
                                this.thumbnail_disp = false;
-                               this.paused = false;
-                               this.doEmbedPlayer();                           
+                               this.doEmbedHTML();                             
                        }
                } else {
                        // the plugin is already being displayed                
        
-                       this.paused = false; // make sure we are not "paused"
                        this.seeking = false;
                }
                
+                // Run play hook (if we were previously in paused state ) 
+               if( this.paused ){
+                       this.paused = false;
+                       mw.log("trigger play event::");
+                       $j( this ).trigger( 'play' );
+               }
+               
+               
                this.$interface.find('.play-btn span')
                .removeClass( 'ui-icon-play' )
                .addClass( 'ui-icon-pause' );
@@ -2724,15 +2693,8 @@
                        _this.pause();
                 } )
                 .attr( 'title', gM( 'mwe-embedplayer-pause_clip' ) );
-                
-                
-                // Run play hook: 
-                mw.log("playEvent");
-                $j( this ).trigger( 'playEvent' );
+                                
                
-                // Start monitor
-                this.monitor();
-                
                  // If we previously finished playing this clip run the 
"replay hook"
                 if( this.donePlayingCount > 0 ) {
                        mw.log("replayEvent");
@@ -2758,12 +2720,12 @@
        */
        pause: function( event ) {
                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');
-               }
-               mw.log('mwEmbed:embedPlayer::pause() ');        
+               }               
                                
                // update the ctrl "paused state"                               
                this.$interface.find('.play-btn span' )
@@ -2813,8 +2775,6 @@
                this.showThumbnail();
                this.bufferedPercent = 0; // reset buffer state                 
                this.controlBuilder.setStatus( this.getTimeRange() );
-               // stop monitor:
-               this.monitorInterval = null;
                
                // Reset the playhead
                mw.log("EmbedPlayer::Stop:: Reset play head")
@@ -2869,7 +2829,8 @@
                // Update the playerElement volume      
                this.setPlayerElementVolume( percent );
                
-               //mw.log(" setVolume:: " + percent + ' this.volume is: ' + 
this.volume);                
+               //mw.log(" setVolume:: " + percent + ' this.volume is: ' + 
this.volume);        
+               $j( this ).trigger('volumeChanged', percent );
        },
        
        /**
@@ -2998,7 +2959,7 @@
                
                // Update currentTime via embedPlayer
                _this.currentTime  = _this.getPlayerElementTime();              
-
+               
                // Update any offsets from server seek
                if( _this.serverSeekTime && _this.supportsURLTimeEncoding ){
                        _this.currentTime = _this.serverSeekTime + 
_this.getPlayerElementTime()
@@ -3010,8 +2971,9 @@
                
                // Check if volume was set outside of embed player function
                //mw.log( ' this.volume: ' + _this.volume + '  prev Volume:: ' 
+ _this.previousVolume );
-               if( _this.volume != _this.previousVolume ) {                    
+               if( _this.volume != _this.previousVolume ) {                    
        
                        _this.setInterfaceVolume( _this.volume );
+                       $j( this ).trigger('volumeChanged', _this.volume );
                }
                
                // Update the previous volume 
@@ -3022,7 +2984,7 @@
                
                // update the mute state from the player element
                if( _this.muted != _this.getPlayerElementMuted() ){
-                       mw.log("monitor:: muted does not match embed player" );
+                       mw.log("monitor:: muted does not mach embed player" );
                        _this.toggleMute();
                        // Make sure they match: 
                        _this.muted = _this.getPlayerElementMuted(); 
@@ -3075,17 +3037,21 @@
                }
                                
                // Call monitor at 250ms interval. ( use  setInterval to avoid 
stacking monitor requests ) 
-               if( ! this.isStopped() ) {
+               //mw.log("EmbedPlayer::monitor: continue?:" + !this.isStopped() 
+ ' monitorInterval: ' + this.monitorInterval );
+               if( ! this.isStopped() ) {                      
                        if( !this.monitorInterval ){
+                               
                                this.monitorInterval = setInterval( function(){
-                                       if( _this.monitor )
+                                       mw.log("monitorInterval!!");
+                                       if( _this.monitor ){
                                                _this.monitor();
+                                       }
                                }, this.monitorRate )
                        }
                } else {
-                       //mw.log("EmbedPlayer::monitor: player is stoped, stop 
monitor")
                        // If stopped "stop" monitor: 
                        clearInterval( this.monitorInterval );
+                       this.monitorInterval = 0;
                }
                
                //mw.log('trigger:monitor:: ' + this.currentTime );             
@@ -3116,6 +3082,7 @@
                        $buffer.css({
                                "width" : ( this.bufferedPercent * 100 ) + '%'
                        });
+                       $j( this ).trigger( 'updateBufferPercent',  
this.bufferedPercent );
                } else {
                        $buffer.css( "width", '0px' );
                }
@@ -3139,12 +3106,14 @@
        *
        * @param {Float} perc Value between 0 and 1 for position of playhead
        */
-       updatePlayHead: function( perc ) {
+       updatePlayHead: function( perc ) {      
                $playHead = this.$interface.find( '.play_head' );
                if ( this.controls &&  $playHead.length != 0 ) {
                        var val = parseInt( perc * 1000 );
                        $playHead.slider( 'value', val );
-               }               
+               }
+               // @@todo should fix this name: 
+               $j(this).trigger('updatePlayHeadPercent', perc);
        },
        
        /**

Modified: branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js
===================================================================
--- branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js      
2010-09-10 20:25:46 UTC (rev 72745)
+++ branches/MwEmbedStandAlone/modules/EmbedPlayer/mw.EmbedPlayerNative.js      
2010-09-10 20:29:12 UTC (rev 72746)
@@ -57,10 +57,14 @@
        doEmbedHTML : function () {
                var _this = this;
                
+               // Reset some play state flags: 
+               _this.bufferStartFlag = false;
+               _this.bufferEndFlag = false;
+               
                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.useNativeControls && $j( '#' + this.pid ).length &&
+               if( this.shouldUseNativeControls() && $j( '#' + this.pid 
).length &&
                        typeof $j( '#' + this.pid ).get(0).play != 'undefined' 
) {
                        _this.postEmbedJS();
                        return ;
@@ -435,7 +439,7 @@
                        // No vid loaded
                        mw.log( 'native::load() ... doEmbed' );
                        this.onlyLoadFlag = true;
-                       this.doEmbedPlayer();
+                       this.doEmbedHTML();
                        this.onLoadedCallback =  callback;
                } else {
                        // Should not happen offten

Modified: 
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.style.PlayerSkinKskin.css
===================================================================
--- 
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.style.PlayerSkinKskin.css
     2010-09-10 20:25:46 UTC (rev 72745)
+++ 
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/kskin/mw.style.PlayerSkinKskin.css
     2010-09-10 20:29:12 UTC (rev 72746)
@@ -319,7 +319,7 @@
        height: 15px;
        overflow: hidden;
        padding-left: 2px;
-       width: 100%;
+       width: 95%;
 }
 
 .menu-screen.menu-share button {

Modified: 
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js
===================================================================
--- 
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js 
    2010-09-10 20:25:46 UTC (rev 72745)
+++ 
branches/MwEmbedStandAlone/modules/EmbedPlayer/skins/mw.PlayerControlBuilder.js 
    2010-09-10 20:29:12 UTC (rev 72746)
@@ -1604,11 +1604,10 @@
                        'w' : 100,
                        'o' : function( ctrlObj ) {
                                return $j( '<div />' )
-                                               .addClass( "ui-widget 
time-disp" )
-                                               .append( 
-                                                       
ctrlObj.embedPlayer.getTimeRange()
-                                               )
-                                               
+                               .addClass( "ui-widget time-disp" )
+                               .append( 
+                                       ctrlObj.embedPlayer.getTimeRange()
+                               )       
                        }
                },
                

Modified: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js  
2010-09-10 20:25:46 UTC (rev 72745)
+++ branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerServer.js  
2010-09-10 20:29:12 UTC (rev 72746)
@@ -142,7 +142,7 @@
                                'pageStart' :  pageText.substring(0, 
pageText.indexOf( startKey ) ),
                                'sequenceXML' :  pageText.substring( 
pageText.indexOf( startKey ) +  startKey.length, 
                                                pageText.indexOf(endKey ) ),    
                        
-                               'pageEnd' : pageText.substring( 
pageText.indexOf(endKey) ) 
+                               'pageEnd' : pageText.substring( 
pageText.indexOf(endKey) + endKey.length  ) 
                        }
                },
                

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js 
2010-09-10 20:25:46 UTC (rev 72745)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js 
2010-09-10 20:29:12 UTC (rev 72746)
@@ -49,7 +49,7 @@
        /**
        * Put the embed player into the container
        */
-       doEmbedPlayer: function() {
+       doEmbedHTML: function() {
                var _this = this;               
                
                // check if we have already embed the player:
@@ -57,10 +57,10 @@
                        return; 
                }
                this.smilPlayerEmbedded = true;
-               mw.log("EmbedPlayerSmil::doEmbedPlayer: " + this.id + " time:" 
+ this.smilPlayTime ) ;
+               mw.log("EmbedPlayerSmil::doEmbedHTML: " + this.id + " time:" + 
this.smilPlayTime ) ;
                                
                this.setCurrentTime( this.smilPlayTime, function(){
-                       mw.log("EmbedPlayerSmil::doEmbedPlayer:: render 
callback ready " );
+                       mw.log("EmbedPlayerSmil::doEmbedHTML:: render callback 
ready " );
                });                             
        },
        
@@ -148,10 +148,7 @@
         */
        play: function( playSegmentEndTime ){
                var _this = this;
-               mw.log(" EmbedPlayerSmil::play " + _this.smilPlayTime + ' to ' 
+ playSegmentEndTime + ' pause time: ' + this.smilPauseTime );           
-
-               // Set thumbnail_disp to false 
-               this.thumbnail_disp = false;
+               mw.log(" EmbedPlayerSmil::play " + _this.smilPlayTime + ' to ' 
+ playSegmentEndTime + ' pause time: ' + this.smilPauseTime );
                
                // Update clock start time 
                _this.clockStartTime = new Date().getTime()
@@ -184,6 +181,9 @@
                        // Zero out the pause time:
                        _this.smilPauseTime = 0;
                        
+                       // Set thumbnail_disp to false 
+                       this.thumbnail_disp = false;
+                       
                        // Start up monitor:
                        _this.monitor();
                });
@@ -236,7 +236,7 @@
         */
        monitor: function(){
                // Get a local variable of the new target time:                 
-               //mw.log("smilPlayer::monitor: isPlaying:" + this.isPlaying() + 
' pausedForBuffer:' +  this.pausedForBuffer + ' playtime:' + this.smilPlayTime);
+               //mw.log("smilPlayer::monitor: isPlaying:" + this.isPlaying() + 
' is stoped: ' + this.isStopped() + ' pausedForBuffer:' +  this.pausedForBuffer 
+ ' playtime:' + this.smilPlayTime);
                
                // Check if we reached playSegmentEndTime and pause playback  
                if( this.playSegmentEndTime && this.smilPlayTime >= 
this.playSegmentEndTime ) {
@@ -289,8 +289,7 @@
                        // Issue an animate time request with monitorDelta 
                        this.smil.animateTime( this.smilPlayTime, 
this.monitorRate ); 
                }
-                               
-               
+                                               
                this.parent_monitor();
        },
        
@@ -350,7 +349,7 @@
                        return ;
                }
                // If no thumb could be found use the first frame of smil: 
-               this.doEmbedPlayer(); 
+               this.doEmbedHTML(); 
        },
        
        /**

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js    2010-09-10 
20:25:46 UTC (rev 72745)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js    2010-09-10 
20:29:12 UTC (rev 72746)
@@ -396,9 +396,9 @@
                );
                // Links go to a new window and are disable when smaller than 
player size
                $html.find('a').each( function(inx, link ){
-                       // escape link output as to not include scirpt execution
+                       // Escape link output as to not include scirpt execution
                        $j(link).attr('href', 
-                                       mw.escapeQuotesHTML( 
$j(link).attr('href') )
+                               mw.escapeQuotesHTML( $j(link).attr('href') )
                        )
                });             
                

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js     
2010-09-10 20:25:46 UTC (rev 72745)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js     
2010-09-10 20:29:12 UTC (rev 72746)
@@ -50,12 +50,13 @@
                        // var relativeTime = time - 
smilElement.parentTimeOffset;
                        var relativeTime = time - $j( smilElement ).data ( 
'startOffset' );
                        switch( _this.smil.getRefType( smilElement ) ){
+                               case 'auido':
                                case 'video':
-                                       var vid = $j ( '#' + 
_this.smil.getSmilElementPlayerID( smilElement ) ).get( 0 );
-                                       var vidTime = ( !vid || 
!vid.currentTime )? 0 : vid.currentTime;                                        
-                                       //mw.log( "getPlaybackSyncDelta:: video 
time should be: " + relativeTime + ' video time is: ' + vidTime );
+                                       var media = $j ( '#' + 
_this.smil.getSmilElementPlayerID( smilElement ) ).get( 0 );
+                                       var mediaTime = ( !media || 
!media.currentTime )? 0 : media.currentTime;                                    
    
+                                       //mw.log( "getPlaybackSyncDelta:: 
mediaeo time should be: " + relativeTime + ' video time is: ' + vidTime );
                                        
-                                       var syncOffset = ( relativeTime 
-vidTime );
+                                       var syncOffset = ( relativeTime 
-mediaTime );
                                        if( syncOffset >  maxOutOfSync ){
                                                maxOutOfSync = syncOffset;
                                        }
@@ -92,7 +93,8 @@
                // Check for special playback types that for playback animation 
action:
                if( this.smil.getRefType( smilElement ) == 'video' 
                        || 
-                       this.smil.getRefType( smilElement ) == 'audio' ){
+                       this.smil.getRefType( smilElement ) == 'audio' )
+               {
                        this.transformMediaForPlayback( smilElement, 
animateTime );
                }
                                
@@ -186,13 +188,17 @@
         * Transform Element in an inner animation loop
         */
        transformAnimateFrame: function( smilElement, animateTime ){
-               // Video has no inner animation per-frame transforms 
-               if( this.smil.getRefType( smilElement ) != 'video' ){
+               // Audio / Video has no inner animation per-frame transforms 
+               if( this.smil.getRefType( smilElement ) != 'video' 
+                       && 
+                       this.smil.getRefType( smilElement ) != 'audio' 
+               ){
                        this.transformElement( smilElement, animateTime );      
                }
                // Update the smil Element transition:
                this.smil.getTransitions().transformTransitionOverlay( 
smilElement, animateTime );              
        },
+       
        /** 
        * Transform a smil element for a requested time.
        *
@@ -209,7 +215,8 @@
                                this.transformImageForTime( smilElement, 
animateTime );
                        break;
                        case 'video':
-                               this.transformVideoForTime( smilElement, 
animateTime );
+                       case 'audio':
+                               this.transformMediaForTime( smilElement, 
animateTime );
                        break;
                }                                       
        },
@@ -219,24 +226,24 @@
         * @param {Element} smilElement Smil video element to be transformed
         * @param {time} animateTime Relative time to be transformed
         */
-       transformVideoForTime: function( smilElement, animateTime, callback ){
+       transformMediaForTime: function( smilElement, animateTime, callback ){
                // Get the video element 
                var assetId = this.smil.getSmilElementPlayerID( smilElement );
                var vid = $j ( '#' + assetId ).get( 0 );                
                
-               var videoSeekTime = animateTime;
+               var mediaSeekTime = animateTime;
                //Add the clipBegin if set
                if( $j( smilElement ).attr( 'clipBegin') && 
                        this.smil.parseTime( $j( smilElement ).attr( 
'clipBegin') ) ) 
                {
-                       videoSeekTime += this.smil.parseTime( $j( smilElement 
).attr( 'clipBegin') );  
+                       mediaSeekTime += this.smil.parseTime( $j( smilElement 
).attr( 'clipBegin') );  
                }
                                
-               //mw.log( "SmilAnimate::transformVideoForTime:" + assetId + " 
ct:" +vid.currentTime + ' should be: ' + videoSeekTime );
+               //mw.log( "SmilAnimate::transformMediaForTime:" + assetId + " 
ct:" +vid.currentTime + ' should be: ' + mediaSeekTime );
                
                // Register a buffer ready callback
-               this.smil.getBuffer().mediaBufferSeek( smilElement, 
videoSeekTime, function() {                 
-                       //mw.log( "transformVideoForTime:: seek complete ")
+               this.smil.getBuffer().mediaBufferSeek( smilElement, 
mediaSeekTime, function() {                 
+                       //mw.log( "transformMediaForTime:: seek complete ")
                        if( callback )
                                callback();
                });

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js      
2010-09-10 20:25:46 UTC (rev 72745)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js      
2010-09-10 20:29:12 UTC (rev 72746)
@@ -129,7 +129,7 @@
                // Loop on loading until all elements are loaded
                setTimeout( function(){
                        if( _this.getBufferedPercent() == 1 ){
-                               mw.log( "smilBuffer::continueBufferLoad:: done 
loading buffer "); 
+                               mw.log( "smilBuffer::continueBufferLoad:: done 
loading buffer for " + bufferTime); 
                                return ;
                        }
                        // get the percentage buffered, translated into buffer 
time and call continueBufferLoad with a timeout
@@ -159,24 +159,25 @@
                // Start "loading" the asset (for now just video ) 
                // but in theory we could set something up with large images / 
templates etc.
                switch( this.smil.getRefType( smilElement ) ){
+                       case 'audio':
                        case 'video':
-                               var vid = $j( '#' + 
this.smil.getSmilElementPlayerID( smilElement ) ).get(0);
-                               if( !vid ){
+                               var media = $j( '#' + 
this.smil.getSmilElementPlayerID( smilElement ) ).get(0);
+                               if( !media ){
                                        break;
                                }
                                // The load request does not work very well 
instead .play() then .pause() and seek when on display
-                               // vid.load();                          
+                               // media.load();                                
                                // Since we can't use "load" across html5 
implementations do some hacks: 
-                               if( vid.paused &&  this.getVideoPercetLoaded( 
smilElement ) == 0 ){
+                               if( media.paused &&  this.getMediaPercetLoaded( 
smilElement ) == 0 ){
                                        // Issue the load / play request 
-                                       vid.play();
-                                       vid.volume = 0;                         
        
+                                       media.play();
+                                       media.volume = 0;                       
                
                                        // XXX seek to clipBegin if provided ( 
we don't need to load before that point )                                
                                } else {
                                        //mw.log("loadElement:: pause video: " 
+ this.smil.getSmilElementPlayerID( smilElement ));
                                        // else we have some percentage loaded 
pause playback 
                                        //( should continue to load the asset )
-                                       vid.pause();
+                                       media.pause();
                                }
                        break;
                }
@@ -188,11 +189,12 @@
        getElementPercentLoaded: function( smilElement ){
                switch( this.smil.getRefType( smilElement ) ){
                        case 'video':
-                               return this.getVideoPercetLoaded( smilElement );
+                       case 'audio':
+                               return this.getMediaPercetLoaded( smilElement );
                        break;
                }
                // for other ref types check if element is in the dom
-               // xxx todo hook into image loader hook
+               // xxx todo hook into image / template loaders
                if( $j( '#' + this.smil.getSmilElementPlayerID( smilElement ) 
).length == 0 ){
                        return 0;
                } else {                        
@@ -203,7 +205,7 @@
        /**
         * Get the percentage of a video asset that has been loaded 
         */
-       getVideoPercetLoaded: function ( smilElement ){
+       getMediaPercetLoaded: function ( smilElement ){
                var _this = this;
                var assetId = this.smil.getSmilElementPlayerID( smilElement );
                var $vid = $j( '#' + assetId );
@@ -362,7 +364,7 @@
                }
                // Check if _this.videoLoadedPercent is in range of duration
                // xxx might need to take into consideration startOfsset 
-               if( _this.getVideoPercetLoaded( smilVideoElement ) > 
vid.duration / time ){
+               if( _this.getMediaPercetLoaded( smilVideoElement ) > 
vid.duration / time ){
                        return true;
                }
                // not likely that the video is loaded for the requested time, 
return false

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js      
2010-09-10 20:25:46 UTC (rev 72745)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js      
2010-09-10 20:29:12 UTC (rev 72746)
@@ -518,6 +518,8 @@
                                        );                              
                                }
                        })      
+                       // Strip any links for thumbs of player
+                       $htmlLayout.find('a').attr('href', '#');
                }
                                
                



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

Reply via email to