Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js |
— | — | @@ -152,8 +152,8 @@ |
153 | 153 | if( $j( '#' + this.smil.getAssetId( smilElement ) ).length == 0 ){ |
154 | 154 | // Draw the element |
155 | 155 | _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 ) |
158 | 158 | _this.smil.getLayout().hideElement( smilElement ); |
159 | 159 | mw.log('loadElement::Add:' + this.smil.getAssetId( smilElement )+ ' len: ' + $j( '#' + this.smil.getAssetId( smilElement ) ).length ); |
160 | 160 | } |
— | — | @@ -296,7 +296,10 @@ |
297 | 297 | * Clip ready for grabbing a frame such as a canvas thumb |
298 | 298 | */ |
299 | 299 | 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; |
301 | 304 | if( $j( smilElement ).attr('clipBegin') ){ |
302 | 305 | absoluteTime += this.smil.parseTime( $j( smilElement ).attr('clipBegin') ); |
303 | 306 | } |
— | — | @@ -370,6 +373,7 @@ |
371 | 374 | */ |
372 | 375 | registerVideoSeekListener: function( assetId ){ |
373 | 376 | var _this = this; |
| 377 | + mw.log( 'SmilBuffer::registerVideoSeekListener: ' + assetId ); |
374 | 378 | var vid = $j ( '#' + assetId).get(0); |
375 | 379 | vid.addEventListener( 'seeked', function(){ |
376 | 380 | // Run the callback |
— | — | @@ -394,11 +398,13 @@ |
395 | 399 | |
396 | 400 | videoBufferSeek: function ( smilElement, seekTime, callback ){ |
397 | 401 | var _this = this; |
| 402 | + mw.log("SmilBuffer::videoBufferSeek: " + this.smil.getAssetId( smilElement ) + |
| 403 | + ' time:' + seekTime ); |
398 | 404 | |
399 | 405 | // Get the asset target: |
400 | 406 | var assetId = this.smil.getAssetId( smilElement ); |
401 | 407 | |
402 | | - // make sure the target video is in the dom: |
| 408 | + // Make sure the target video is in the dom: |
403 | 409 | this.loadElement( smilElement ); |
404 | 410 | |
405 | 411 | var $vid = $j ( '#' + assetId); |
— | — | @@ -413,20 +419,26 @@ |
414 | 420 | _this.videoSeekListeners[ assetId ]= {}; |
415 | 421 | }; |
416 | 422 | |
417 | | - if( !_this.videoSeekListeners[ assetId ].listen ){ |
| 423 | + if( ! _this.videoSeekListeners[ assetId ].listen ){ |
418 | 424 | _this.videoSeekListeners[ assetId ].listen = true; |
419 | 425 | _this.registerVideoSeekListener( assetId ); |
420 | 426 | } |
| 427 | + |
421 | 428 | // 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 ) |
424 | 434 | _this.assetReady( assetId ); |
| 435 | + |
425 | 436 | // Run the callback |
426 | 437 | if( callback ){ |
427 | 438 | callback(); |
428 | 439 | } |
429 | | - } |
430 | | - // Issue the seek |
| 440 | + } |
| 441 | + |
| 442 | + // Issue the seek |
431 | 443 | vid.currentTime = seekTime; |
432 | 444 | } |
433 | 445 | |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerTimeline.js |
— | — | @@ -94,29 +94,9 @@ |
95 | 95 | //_this.getTracksContainer().find('.timelineClip').removeClass( 'selectedClip' ); |
96 | 96 | }) |
97 | 97 | } |
98 | | - */ |
99 | | - // Load and display all clip thumbnails |
100 | | - this.drawTrackThumbs( trackIndex, sequenceNode, trackType ); |
| 98 | + */ |
101 | 99 | }, |
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 | + |
121 | 101 | /** |
122 | 102 | * add Track Clips and Interface binding |
123 | 103 | */ |
— | — | @@ -165,6 +145,7 @@ |
166 | 146 | } |
167 | 147 | var $previusClip = null; |
168 | 148 | smil.getBody().getRefElementsRecurse( sequenceNode, startOffset, function( $node ){ |
| 149 | + var reRenderThumbFlag = false; |
169 | 150 | // Draw the node onto the timeline if the clip is not already there: |
170 | 151 | if( $clipTrackSet.find('#' + _this.getTimelineClipId( $node ) ).length == 0 ){ |
171 | 152 | var $timelineClip = $j('<li />') |
— | — | @@ -188,8 +169,19 @@ |
189 | 170 | $clipTrackSet.prepend( |
190 | 171 | $timelineClip |
191 | 172 | ); |
192 | | - } |
| 173 | + } |
| 174 | + reRenderThumbFlag = true; |
193 | 175 | } |
| 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 | + } |
194 | 186 | // Update the $previusClip |
195 | 187 | $previusClip = $clipTrackSet.find('#' + _this.getTimelineClipId( $node ) ); |
196 | 188 | }) |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.SequencerActionsEdit.js |
— | — | @@ -45,6 +45,7 @@ |
46 | 46 | * Apply a smil xml transform state ( to support undo / redo ) |
47 | 47 | */ |
48 | 48 | registerEdit: function(){ |
| 49 | + mw.log( 'ActionsEdit::registerEdit: ' + this.sequencer.getSmil().getXMLString() ); |
49 | 50 | // Throw away any edit history after the current editIndex: |
50 | 51 | if( this.editStack.length && this.editIndex > this.editStack.length ) { |
51 | 52 | this.editStack = this.editStack.splice(0, this.editIndex); |