https://www.mediawiki.org/wiki/Special:Code/MediaWiki/103539

Revision: 103539
Author:   dale
Date:     2011-11-18 00:35:55 +0000 (Fri, 18 Nov 2011)
Log Message:
-----------
fixed camel case in updateVideoTimeReq
added npt format documentation in comment 

Modified Paths:
--------------
    
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js
    
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaElement.js
    
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaSource.js

Modified: 
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js
===================================================================
--- 
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js
   2011-11-18 00:30:12 UTC (rev 103538)
+++ 
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js
   2011-11-18 00:35:55 UTC (rev 103539)
@@ -617,7 +617,7 @@
        /**
         * Get a time range from the media start and end time
         *
-        * @return start_npt and end_npt time if present
+        * @return startNpt and endNpt time if present
         */
        getTimeRange: function() {
                var end_time = (this.controlBuilder.longTimeDisp)? '/' + 
mw.seconds2npt( this.getDuration() ) : '';
@@ -628,10 +628,10 @@
                if ( !this.mediaElement.selectedSource ){
                        return default_time_range;
                }
-               if ( !this.mediaElement.selectedSource.end_npt ){
+               if ( !this.mediaElement.selectedSource.endNpt ){
                        return default_time_range;
                }
-               return this.mediaElement.selectedSource.start_npt + 
this.mediaElement.selectedSource.end_npt;
+               return this.mediaElement.selectedSource.startNpt + 
this.mediaElement.selectedSource.endNpt;
        },
 
        /**
@@ -698,7 +698,7 @@
                        this.stop();
                        this.didSeekJump = true;
                        // Make sure this.serverSeekTime is up-to-date:
-                       this.serverSeekTime = mw.npt2seconds( this.start_npt ) 
+ parseFloat( percent * this.getDuration() );
+                       this.serverSeekTime = mw.npt2seconds( this.startNpt ) + 
parseFloat( percent * this.getDuration() );
                        // Update the slider
                        this.updatePlayHead( percent );
                }
@@ -961,27 +961,28 @@
         * Update the video time request via a time request string
         *
         * @param {String}
-        *      time_req
+        *      timeRequest video time to be updated
         */
-       updateVideoTimeReq: function( time_req ) {
-               mw.log( 'EmbedPlayer::updateVideoTimeReq:' + time_req );
-               var time_parts = time_req.split( '/' );
-               this.updateVideoTime( time_parts[0], time_parts[1] );
+       updateVideoTimeReq: function( timeRequest ) {
+               mw.log( 'EmbedPlayer::updateVideoTimeReq:' + timeRequest );
+               var timeParts = timeRequest.split( '/' );
+               this.updateVideoTime( timeParts[0], timeParts[1] );
        },
 
        /**
-        * Update Video time from provided start_npt and end_npt values
+        * Update Video time from provided startNpt and endNpt values
         *
         * @param {String}
-        *      start_npt the new start time in npt format
-        * @pamra {String} end_npt the new end time in npt format
+        *      startNpt the new start time in npt format ( hh:mm:ss.ms )
+        * @pamra {String} 
+        *              endNpt the new end time in npt format ( hh:mm:ss.ms )
         */
-       updateVideoTime: function( start_npt, end_npt ) {
+       updateVideoTime: function( startNpt, endNpt ) {
                // update media
-               this.mediaElement.updateSourceTimes( start_npt, end_npt );
+               this.mediaElement.updateSourceTimes( startNpt, endNpt );
 
                // update mv_time
-               this.controlBuilder.setStatus( start_npt + '/' + end_npt );
+               this.controlBuilder.setStatus( startNpt + '/' + endNpt );
 
                // reset slider
                this.updatePlayHead( 0 );
@@ -990,7 +991,7 @@
                if ( this.mediaElement.selectedSource.URLTimeEncoding ) {
                        this.serverSeekTime = 0;
                } else {
-                       this.serverSeekTime = mw.npt2seconds( start_npt );
+                       this.serverSeekTime = mw.npt2seconds( startNpt );
                }
        },
 
@@ -1014,18 +1015,18 @@
        updateThumbTime:function( floatSeconds ) {
                // mw.log('updateThumbTime:'+floatSeconds);
                var _this = this;
-               if ( typeof this.org_thum_src == 'undefined' ) {
-                       this.org_thum_src = this.poster;
+               if ( typeof this.orgThumSrc == 'undefined' ) {
+                       this.orgThumSrc = this.poster;
                }
-               if ( this.org_thum_src.indexOf( 't=' ) !== -1 ) {
-                       this.last_thumb_url = mw.replaceUrlParams( 
this.org_thum_src,
+               if ( this.orgThumSrc.indexOf( 't=' ) !== -1 ) {
+                       this.lastThumbUrl = mw.replaceUrlParams( 
this.orgThumSrc,
                                {
                                        't' : mw.seconds2npt( floatSeconds + 
parseInt( this.startOffset ) )
                                }
                        );
                        if ( !this.thumbnail_updating ) {
-                               this.updatePoster( this.last_thumb_url , false 
);
-                               this.last_thumb_url = null;
+                               this.updatePoster( this.lastThumbUrl , false );
+                               this.lastThumbUrl = null;
                        }
                }
        },
@@ -1095,9 +1096,9 @@
                                                _this.thumbnail_updating = 
false;
 
                                                // if we have a thumb queued 
update to that
-                                               if ( _this.last_thumb_url ) {
-                                                       var src_url = 
_this.last_thumb_url;
-                                                       _this.last_thumb_url = 
null;
+                                               if ( _this.lastThumbUrl ) {
+                                                       var src_url = 
_this.lastThumbUrl;
+                                                       _this.lastThumbUrl = 
null;
                                                        _this.updatePosterSrc( 
src_url );
                                                }
                                } );

Modified: 
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaElement.js
===================================================================
--- 
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaElement.js
  2011-11-18 00:30:12 UTC (rev 103538)
+++ 
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaElement.js
  2011-11-18 00:35:55 UTC (rev 103539)
@@ -60,14 +60,14 @@
         * request argument (ie &t=start_time/end_time)
         *
         * @param {String}
-        *      start_npt Start time in npt format
+        *      startNpt Start time in npt format
         * @param {String}
-        *      end_npt End time in npt format
+        *      endNpt End time in npt format
         */
-       updateSourceTimes: function( start_npt, end_npt ) {
+       updateSourceTimes: function( startNpt, endNpt ) {
                var _this = this;
                $.each( this.sources, function( inx, mediaSource ) {
-                       mediaSource.updateSrcTime( start_npt, end_npt );
+                       mediaSource.updateSrcTime( startNpt, endNpt );
                } );
        },
 

Modified: 
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaSource.js
===================================================================
--- 
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaSource.js
   2011-11-18 00:30:12 UTC (rev 103538)
+++ 
trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaSource.js
   2011-11-18 00:35:55 UTC (rev 103539)
@@ -88,10 +88,10 @@
        id: null,
 
        // Start time in npt format
-       start_npt: null,
+       startNpt: null,
 
        // End time in npt format
-       end_npt: null,
+       endNpt: null,
 
        // Language of the file
        srclang: null,
@@ -189,23 +189,23 @@
         * @param {String}
         *      end_time: in NPT format
         */
-       updateSrcTime: function ( start_npt, end_npt ) {
-               // mw.log("f:updateSrcTime: "+ start_npt+'/'+ end_npt + ' from 
org: ' +
-               // this.start_npt+ '/'+this.end_npt);
+       updateSrcTime: function ( startNpt, endNpt ) {
+               // mw.log("f:updateSrcTime: "+ startNpt+'/'+ endNpt + ' from 
org: ' +
+               // this.startNpt+ '/'+this.endNpt);
                // mw.log("pre uri:" + this.src);
                // if we have time we can use:
                if ( this.URLTimeEncoding ) {
                        // make sure its a valid start time / end time (else 
set default)
-                       if ( !mw.npt2seconds( start_npt ) ) {
-                               start_npt = this.start_npt;
+                       if ( !mw.npt2seconds( startNpt ) ) {
+                               startNpt = this.startNpt;
                        }
 
-                       if ( !mw.npt2seconds( end_npt ) ) {
-                               end_npt = this.end_npt;
+                       if ( !mw.npt2seconds( endNpt ) ) {
+                               endNpt = this.endNpt;
                        }
 
                        this.src = mw.replaceUrlParams( this.src, {
-                               't': start_npt + '/' + end_npt
+                               't': startNpt + '/' + endNpt
                        });
 
                        // update the duration
@@ -221,8 +221,8 @@
         */
        setDuration: function ( duration ) {
                this.duration = duration;
-               if ( !this.end_npt ) {
-                       this.end_npt = mw.seconds2npt( this.startOffset + 
duration );
+               if ( !this.endNpt ) {
+                       this.endNpt = mw.seconds2npt( this.startOffset + 
duration );
                }
        },
 
@@ -252,8 +252,8 @@
                        return this.src;
                }
                var endvar = '';
-               if ( this.end_npt ) {
-                       endvar = '/' + this.end_npt;
+               if ( this.endNpt ) {
+                       endvar = '/' + this.endNpt;
                }
                return mw.replaceUrlParams( this.src,
                        {
@@ -331,17 +331,17 @@
                        var annoURL = new mw.Uri( mw.absoluteUrl( this.getSrc() 
) );
                        if ( annoURL.query.t ) {
                                var times = annoURL.query.t.split( '/' );
-                               this.start_npt = times[0];
-                               this.end_npt = times[1];
-                               this.startOffset = mw.npt2seconds( 
this.start_npt );
-                               this.duration = mw.npt2seconds( this.end_npt ) 
- this.startOffset;
+                               this.startNpt = times[0];
+                               this.endNpt = times[1];
+                               this.startOffset = mw.npt2seconds( 
this.startNpt );
+                               this.duration = mw.npt2seconds( this.endNpt ) - 
this.startOffset;
                        } else {
                                // look for this info as attributes
                                if ( this.startOffset ) {
-                                       this.start_npt = mw.seconds2npt( 
this.startOffset );
+                                       this.startNpt = mw.seconds2npt( 
this.startOffset );
                                }
                                if ( this.duration ) {
-                                       this.end_npt = mw.seconds2npt( 
parseInt( this.duration ) + parseInt( this.startOffset ) );
+                                       this.endNpt = mw.seconds2npt( parseInt( 
this.duration ) + parseInt( this.startOffset ) );
                                }
                        }
                }


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to