Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js |
— | — | @@ -61,6 +61,7 @@ |
62 | 62 | */ |
63 | 63 | renderTime: function( time, deltaTime ){ |
64 | 64 | var _this = this; |
| 65 | + mw.log( "renderTime:: " + time ); |
65 | 66 | |
66 | 67 | // Get all the draw elements from the body this time: |
67 | 68 | var elementList = this.getElementsForTime( time , |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js |
— | — | @@ -453,7 +453,7 @@ |
454 | 454 | 'xx-large' : '1.72em' |
455 | 455 | } |
456 | 456 | if( sizeMap[ cssAttributes['font-size'] ] ){ |
457 | | - cssAttributes['font-size'] = cssAttributes[ textCss['font-size'] ]; |
| 457 | + cssAttributes['font-size'] = sizeMap[ cssAttributes['font-size'] ]; |
458 | 458 | } |
459 | 459 | |
460 | 460 | // If the font size is pixel based parent span will have no effect, |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilAnimate.js |
— | — | @@ -128,6 +128,7 @@ |
129 | 129 | break; |
130 | 130 | } |
131 | 131 | }, |
| 132 | + |
132 | 133 | /** |
133 | 134 | * Transform video for time |
134 | 135 | */ |
— | — | @@ -135,14 +136,16 @@ |
136 | 137 | // get the video element |
137 | 138 | var vid = $j ( '#' + this.smil.getAssetId( smilElement ) ).get(0); |
138 | 139 | // Check for "start offset" |
139 | | - |
140 | | - // Run a seek and ( buffer automatically registers ready points ) |
| 140 | + |
141 | 141 | mw.log( "transformVideoForTime:: ct:" +vid.currentTime + ' should be: ' + animateTime ); |
142 | | - vid.currentTime = animateTime; |
| 142 | + // Register a buffer ready callback |
| 143 | + this.smil.getBuffer().videoBufferSeek( smilElement, animateTime, function(){ |
| 144 | + mw.log( "transformVideoForTime:: seek complete "); |
| 145 | + } ); |
143 | 146 | }, |
144 | 147 | |
145 | 148 | /** |
146 | | - * transformTextForTime |
| 149 | + * Transform Text For Time |
147 | 150 | */ |
148 | 151 | transformTextForTime: function( textElement, animateTime ) { |
149 | 152 | //mw.log("transformTextForTime:: " + animateTime ); |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js |
— | — | @@ -114,8 +114,8 @@ |
115 | 115 | // Update the render target with bodyElements for the requested time |
116 | 116 | this.getBody().renderTime( time ); |
117 | 117 | |
118 | | - // Wait until buffer is ready |
119 | | - this.getBuffer().timeIsBuffered( time, callback ); |
| 118 | + // Wait until buffer is ready and run the callback |
| 119 | + this.getBuffer().addAssetsReadyCallback( callback ); |
120 | 120 | }, |
121 | 121 | |
122 | 122 | /** |
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js |
— | — | @@ -7,6 +7,13 @@ |
8 | 8 | } |
9 | 9 | |
10 | 10 | mw.SmilBuffer.prototype = { |
| 11 | + |
| 12 | + // Stores currently loading assets. |
| 13 | + assetLoadingSet: [], |
| 14 | + |
| 15 | + // |
| 16 | + assetLoadingCallbacks : [], |
| 17 | + |
11 | 18 | /** |
12 | 19 | * Constructor: |
13 | 20 | */ |
— | — | @@ -17,16 +24,84 @@ |
18 | 25 | /** |
19 | 26 | * Runs a callback once the buffer time is ready. |
20 | 27 | */ |
21 | | - timeIsBuffered: function( time, callback ) { |
| 28 | + timeIsReady: function( time, callback ) { |
| 29 | + // Get active body elements |
22 | 30 | |
23 | | - // Get active body elements |
24 | | - //this.smil.getBody().getElementsForTime( time ); |
25 | | - |
26 | 31 | // Check load status per temporal offset |
27 | 32 | |
28 | 33 | // setTimeout to call self until buffer is ready |
| 34 | + |
| 35 | + // Temp ( assume ready ); |
| 36 | + callback(); |
| 37 | + }, |
| 38 | + |
| 39 | + /** |
| 40 | + * Add a callback for when assets loaded and "ready" |
| 41 | + */ |
| 42 | + addAssetsReadyCallback: function( callback ) { |
| 43 | + mw.log( "addAssetsReadyCallback:: " + this.assetLoadingSet.length ); |
| 44 | + // if no assets are "loading" issue the callback directly: |
| 45 | + if ( this.assetLoadingSet.length == 0 ){ |
| 46 | + if( callback ) |
| 47 | + callback(); |
| 48 | + return ; |
| 49 | + } |
| 50 | + // Else we need to add a loading callback ( will be called once all the assets are ready ) |
| 51 | + this.assetLoadingCallbacks.push( callback ); |
| 52 | + }, |
| 53 | + |
| 54 | + /** |
| 55 | + * Add a asset to the loading set: |
| 56 | + * @param assetId The asset to add to loading set |
| 57 | + */ |
| 58 | + addAssetLoading: function( assetId ) { |
| 59 | + this.assetLoadingSet.push( assetId ); |
| 60 | + }, |
| 61 | + |
| 62 | + /** |
| 63 | + * Asset is ready, check queue and issue callback if empty |
| 64 | + */ |
| 65 | + assetReady: function( assetId ) { |
| 66 | + for( var i=0; i < this.assetLoadingSet.length ; i++ ){ |
| 67 | + if( assetId == this.assetLoadingSet[i] ) { |
| 68 | + this.assetLoadingSet.splice( i, 1 ); |
| 69 | + } |
| 70 | + } |
| 71 | + if( this.assetLoadingSet.length === 0 ) { |
| 72 | + while( this.assetLoadingCallbacks.length ) { |
| 73 | + this.assetLoadingCallbacks.shift()(); |
| 74 | + } |
| 75 | + } |
| 76 | + }, |
| 77 | + |
| 78 | + |
| 79 | + videoBufferSeek: function ( smilElement, seekTime, callback ){ |
| 80 | + var _this = this; |
| 81 | + // Get the video target: |
| 82 | + var $vid = $j ( '#' + this.smil.getAssetId( smilElement ) ); |
29 | 83 | |
30 | | - // Temp ( assume ready ): |
31 | | - callback(); |
| 84 | + // Add the asset to the loading set |
| 85 | + _this.addAssetLoading( $vid.attr('id' ) ); |
| 86 | + |
| 87 | + var runSeekCallback = function(){ |
| 88 | + $vid.unbind( 'seeked' ).bind( 'seeked', function(){ |
| 89 | + _this.assetReady( $vid.attr('id' ) ); |
| 90 | + if( callback ) { |
| 91 | + callback(); |
| 92 | + } |
| 93 | + }); |
| 94 | + $vid.attr('currentTime', seekTime ); |
| 95 | + } |
| 96 | + |
| 97 | + // Read the video state: http://www.w3.org/TR/html5/video.html#dom-media-have_nothing |
| 98 | + if( $vid.attr('readyState') == 0 /* HAVE_NOTHING */ ){ |
| 99 | + // Check that we have metadata ( so we can issue the seek ) |
| 100 | + $vid.unbind( 'loadedmetadata' ).bind( 'loadedmetadata', function(){ |
| 101 | + runSeekCallback(); |
| 102 | + } ); |
| 103 | + }else { |
| 104 | + // Already have metadata directly issue the seek with callback |
| 105 | + runSeekCallback(); |
| 106 | + } |
32 | 107 | } |
33 | 108 | } |
\ No newline at end of file |
Index: branches/MwEmbedStandAlone/modules/TimedText/mw.TimedText.js |
— | — | @@ -808,7 +808,7 @@ |
809 | 809 | // Resize the interface for layoutMode == 'ontop' ( if not in fullscreen ) |
810 | 810 | // NOTE this shoudl be a call to controlBuilder not handled here inline |
811 | 811 | if( ! this.embedPlayer.controlBuilder.fullscreenMode ){ |
812 | | - if( this.embedPlayer.controlBuilder.checkEmbedPlayer.OverlayControls() ){ |
| 812 | + if( this.embedPlayer.controlBuilder.checkOverlayControls() ){ |
813 | 813 | var playerHeight = this.embedPlayer.getHeight(); |
814 | 814 | } else { |
815 | 815 | var playerHeight = this.embedPlayer.getHeight() + this.embedPlayer.controlBuilder.getHeight(); |
Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js |
— | — | @@ -425,7 +425,7 @@ |
426 | 426 | // Show the control bar for two seconds (auto play is confusing without it ) |
427 | 427 | embedPlayer.controlBuilder.showControlBar(); |
428 | 428 | // hide the controls if they should they are overlayed on the video |
429 | | - if( embedPlayer.controlBuilder.checkEmbedPlayer.OverlayControls() ){ |
| 429 | + if( embedPlayer.controlBuilder.checkOverlayControls() ){ |
430 | 430 | setTimeout( function(){ |
431 | 431 | embedPlayer.controlBuilder.hideControlBar(); |
432 | 432 | }, 4000 ); |