r66056 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r66055‎ | r66056 | r66057 >
Date:23:01, 7 May 2010
Author:dale
Status:deferred
Tags:
Comment:
some updates for seeking in flash player
Modified paths:
  • /branches/js2-work/phase3/js/mwEmbed/includes/cache/README (deleted) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/kplayerEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/loader.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/nativeEmbed.js (modified) (history)
  • /branches/js2-work/phase3/js/mwEmbed/tests/Firefogg_GUI.html (modified) (history)

Diff [purge]

Index: branches/js2-work/phase3/js/mwEmbed/tests/Firefogg_GUI.html
@@ -4,7 +4,8 @@
55 <title>Firefogg - Make Ogg Video in your Browser</title>
66 <script type="text/javascript" src="../jsScriptLoader.php?class=window.jQuery,mwEmbed"></script>
77 <!-- <script type="text/javascript" src="../mwEmbed.js?debug=true"></script> -->
8 -<style type="text/css" media="all">body {
 8+<style type="text/css" media="all">
 9+body {
910 margin: 0;
1011 padding: 0;
1112 font-family: Vera Sans, sans-serif;
Index: branches/js2-work/phase3/js/mwEmbed/includes/cache/README
@@ -1,10 +0,0 @@
2 -This folder holds cached versions of grouped script requests
3 -
4 -Be sure to enable write access by your web-server to this directory.
5 -
6 -You can empty this directory at any time and should not be a problem.
7 -
8 -
9 -For convenience in releases I include embedPlayerAll.min.js for performance
10 -static version deployment where you might not have php available.
11 -
Index: branches/js2-work/phase3/js/mwEmbed/modules/AddMedia/loader.js
@@ -1,7 +1,6 @@
22 /*
33 * Loader for libAddMedia module:
44 */
5 -
65 // Scope everything in "mw" ( keeps the global namespace clean )
76 ( function( mw ) {
87
@@ -37,7 +36,7 @@
3837 var request = [
3938 [
4039 'mw.UploadForm',
41 - '$j.ui'
 40+ '$j.ui'
4241 ],
4342 [
4443 '$j.ui.datepicker'
@@ -129,7 +128,7 @@
130129 mw.load( request, function() {
131130 callback( 'AddMedia.FirefoggGUI' );
132131 });
133 - } );
 132+ } );
134133
135134 mw.addModuleLoader( 'AddMedia.firefoggRender', function( callback ) {
136135 mw.load( [
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/kplayerEmbed.js
@@ -81,9 +81,9 @@
8282 postEmbedJS:function() {
8383 var _this = this;
8484 this.getPlayerElement();
85 -
86 - //alert( this.playerElement );
 85+
8786 if( this.playerElement && this.playerElement.addJsListener ) {
 87+ mw.log( 'flash:postEmbedJS::');
8888
8989 // Add KDP listeners
9090 _this.bindPlayerFunction( 'doPause', 'onPause' );
@@ -167,14 +167,16 @@
168168
169169 /**
170170 * Issues a seek to the playerElement
 171+ * @param {Float} percentage Percentage of total stream length to seek to
171172 */
172 - doSeek: function( prec ) {
 173+ doSeek: function( percentage ) {
173174 var _this = this;
174175 if( this.playerElement ) {
175 - var seek_time = prec * this.getDuration();
 176+ var seekTime = percentage * this.getDuration();
176177
177178 // Issue the seek to the flash player:
178 - this.playerElement.sendNotification('doSeek', seek_time);
 179+ this.playerElement.sendNotification('doSeek', seekTime);
 180+
179181 // Kdp is missing seek done callback
180182 setTimeout(function() {
181183 _this.seeking= false;
@@ -185,12 +187,48 @@
186188 }
187189 this.monitor();
188190
189 - // Run the onSeek interface update
190 - this.onSeek();
 191+ // Run the onSeeking interface update
 192+ this.ctrlBuilder.onSeek();
191193 },
192194
193195 /**
 196+ * Seek in a existing stream
 197+ *
 198+ * @param {Float} percentage Percentage of the stream to seek to between 0 and 1
 199+ */
 200+ doPlayThenSeek: function( percentage ) {
 201+ mw.log( 'flash::doPlayThenSeek::' );
 202+ var _this = this;
 203+ // issue the play request
 204+ this.play();
 205+
 206+ // let the player know we are seeking
 207+ _this.seeking = true;
 208+
 209+ var getPlayerCount = 0;
 210+ var readyForSeek = function() {
 211+ _this.getPlayerElement();
 212+ // if we have duration then we are ready to do the seek ( flash can't seek untill there is some buffer )
 213+ if ( _this.playerElement && _this.playerElement.sendNotification && _this.getDuration() && _this.bufferedPercent ) {
 214+ var seekTime = percentage * _this.getDuration();
 215+ // Issue the seek to the flash player:
 216+ _this.playerElement.sendNotification('doSeek', seekTime);
 217+ } else {
 218+ // Try to get player for 20 seconds:
 219+ if ( getPlayerCount < 400 ) {
 220+ setTimeout( readyForSeek, 50 );
 221+ getPlayerCount++;
 222+ } else {
 223+ mw.log( 'Error:doPlayThenSeek failed' );
 224+ }
 225+ }
 226+ }
 227+ readyForSeek();
 228+ },
 229+
 230+ /**
194231 * Issues a volume update to the playerElement
 232+ * @param {Float} percentage Percentage to update volume to
195233 */
196234 updateVolumen: function( percentage ) {
197235 if( this.playerElement && this.playerElement.sendNotification ){
@@ -213,7 +251,7 @@
214252 },
215253
216254 /**
217 - * function called by falsh when download bytes changes
 255+ * function called by flash applet when download bytes changes
218256 */
219257 onBytesDownloadedChange: function( data, id){
220258 this.bytesLoaded = data.newValue;
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/loader.js
@@ -146,7 +146,7 @@
147147 //$j( element ).hide();
148148 });
149149 // Load the embedPlayer module ( then run queued hooks )
150 - mw.load( 'EmbedPlayer', function ( ) {
 150+ mw.load( 'EmbedPlayer', function ( ) {
151151 // Rewrite the rewritePlayerTags with the
152152 $j( mw.getConfig( 'rewritePlayerTags' ) ).embedPlayer();
153153 // Run the setup callback now that we have setup all the players
@@ -201,7 +201,7 @@
202202 playerSkins[ mw.valid_skins[ n ] ] = true;
203203 }
204204 }
205 - mw.runHook( 'LoaderEmbedPlayerVisitTag', playerElement );
 205+ $j( mw ).trigger( 'LoaderEmbedPlayerVisitTag', playerElement );
206206 } );
207207
208208 // Add the player skins css and js to the load request:
@@ -229,7 +229,7 @@
230230 }
231231
232232 // Run the EmbedPlayer loader hook ( so that modules can add dependencies to the request )
233 - mw.runHook( 'LoaderEmbedPlayerUpdateRequest', dependencyRequest[ 0 ] );
 233+ $j( mw ).trigger( 'LoaderEmbedPlayerUpdateRequest', [ dependencyRequest[ 0 ] ] );
234234
235235
236236 // Load the video libs:
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/mw.EmbedPlayer.js
@@ -240,7 +240,7 @@
241241 * Rewrites all tags via a given selector
242242 *
243243 * @param [ Optional ] {Object} attributes The embedPlayer options for the given video interface.
244 - * Attributes Object can inclue any key value pair that would otherwise be
 244+ * Attributes Object can inclued any key value pair that would otherwise be
245245 * an attribute in the html element.
246246 *
247247 * also see: mw.getConfig( 'embedPlayerAttributes' )
@@ -282,7 +282,7 @@
283283 /**
284284 * EmbedPlayerManager
285285 *
286 -* Mannages calls to embed video interfaces
 286+* Manages calls to embed video interfaces
287287 */
288288 var EmbedPlayerManager = function( ) {
289289 // Create a Player Manage
@@ -361,7 +361,9 @@
362362 // Load any skins we need then swap in the interface
363363 mw.load( skinClassRequest, function() {
364364 // Set the wait for meta flag
365 - var waitForMeta = _this.waitForMetaCheck( element );
 365+ var waitForMeta = _this.waitForMetaCheck( element );
 366+
 367+ // We should move all playlist handling to add-in
366368 switch( element.tagName.toLowerCase() ) {
367369 case 'playlist':
368370 // Make sure we have the necessary playlist libs loaded:
@@ -2628,7 +2630,7 @@
26292631 */
26302632 isPlaying : function() {
26312633 if ( this.thumbnail_disp ) {
2632 - // in stoped state
 2634+ // in stopped state
26332635 return false;
26342636 } else if ( this.paused ) {
26352637 // paused state
Index: branches/js2-work/phase3/js/mwEmbed/modules/EmbedPlayer/nativeEmbed.js
@@ -130,7 +130,7 @@
131131 *
132132 * @param {Float} percentage
133133 */
134 - doSeek:function( percentage ) {
 134+ doSeek: function( percentage ) {
135135 mw.log( 'native:seek:p: ' + percentage + ' : ' + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
136136 // @@todo check if the clip is loaded here (if so we can do a local seek)
137137 if ( this.supportsURLTimeEncoding() ) {

Status & tagging log