r68696 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r68695‎ | r68696 | r68697 >
Date:01:37, 29 June 2010
Author:dale
Status:deferred
Tags:
Comment:
some smil seeking fixes
Modified paths:
  • /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/mw.SmilBuffer.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js (modified) (history)
  • /branches/MwEmbedStandAlone/modules/TimedText/mw.TimedText.js (modified) (history)
  • /branches/MwEmbedStandAlone/remotes/mediaWiki.js (modified) (history)

Diff [purge]

Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBody.js
@@ -61,6 +61,7 @@
6262 */
6363 renderTime: function( time, deltaTime ){
6464 var _this = this;
 65+ mw.log( "renderTime:: " + time );
6566
6667 // Get all the draw elements from the body this time:
6768 var elementList = this.getElementsForTime( time ,
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilLayout.js
@@ -453,7 +453,7 @@
454454 'xx-large' : '1.72em'
455455 }
456456 if( sizeMap[ cssAttributes['font-size'] ] ){
457 - cssAttributes['font-size'] = cssAttributes[ textCss['font-size'] ];
 457+ cssAttributes['font-size'] = sizeMap[ cssAttributes['font-size'] ];
458458 }
459459
460460 // 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 @@
129129 break;
130130 }
131131 },
 132+
132133 /**
133134 * Transform video for time
134135 */
@@ -135,14 +136,16 @@
136137 // get the video element
137138 var vid = $j ( '#' + this.smil.getAssetId( smilElement ) ).get(0);
138139 // Check for "start offset"
139 -
140 - // Run a seek and ( buffer automatically registers ready points )
 140+
141141 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+ } );
143146 },
144147
145148 /**
146 - * transformTextForTime
 149+ * Transform Text For Time
147150 */
148151 transformTextForTime: function( textElement, animateTime ) {
149152 //mw.log("transformTextForTime:: " + animateTime );
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.Smil.js
@@ -114,8 +114,8 @@
115115 // Update the render target with bodyElements for the requested time
116116 this.getBody().renderTime( time );
117117
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 );
120120 },
121121
122122 /**
Index: branches/MwEmbedStandAlone/modules/SmilPlayer/mw.SmilBuffer.js
@@ -7,6 +7,13 @@
88 }
99
1010 mw.SmilBuffer.prototype = {
 11+
 12+ // Stores currently loading assets.
 13+ assetLoadingSet: [],
 14+
 15+ //
 16+ assetLoadingCallbacks : [],
 17+
1118 /**
1219 * Constructor:
1320 */
@@ -17,16 +24,84 @@
1825 /**
1926 * Runs a callback once the buffer time is ready.
2027 */
21 - timeIsBuffered: function( time, callback ) {
 28+ timeIsReady: function( time, callback ) {
 29+ // Get active body elements
2230
23 - // Get active body elements
24 - //this.smil.getBody().getElementsForTime( time );
25 -
2631 // Check load status per temporal offset
2732
2833 // 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 ) );
2983
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+ }
32107 }
33108 }
\ No newline at end of file
Index: branches/MwEmbedStandAlone/modules/TimedText/mw.TimedText.js
@@ -808,7 +808,7 @@
809809 // Resize the interface for layoutMode == 'ontop' ( if not in fullscreen )
810810 // NOTE this shoudl be a call to controlBuilder not handled here inline
811811 if( ! this.embedPlayer.controlBuilder.fullscreenMode ){
812 - if( this.embedPlayer.controlBuilder.checkEmbedPlayer.OverlayControls() ){
 812+ if( this.embedPlayer.controlBuilder.checkOverlayControls() ){
813813 var playerHeight = this.embedPlayer.getHeight();
814814 } else {
815815 var playerHeight = this.embedPlayer.getHeight() + this.embedPlayer.controlBuilder.getHeight();
Index: branches/MwEmbedStandAlone/remotes/mediaWiki.js
@@ -425,7 +425,7 @@
426426 // Show the control bar for two seconds (auto play is confusing without it )
427427 embedPlayer.controlBuilder.showControlBar();
428428 // hide the controls if they should they are overlayed on the video
429 - if( embedPlayer.controlBuilder.checkEmbedPlayer.OverlayControls() ){
 429+ if( embedPlayer.controlBuilder.checkOverlayControls() ){
430430 setTimeout( function(){
431431 embedPlayer.controlBuilder.hideControlBar();
432432 }, 4000 );

Status & tagging log