Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js |
— | — | @@ -89,6 +89,9 @@ |
90 | 90 | }, |
91 | 91 | /* SMIL Element out of range */ |
92 | 92 | function( smilElement ){ |
| 93 | + // Stop the animation or playback |
| 94 | + _this.smil.getAnimate().pauseAnimation( smilElement ) |
| 95 | + |
93 | 96 | // Hide the element in the layout |
94 | 97 | _this.smil.getLayout().hideElement( smilElement ); |
95 | 98 | |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js |
— | — | @@ -20,6 +20,10 @@ |
21 | 21 | * Pause any active animation or video playback |
22 | 22 | */ |
23 | 23 | pauseAnimation: function( smilElement ){ |
| 24 | + // Check if the element is in the html dom: |
| 25 | + if( !$j ( '#' + this.smil.getAssetId( smilElement ) ).length ){ |
| 26 | + return ; |
| 27 | + } |
24 | 28 | // Pause the animation of a given element ( presently just video ) |
25 | 29 | switch( this.smil.getRefType( smilElement ) ){ |
26 | 30 | case 'video': |
— | — | @@ -216,13 +220,19 @@ |
217 | 221 | // Get the video element |
218 | 222 | var assetId = this.smil.getAssetId( smilElement ); |
219 | 223 | 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 | + } |
220 | 232 | |
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 ); |
224 | 234 | |
225 | 235 | // Register a buffer ready callback |
226 | | - this.smil.getBuffer().videoBufferSeek( smilElement, animateTime, function() { |
| 236 | + this.smil.getBuffer().videoBufferSeek( smilElement, videoSeekTime, function() { |
227 | 237 | mw.log( "transformVideoForTime:: seek complete "); |
228 | 238 | }); |
229 | 239 | }, |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js |
— | — | @@ -335,6 +335,10 @@ |
336 | 336 | } |
337 | 337 | // Trim whitespace |
338 | 338 | timeValue = $j.trim( timeValue ); |
| 339 | + if( timeValue == '' ){ |
| 340 | + mw.log("Error: Empty time value "); |
| 341 | + return 0; |
| 342 | + } |
339 | 343 | |
340 | 344 | // First check for hh:mm:ss time: |
341 | 345 | if ( timeValue.split( ':' ).length == 3 || timeValue.split( ':' ).length == 2 ) { |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoClipBeginSmil.xml |
— | — | @@ -3,7 +3,7 @@ |
4 | 4 | <head> |
5 | 5 | <meta name="title" content="Simple Crossfading Example"/> |
6 | 6 | |
7 | | - <transition id="fromBlack" |
| 7 | + <transition id="" |
8 | 8 | type="fade" |
9 | 9 | subtype="fadeFromColor" |
10 | 10 | fadeColor="#000" |
— | — | @@ -11,42 +11,40 @@ |
12 | 12 | |
13 | 13 | </head> |
14 | 14 | <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> |
21 | 16 | |
22 | 17 | <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" |
26 | 20 | /> |
27 | 21 | |
| 22 | + <video src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv" |
| 23 | + dur="5s" |
| 24 | + /> |
| 25 | + |
28 | 26 | <video src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv" |
29 | 27 | transIn="fromBlack" |
30 | | - dur="2" |
31 | | - clipBegin = "16" |
| 28 | + dur="2s" |
| 29 | + clipBegin = "16s" |
32 | 30 | /> |
33 | 31 | |
34 | 32 | <video src="http://upload.wikimedia.org/wikipedia/commons/9/94/Folgers.ogv" |
35 | | - dur="3" |
36 | | - clipBegin = "16" |
| 33 | + dur="3s" |
| 34 | + clipBegin = "16s" |
37 | 35 | /> |
38 | 36 | |
39 | 37 | <video src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv" |
40 | | - dur="2" |
| 38 | + dur="5" |
41 | 39 | clipBegin = "18" |
42 | 40 | /> |
43 | 41 | |
44 | | - <!-- where does quality come from --> |
| 42 | + <!-- where does quality come from |
45 | 43 | <video src="http://upload.wikimedia.org/wikipedia/commons/8/8b/Yochai_Benkler_-_On_Autonomy%2C_Control_and_Cultural_Experience.ogg" |
46 | 44 | transIn="fromBlack" |
47 | 45 | dur="27" |
48 | 46 | clipBegin = "0:3:43" |
49 | 47 | /> |
50 | | - |
| 48 | + --> |
51 | 49 | </seq> |
52 | 50 | |
53 | 51 | </body> |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js |
— | — | @@ -113,7 +113,8 @@ |
114 | 114 | }, |
115 | 115 | |
116 | 116 | /** |
117 | | - * continueBufferLoad the buffer |
| 117 | + * continueBufferLoad the buffer |
| 118 | + * @param bufferTime The base time to load new buffer items into |
118 | 119 | */ |
119 | 120 | continueBufferLoad: function( bufferTime ){ |
120 | 121 | var _this = this; |
— | — | @@ -137,7 +138,7 @@ |
138 | 139 | }, |
139 | 140 | |
140 | 141 | /** |
141 | | - * Start loading and buffering an target smilelement |
| 142 | + * Start loading and buffering an target smilElement |
142 | 143 | */ |
143 | 144 | loadElement: function( smilElement ){ |
144 | 145 | var _this = this; |