r69061 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r69060‎ | r69061 | r69062 >
Date:18:35, 5 July 2010
Author:dale
Status:deferred
Tags:
Comment:
improved clipBegin support
Modified paths:
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.FirefoggRender.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js (modified) (history)
  • /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/tests/VideoClipBegin.html (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoClipBeginSmil.xml (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoCrossFade.html (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
@@ -28,7 +28,8 @@
2929 'audio' : 'ref',
3030 'img' : 'ref',
3131 'textstream' : 'ref',
32 - 'video' : 'ref'
 32+ 'video' : 'ref',
 33+ 'smiltext' : 'ref'
3334 },
3435
3536 // Constructor:
@@ -162,7 +163,7 @@
163164 'src' : _this.smil.getAssetUrl ( $node.attr('src') ),
164165 'duration' : _this.getNodeDuration( $node ),
165166 'startTime' : $node.data( 'startOffset' ),
166 - 'offset' : 0 // have to add in media-offset support
 167+ 'offset' : _this.smil.parseTime( $node.attr( 'clipBegin') )
167168 };
168169
169170 // If audioTimeline is empty insert directly
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js
@@ -331,7 +331,7 @@
332332 if( !animateInRange ) {
333333 if( animateTime == 0 ) {
334334 // just a hack for now ( should read from previous animation or from source attribute
335 - //this.updateElementLayout( smilImgElement, { 'top':1,'left':1,'width':1, 'height':1 } );
 335+ // this.updateElementLayout( smilImgElement, { 'top':1,'left':1,'width':1, 'height':1 } );
336336 var $target = $j( '#' + this.smil.getAssetId( smilImgElement ));
337337 $target.css( {
338338 'top' : '0px',
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
@@ -326,22 +326,24 @@
327327 * DIGIT ::= [0-9]
328328 *
329329 * @param {mixed} timeValue time value of smil structure
330 - * @ return {float} Seconds from time value
 330+ * @return {float} Seconds from time value, if timeValue is empty or null return 0
331331 */
332332 parseTime : function( timeValue ){
333 - // If timeValue is already a number return seconds:
 333+ if( !timeValue )
 334+ return 0;
 335+
 336+ // If timeValue is already a clean number of seconds, return seconds:
334337 if( ! isNaN( timeValue ) ){
335338 return parseFloat( timeValue );
336339 }
337 - // Trim whitespace
 340+ // Trim whitespace if empty return zero
338341 timeValue = $j.trim( timeValue );
339 - if( timeValue == '' ){
340 - mw.log("Error: Empty time value ");
 342+ if( timeValue == '' ){
341343 return 0;
342344 }
343345
344346 // First check for hh:mm:ss time:
345 - if ( timeValue.split( ':' ).length == 3 || timeValue.split( ':' ).length == 2 ) {
 347+ if ( timeValue.split( ':' ).length == 3 || timeValue.split( ':' ).length == 2 ) {
346348 return mw.npt2seconds( timeValue );
347349 }
348350
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoCrossFade.html
@@ -18,24 +18,18 @@
1919 $j('#videoCrossfade').get(0).load();
2020 return false;
2121 });
22 - $j('#renderToFile').click(function(){
23 - $j(this).empty().unbind().after(
24 - $j('<span />').text( ' ' ),
25 - $j('<span />').attr('id', 'targetFoggStatus' )
26 - );
27 -
 22+ $j('#renderToFile').click(function(){
2823 // xxx for local rendering 'AddMedia.firefogg' is overkill
29 - // but will have to clean up modularity later
30 -
 24+ // but will have to clean up modularity later
3125 mw.load( ['AddMedia.firefogg','mw.FirefoggRender'],function(){
32 - var foggRender = $j('#videoCrossfade').firefoggRender({
 26+ var foggRender = $j('#videoClipBegin').firefoggRender({
3327 'statusTarget': '#targetFoggStatus'
3428 });
35 - foggRender.doRender();
36 -
37 - $j('#renderToFile').text('Stop Render').click(function(){
38 - foggRender.stopRender();
39 - });
 29+ if( foggRender.doRender() ){
 30+ $j('#renderToFile').text('Stop Render').click(function(){
 31+ foggRender.stopRender();
 32+ });
 33+ }
4034 })
4135 return false;
4236 });
@@ -52,7 +46,7 @@
5347 <p></p>seek to <input id="seekInputTime" size="4" value = "6"></input><span id="seekInProgress" style="display: none"> Seeking<blink>...</blink></span>
5448 <br/>
5549 <a id="startBuffer" href="#">Start buffering</a> <br>
56 -<a id="renderToFile" href="#">Render to file</a>
 50+<a id="renderToFile" href="#">Render to file</a> <span id="targetFoggStatus"></span>
5751 </td>
5852 <td valign="top">
5953 Sample playlist code:
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoClipBegin.html
@@ -18,24 +18,18 @@
1919 $j('#videoClipBegin').get(0).load();
2020 return false;
2121 });
22 - $j('#renderToFile').click(function(){
23 - $j(this).empty().unbind().after(
24 - $j('<span />').text( ' ' ),
25 - $j('<span />').attr('id', 'targetFoggStatus' )
26 - );
27 -
 22+ $j('#renderToFile').click(function(){
2823 // xxx for local rendering 'AddMedia.firefogg' is overkill
29 - // but will have to clean up modularity later
30 -
 24+ // but will have to clean up modularity later
3125 mw.load( ['AddMedia.firefogg','mw.FirefoggRender'],function(){
3226 var foggRender = $j('#videoClipBegin').firefoggRender({
3327 'statusTarget': '#targetFoggStatus'
3428 });
35 - foggRender.doRender();
36 -
37 - $j('#renderToFile').text('Stop Render').click(function(){
38 - foggRender.stopRender();
39 - });
 29+ if( foggRender.doRender() ){
 30+ $j('#renderToFile').text('Stop Render').click(function(){
 31+ foggRender.stopRender();
 32+ });
 33+ }
4034 })
4135 return false;
4236 });
@@ -52,7 +46,7 @@
5347 <p></p>seek to <input id="seekInputTime" size="4" value = "6"></input><span id="seekInProgress" style="display: none"> Seeking<blink>...</blink></span>
5448 <br/>
5549 <a id="startBuffer" href="#">Start buffering</a> <br>
56 -<a id="renderToFile" href="#">Render to file</a>
 50+<a id="renderToFile" href="#">Render to file</a> <span id="targetFoggStatus"></span>
5751 </td>
5852 <td valign="top">
5953 Sample playlist code:
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/tests/VideoClipBeginSmil.xml
@@ -14,14 +14,14 @@
1515 <seq>
1616
1717 <video src="http://upload.wikimedia.org/wikipedia/commons/9/94/Folgers.ogv"
18 - dur="2s"
19 - clipBegin = "16s"
20 - />
 18+ dur="5s"
 19+ clipBegin = "17s"
 20+ />
2121
2222 <video src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv"
23 - dur="5s"
 23+ dur="1s"
2424 />
25 -
 25+
2626 <video src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv"
2727 transIn="fromBlack"
2828 dur="2s"
@@ -34,17 +34,16 @@
3535 />
3636
3737 <video src="http://upload.wikimedia.org/wikipedia/commons/1/14/Independence_Day%2C_1940_Promotion.ogv"
38 - dur="5"
 38+ dur="2"
3939 clipBegin = "18"
4040 />
4141
42 - <!-- where does quality come from
4342 <video src="http://upload.wikimedia.org/wikipedia/commons/8/8b/Yochai_Benkler_-_On_Autonomy%2C_Control_and_Cultural_Experience.ogg"
4443 transIn="fromBlack"
45 - dur="27"
 44+ dur="10"
4645 clipBegin = "0:3:43"
47 - />
48 - -->
 46+ />
 47+
4948 </seq>
5049
5150 </body>
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.EmbedPlayerSmil.js
@@ -99,7 +99,7 @@
100100 // If no render target exist create one:
101101 $j( this ).html(
102102 $j( '<div />')
103 - .attr('id', 'smilCanvas_' + this.id )
 103+ .attr( 'id', 'smilCanvas_' + this.id )
104104 .css( {
105105 'width' : '100%',
106106 'height' : '100%',
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.FirefoggRender.js
@@ -87,7 +87,10 @@
8888 // Start rendering
8989 doRender: function() {
9090 var _this = this;
91 -
 91+ // Make sure we get a target destination
 92+ if( !_this.fogg.saveVideoAs() ){
 93+ return false;
 94+ }
9295 // Set the render time to "startTime" of the render request
9396 this.renderTime = this.startTime;
9497
@@ -118,12 +121,10 @@
119122
120123 // Update previusAudioTime
121124 previusAudioTime = currentAudio.startTime + currentAudio.duration;
122 - }
123 -
124 - // Now issue the save video as call
125 - _this.fogg.saveVideoAs();
126 -
127 - _this.doNextFrame();
 125+ }
 126+ // Now issue the save video as call
 127+ _this.doNextFrame();
 128+ return true;
128129 },
129130
130131 /**

Status & tagging log