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

Revision: 69042
Author:   dale
Date:     2010-07-05 00:32:14 +0000 (Mon, 05 Jul 2010)

Log Message:
-----------
smil clipBegin time fixes

Modified Paths:
--------------
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
    branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoClipBeginSmil.xml

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js    2010-07-05 
00:29:38 UTC (rev 69041)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js    2010-07-05 
00:32:14 UTC (rev 69042)
@@ -335,6 +335,10 @@
                }
                // Trim whitespace
                timeValue = $j.trim( timeValue );
+               if( timeValue == '' ){
+                       mw.log("Error: Empty time value ");
+                       return 0;
+               }
        
                // First check for hh:mm:ss time: 
                if ( timeValue.split( ':' ).length == 3 ||  timeValue.split( 
':' ).length == 2 ) {

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js     
2010-07-05 00:29:38 UTC (rev 69041)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js     
2010-07-05 00:32:14 UTC (rev 69042)
@@ -20,6 +20,10 @@
         * Pause any active animation or video playback
         */
        pauseAnimation: function( smilElement ){
+               // Check if the element is in the html dom: 
+               if( !$j ( '#' + this.smil.getAssetId( smilElement ) ).length ){
+                       return ;
+               }
                // Pause the animation of a given element ( presently just 
video )              
                switch( this.smil.getRefType( smilElement ) ){
                        case 'video':
@@ -216,13 +220,19 @@
                // Get the video element 
                var assetId = this.smil.getAssetId( smilElement );
                var vid = $j ( '#' + assetId ).get( 0 );                
+               
+               var videoSeekTime = 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') );  
+               }
                                
-               // Check for "start offset"                                     
-                               
-               //mw.log( "SmilAnimate::transformVideoForTime:" + assetId + " 
ct:" +vid.currentTime + ' should be: ' + animateTime );
+               mw.log( "SmilAnimate::transformVideoForTime:" + assetId + " 
ct:" +vid.currentTime + ' should be: ' + videoSeekTime );
                
                // Register a buffer ready callback
-               this.smil.getBuffer().videoBufferSeek( smilElement, 
animateTime, function() {                   
+               this.smil.getBuffer().videoBufferSeek( smilElement, 
videoSeekTime, function() {                 
                        mw.log( "transformVideoForTime:: seek complete ");
                });
        },

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js        
2010-07-05 00:29:38 UTC (rev 69041)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js        
2010-07-05 00:32:14 UTC (rev 69042)
@@ -89,6 +89,9 @@
                        },
                        /* SMIL Element out of range */
                        function( smilElement ){
+                               // Stop the animation or playback 
+                               _this.smil.getAnimate().pauseAnimation( 
smilElement )
+                               
                                // Hide the element in the layout 
                                _this.smil.getLayout().hideElement( smilElement 
);
                                

Modified: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js      
2010-07-05 00:29:38 UTC (rev 69041)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js      
2010-07-05 00:32:14 UTC (rev 69042)
@@ -113,7 +113,8 @@
        },
        
        /**
-        * continueBufferLoad the buffer 
+        * continueBufferLoad the buffer
+        * @param bufferTime The base time to load new buffer items into 
         */
        continueBufferLoad: function( bufferTime ){
                var _this = this;               
@@ -137,7 +138,7 @@
        },
        
        /**
-        * Start loading and buffering an target smilelement
+        * Start loading and buffering an target smilElement
         */
        loadElement: function( smilElement ){
                var _this = this;

Modified: 
branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoClipBeginSmil.xml
===================================================================
--- branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoClipBeginSmil.xml  
2010-07-05 00:29:38 UTC (rev 69041)
+++ branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoClipBeginSmil.xml  
2010-07-05 00:32:14 UTC (rev 69042)
@@ -3,7 +3,7 @@
   <head>
     <meta name="title" content="Simple Crossfading Example"/>
     
-    <transition id="fromBlack"
+    <transition id=""
        type="fade" 
        subtype="fadeFromColor" 
        fadeColor="#000" 
@@ -11,42 +11,40 @@
        
   </head>
   <body>
-    <seq>
-    
-    <video 
src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv";
-       transIn="fromBlack"                                     
-               dur="5"         
-       />
+    <seq>    
        
     <video 
src="http://upload.wikimedia.org/wikipedia/commons/9/94/Folgers.ogv";        
-       transIn="fromBlack"             
-               dur="2"
-               clipBegin = "16"
+               dur="2s"
+               clipBegin = "16s"
        />
        
+       <video 
src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv";
          
+               dur="5s"                
+       />      
+       
        <video 
src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv";
        transIn="fromBlack"                                     
-               dur="2"         
-               clipBegin = "16"
+               dur="2s"                
+               clipBegin = "16s"
        />
        
        <video 
src="http://upload.wikimedia.org/wikipedia/commons/9/94/Folgers.ogv";            
                 
-               dur="3"
-               clipBegin = "16"
+               dur="3s"
+               clipBegin = "16s"
        />
        
        <video 
src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv";
                          
-               dur="2"
+               dur="5"
                clipBegin = "18"
        />      
        
-    <!-- where does quality come from -->
+    <!-- where does quality come from 
        <video 
src="http://upload.wikimedia.org/wikipedia/commons/8/8b/Yochai_Benkler_-_On_Autonomy%2C_Control_and_Cultural_Experience.ogg";
             
                transIn="fromBlack"
                dur="27"
                clipBegin = "0:3:43"
        />      
-       
+       -->
     </seq>
     
   </body>



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

Reply via email to