Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js |
— | — | @@ -1,4 +1,4 @@ |
2 | | -/** |
| 2 | +/** |
3 | 3 | * The smil body also see: |
4 | 4 | * http://www.w3.org/TR/2008/REC-SMIL3-20081201/smil-structure.html#edef-body |
5 | 5 | */ |
— | — | @@ -35,12 +35,15 @@ |
36 | 36 | // Constructor: |
37 | 37 | init: function( smilObject ){ |
38 | 38 | this.smil = smilObject; |
39 | | - this.$dom = this.smil.getDom().find( 'body' ); |
40 | 39 | |
41 | 40 | // Assign ids to smil body elements |
42 | | - this.assignIds( this.$dom ); |
| 41 | + this.assignIds( this.getDom() ); |
43 | 42 | }, |
44 | 43 | |
| 44 | + getDom: function(){ |
| 45 | + return this.smil.getDom().find('body'); |
| 46 | + }, |
| 47 | + |
45 | 48 | /** |
46 | 49 | * Assigns body smil elements id (for content that has a html representation "ref" & "smilText" ) |
47 | 50 | * ( enables fast sync between smilDom and htmlDom ) |
— | — | @@ -52,7 +55,7 @@ |
53 | 56 | ){ |
54 | 57 | var idString = _this.getNodeSmilType( $node ) + '_' + _this.idIndex; |
55 | 58 | // Make sure the id does not already exist ( should be a rare case ) |
56 | | - while( this.$dom.find( '#' + idString ).length != 0 ){ |
| 59 | + while( this.getDom().find( '#' + idString ).length != 0 ){ |
57 | 60 | _this.idIndex++; |
58 | 61 | idString = _this.getNodeSmilType( $node ) + '_' + _this.idIndex; |
59 | 62 | } |
— | — | @@ -161,7 +164,7 @@ |
162 | 165 | return smallIndex = i; |
163 | 166 | } |
164 | 167 | // Build an audio timeline starting from the top level node: |
165 | | - this.getRefElementsRecurse( this.$dom, 0, function( $node ){ |
| 168 | + this.getRefElementsRecurse( this.getDom(), 0, function( $node ){ |
166 | 169 | var nodeType = _this.smil.getRefType( $node ) ; |
167 | 170 | // Check if the node is audio ( first in wins / "audio" wins over video) |
168 | 171 | if( nodeType == 'audio' || nodeType == 'video' ) { |
— | — | @@ -237,7 +240,7 @@ |
238 | 241 | time =0; |
239 | 242 | } |
240 | 243 | // Recurse on every ref element and run relevant callbacks |
241 | | - this.getRefElementsRecurse( this.$dom, 0, function( $node ){ |
| 244 | + this.getRefElementsRecurse( this.getDom(), 0, function( $node ){ |
242 | 245 | var startOffset = $node.data( 'startOffset' ); |
243 | 246 | var nodeDuration = _this.getClipDuration( $node ); |
244 | 247 | |
— | — | @@ -260,7 +263,7 @@ |
261 | 264 | */ |
262 | 265 | getSeqElements: function( $node ){ |
263 | 266 | if( ! $node ){ |
264 | | - $node = this.$dom; |
| 267 | + $node = this.getDom(); |
265 | 268 | } |
266 | 269 | return $node.find('seq'); |
267 | 270 | }, |
— | — | @@ -321,7 +324,7 @@ |
322 | 325 | * ( wraps getDurationRecurse to get top level node duration ) |
323 | 326 | */ |
324 | 327 | getDuration: function( forceRefresh ){ |
325 | | - this.duration = this.getClipDuration( this.$dom , forceRefresh); |
| 328 | + this.duration = this.getClipDuration( this.getDom() , forceRefresh); |
326 | 329 | mw.log("smilBody:: getDuration: " + this.duration ); |
327 | 330 | return this.duration; |
328 | 331 | }, |
— | — | @@ -339,7 +342,7 @@ |
340 | 343 | } |
341 | 344 | if( forceRefresh ){ |
342 | 345 | //clear out implictDuration |
343 | | - $node.data( 'implictDuration', false ); |
| 346 | + $node.data( 'implictDuration', 0); |
344 | 347 | $node.data( 'computedDuration', false ); |
345 | 348 | } |
346 | 349 | |
— | — | @@ -350,7 +353,7 @@ |
351 | 354 | var blockType = this.getNodeSmilType( $node ); |
352 | 355 | |
353 | 356 | // Recurse on children |
354 | | - if( $node.children().length ){ |
| 357 | + if( $node.children().length ){ |
355 | 358 | $node.children().each( function( inx, childNode ){ |
356 | 359 | // If in a sequence add to duration |
357 | 360 | var childDuration = _this.getClipDuration( $j( childNode ), forceRefresh ); |
— | — | @@ -363,7 +366,8 @@ |
364 | 367 | $node.data( 'implictDuration', childDuration); |
365 | 368 | } |
366 | 369 | } |
367 | | - }); |
| 370 | + }); |
| 371 | + alert( 'getting duration for ' + $node.children().length + ' children '); |
368 | 372 | } |
369 | 373 | |
370 | 374 | // Check the explicit duration attribute: |
— | — | @@ -375,7 +379,7 @@ |
376 | 380 | } |
377 | 381 | //mw.log(" return dur: " + mw.smil.parseTime( $node.attr('dur') ) ); |
378 | 382 | $node.data('computedDuration', computedDuration ); |
379 | | - } else { |
| 383 | + } else { |
380 | 384 | // Else return use implictDuration ( built from its children ) |
381 | 385 | if( $node.data( 'implictDuration' ) ){ |
382 | 386 | //mw.log(" implictDuration:: " + $node.data( 'implictDuration' ) ); |
Index: branches/MwEmbedStandAlone/modules/Sequencer/mw.Sequencer.js |
— | — | @@ -98,10 +98,11 @@ |
99 | 99 | updateSmilXML: function( smilXML ){ |
100 | 100 | mw.log("Sequencer::updateSmilXML" + smilXML); |
101 | 101 | var _this = this; |
102 | | - alert( 'before update seq len: ' + this.getSmil().$dom.find('seq').children().length ) |
| 102 | + alert( 'before Dur:' + this.getEmbedPlayer().getDuration( true ) + ' update seq len: ' + this.getSmil().$dom.find('seq').children().length ) |
103 | 103 | // Update the embedPlayer smil: |
104 | 104 | this.getSmil().updateFromString( smilXML ); |
105 | | - alert( 'after update seq len: ' + this.getSmil().$dom.find('seq').children().length ) |
| 105 | + debugger; |
| 106 | + alert( 'after Dur:' + this.getEmbedPlayer().getDuration( true ) + ' update seq len: ' + this.getSmil().$dom.find('seq').children().length ) |
106 | 107 | // Get a duration ( forceRefresh to clear the cache ) |
107 | 108 | var dur = this.getEmbedPlayer().getDuration( true ); |
108 | 109 | alert( 'restored dur should be: ' + dur); |