r70291 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r70290‎ | r70291 | r70292 >
Date:20:20, 1 August 2010
Author:dale
Status:deferred
Tags:
Comment:
* improved undo delete support
* fixed multiple buffered seeks on same asset bug
* integrated drawTrackThumbs into drawTrackClipsInterface to better support updating thumbs of timeline assets that have changed in latest draw update
Modified paths:
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
@@ -152,8 +152,8 @@
153153 if( $j( '#' + this.smil.getAssetId( smilElement ) ).length == 0 ){
154154 // Draw the element
155155 _this.smil.getLayout().drawElement( smilElement );
156 - // hide the element ( in most browsers this should not cause a flicker
157 - // because dom update are enforced at a given framerate
 156+ // Hide the element ( in modern browsers this should not cause a flicker
 157+ // because DOM update are displayed at a given dom draw rate )
158158 _this.smil.getLayout().hideElement( smilElement );
159159 mw.log('loadElement::Add:' + this.smil.getAssetId( smilElement )+ ' len: ' + $j( '#' + this.smil.getAssetId( smilElement ) ).length );
160160 }
@@ -296,7 +296,10 @@
297297 * Clip ready for grabbing a frame such as a canvas thumb
298298 */
299299 bufferedSeek: function( smilElement, relativeTime, callback ){
300 - var absoluteTime = relativeTime;
 300+ mw.log("SmilBuffer::bufferedSeek:" + this.smil.getAssetId( smilElement ) +
 301+ ' time:' + relativeTime );
 302+
 303+ var absoluteTime = relativeTime;
301304 if( $j( smilElement ).attr('clipBegin') ){
302305 absoluteTime += this.smil.parseTime( $j( smilElement ).attr('clipBegin') );
303306 }
@@ -370,6 +373,7 @@
371374 */
372375 registerVideoSeekListener: function( assetId ){
373376 var _this = this;
 377+ mw.log( 'SmilBuffer::registerVideoSeekListener: ' + assetId );
374378 var vid = $j ( '#' + assetId).get(0);
375379 vid.addEventListener( 'seeked', function(){
376380 // Run the callback
@@ -394,11 +398,13 @@
395399
396400 videoBufferSeek: function ( smilElement, seekTime, callback ){
397401 var _this = this;
 402+ mw.log("SmilBuffer::videoBufferSeek: " + this.smil.getAssetId( smilElement ) +
 403+ ' time:' + seekTime );
398404
399405 // Get the asset target:
400406 var assetId = this.smil.getAssetId( smilElement );
401407
402 - // make sure the target video is in the dom:
 408+ // Make sure the target video is in the dom:
403409 this.loadElement( smilElement );
404410
405411 var $vid = $j ( '#' + assetId);
@@ -413,20 +419,26 @@
414420 _this.videoSeekListeners[ assetId ]= {};
415421 };
416422
417 - if( !_this.videoSeekListeners[ assetId ].listen ){
 423+ if( ! _this.videoSeekListeners[ assetId ].listen ){
418424 _this.videoSeekListeners[ assetId ].listen = true;
419425 _this.registerVideoSeekListener( assetId );
420426 }
 427+
421428 // Update the current context callback
422 - _this.videoSeekListeners[ assetId ].callback = function(){
423 - // Fire the asset ready event :
 429+ _this.videoSeekListeners[ assetId ].callback = function(){
 430+ // Seek has completed open up seek Listeners for future seeks
 431+ _this.videoSeekListeners[ assetId ].listen = false;
 432+
 433+ // Set this asset to ready ( asset ready set )
424434 _this.assetReady( assetId );
 435+
425436 // Run the callback
426437 if( callback ){
427438 callback();
428439 }
429 - }
430 - // Issue the seek
 440+ }
 441+
 442+ // Issue the seek
431443 vid.currentTime = seekTime;
432444 }
433445
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js
@@ -94,29 +94,9 @@
9595 //_this.getTracksContainer().find('.timelineClip').removeClass( 'selectedClip' );
9696 })
9797 }
98 - */
99 - // Load and display all clip thumbnails
100 - this.drawTrackThumbs( trackIndex, sequenceNode, trackType );
 98+ */
10199 },
102 -
103 - drawTrackThumbs: function( trackIndex, sequenceNode, trackType ){
104 - var _this = this;
105 - var smil = this.sequencer.getSmil();
106 -
107 - // Get all the refs that are children of the sequenceNode with associated offsets and durations
108 - // for now assume all tracks start at zero:
109 - var startOffset = 0;
110 -
111 - // For every ref node in this sequence draw its thumb:
112 - smil.getBody().getRefElementsRecurse( sequenceNode, startOffset, function( $node ){
113 - mw.log('SequenceTimeline::drawTrackThumbs:' + $node.attr('id') );
114 - // Check Buffer for when the first frame of the smilNode can be grabbed:
115 - smil.getBuffer().bufferedSeek( $node, 0, function(){
116 - //mw.log("getTrackClipInterface::bufferedSeek for " + smil.getAssetId( $node ));
117 - _this.drawClipThumb( $node , 0);
118 - });
119 - });
120 - },
 100+
121101 /**
122102 * add Track Clips and Interface binding
123103 */
@@ -165,6 +145,7 @@
166146 }
167147 var $previusClip = null;
168148 smil.getBody().getRefElementsRecurse( sequenceNode, startOffset, function( $node ){
 149+ var reRenderThumbFlag = false;
169150 // Draw the node onto the timeline if the clip is not already there:
170151 if( $clipTrackSet.find('#' + _this.getTimelineClipId( $node ) ).length == 0 ){
171152 var $timelineClip = $j('<li />')
@@ -188,8 +169,19 @@
189170 $clipTrackSet.prepend(
190171 $timelineClip
191172 );
192 - }
 173+ }
 174+ reRenderThumbFlag = true;
193175 }
 176+ // xxx Check if the start time was changed
 177+
 178+ if ( reRenderThumbFlag ){
 179+ // issue a draw Thumb request ( since we reinserted into the dom )
 180+ // Check Buffer for when the first frame of the smilNode can be grabbed:
 181+ smil.getBuffer().bufferedSeek( $node, 0, function(){
 182+ //mw.log("getTrackClipInterface::bufferedSeek for " + smil.getAssetId( $node ));
 183+ _this.drawClipThumb( $node , 0);
 184+ });
 185+ }
194186 // Update the $previusClip
195187 $previusClip = $clipTrackSet.find('#' + _this.getTimelineClipId( $node ) );
196188 })
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js
@@ -45,6 +45,7 @@
4646 * Apply a smil xml transform state ( to support undo / redo )
4747 */
4848 registerEdit: function(){
 49+ mw.log( 'ActionsEdit::registerEdit: ' + this.sequencer.getSmil().getXMLString() );
4950 // Throw away any edit history after the current editIndex:
5051 if( this.editStack.length && this.editIndex > this.editStack.length ) {
5152 this.editStack = this.editStack.splice(0, this.editIndex);

Status & tagging log