r69042 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69041‎ | r69042 | r69043 >
Date:00:32, 5 July 2010
Author:dale
Status:deferred
Tags:
Comment:
smil clipBegin time fixes
Modified paths:
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoClipBeginSmil.xml (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
@@ -89,6 +89,9 @@
9090 },
9191 /* SMIL Element out of range */
9292 function( smilElement ){
 93+ // Stop the animation or playback
 94+ _this.smil.getAnimate().pauseAnimation( smilElement )
 95+
9396 // Hide the element in the layout
9497 _this.smil.getLayout().hideElement( smilElement );
9598
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
@@ -20,6 +20,10 @@
2121 * Pause any active animation or video playback
2222 */
2323 pauseAnimation: function( smilElement ){
 24+ // Check if the element is in the html dom:
 25+ if( !$j ( '#' + this.smil.getAssetId( smilElement ) ).length ){
 26+ return ;
 27+ }
2428 // Pause the animation of a given element ( presently just video )
2529 switch( this.smil.getRefType( smilElement ) ){
2630 case 'video':
@@ -216,13 +220,19 @@
217221 // Get the video element
218222 var assetId = this.smil.getAssetId( smilElement );
219223 var vid = $j ( '#' + assetId ).get( 0 );
 224+
 225+ var videoSeekTime = animateTime;
 226+ //Add the clipBegin if set
 227+ if( $j( smilElement ).attr( 'clipBegin') &&
 228+ this.smil.parseTime( $j( smilElement ).attr( 'clipBegin') ) )
 229+ {
 230+ videoSeekTime += this.smil.parseTime( $j( smilElement ).attr( 'clipBegin') );
 231+ }
220232
221 - // Check for "start offset"
222 -
223 - //mw.log( "SmilAnimate::transformVideoForTime:" + assetId + " ct:" +vid.currentTime + ' should be: ' + animateTime );
 233+ mw.log( "SmilAnimate::transformVideoForTime:" + assetId + " ct:" +vid.currentTime + ' should be: ' + videoSeekTime );
224234
225235 // Register a buffer ready callback
226 - this.smil.getBuffer().videoBufferSeek( smilElement, animateTime, function() {
 236+ this.smil.getBuffer().videoBufferSeek( smilElement, videoSeekTime, function() {
227237 mw.log( "transformVideoForTime:: seek complete ");
228238 });
229239 },
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
@@ -335,6 +335,10 @@
336336 }
337337 // Trim whitespace
338338 timeValue = $j.trim( timeValue );
 339+ if( timeValue == '' ){
 340+ mw.log("Error: Empty time value ");
 341+ return 0;
 342+ }
339343
340344 // First check for hh:mm:ss time:
341345 if ( timeValue.split( ':' ).length == 3 || timeValue.split( ':' ).length == 2 ) {
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoClipBeginSmil.xml
@@ -3,7 +3,7 @@
44 <head>
55 <meta name="title" content="Simple Crossfading Example"/>
66
7 - <transition id="fromBlack"
 7+ <transition id=""
88 type="fade"
99 subtype="fadeFromColor"
1010 fadeColor="#000"
@@ -11,42 +11,40 @@
1212
1313 </head>
1414 <body>
15 - <seq>
16 -
17 - <video src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv"
18 - transIn="fromBlack"
19 - dur="5"
20 - />
 15+ <seq>
2116
2217 <video src="http://upload.wikimedia.org/wikipedia/commons/9/94/Folgers.ogv"
23 - transIn="fromBlack"
24 - dur="2"
25 - clipBegin = "16"
 18+ dur="2s"
 19+ clipBegin = "16s"
2620 />
2721
 22+ <video src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv"
 23+ dur="5s"
 24+ />
 25+
2826 <video src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv"
2927 transIn="fromBlack"
30 - dur="2"
31 - clipBegin = "16"
 28+ dur="2s"
 29+ clipBegin = "16s"
3230 />
3331
3432 <video src="http://upload.wikimedia.org/wikipedia/commons/9/94/Folgers.ogv"
35 - dur="3"
36 - clipBegin = "16"
 33+ dur="3s"
 34+ clipBegin = "16s"
3735 />
3836
3937 <video src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv"
40 - dur="2"
 38+ dur="5"
4139 clipBegin = "18"
4240 />
4341
44 - <!-- where does quality come from -->
 42+ <!-- where does quality come from
4543 <video src="http://upload.wikimedia.org/wikipedia/commons/8/8b/Yochai_Benkler_-_On_Autonomy%2C_Control_and_Cultural_Experience.ogg"
4644 transIn="fromBlack"
4745 dur="27"
4846 clipBegin = "0:3:43"
4947 />
50 -
 48+ -->
5149 </seq>
5250
5351 </body>
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
@@ -113,7 +113,8 @@
114114 },
115115
116116 /**
117 - * continueBufferLoad the buffer
 117+ * continueBufferLoad the buffer
 118+ * @param bufferTime The base time to load new buffer items into
118119 */
119120 continueBufferLoad: function( bufferTime ){
120121 var _this = this;
@@ -137,7 +138,7 @@
138139 },
139140
140141 /**
141 - * Start loading and buffering an target smilelement
 142+ * Start loading and buffering an target smilElement
142143 */
143144 loadElement: function( smilElement ){
144145 var _this = this;

Status & tagging log