r103539 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r103538‎ | r103539 | r103540 >
Date:00:35, 18 November 2011
Author:dale
Status:ok
Tags:
Comment:
fixed camel case in updateVideoTimeReq
added npt format documentation in comment
Modified paths:
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaElement.js (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaSource.js (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.EmbedPlayer.js
@@ -617,7 +617,7 @@
618618 /**
619619 * Get a time range from the media start and end time
620620 *
621 - * @return start_npt and end_npt time if present
 621+ * @return startNpt and endNpt time if present
622622 */
623623 getTimeRange: function() {
624624 var end_time = (this.controlBuilder.longTimeDisp)? '/' + mw.seconds2npt( this.getDuration() ) : '';
@@ -628,10 +628,10 @@
629629 if ( !this.mediaElement.selectedSource ){
630630 return default_time_range;
631631 }
632 - if ( !this.mediaElement.selectedSource.end_npt ){
 632+ if ( !this.mediaElement.selectedSource.endNpt ){
633633 return default_time_range;
634634 }
635 - return this.mediaElement.selectedSource.start_npt + this.mediaElement.selectedSource.end_npt;
 635+ return this.mediaElement.selectedSource.startNpt + this.mediaElement.selectedSource.endNpt;
636636 },
637637
638638 /**
@@ -698,7 +698,7 @@
699699 this.stop();
700700 this.didSeekJump = true;
701701 // Make sure this.serverSeekTime is up-to-date:
702 - this.serverSeekTime = mw.npt2seconds( this.start_npt ) + parseFloat( percent * this.getDuration() );
 702+ this.serverSeekTime = mw.npt2seconds( this.startNpt ) + parseFloat( percent * this.getDuration() );
703703 // Update the slider
704704 this.updatePlayHead( percent );
705705 }
@@ -961,27 +961,28 @@
962962 * Update the video time request via a time request string
963963 *
964964 * @param {String}
965 - * time_req
 965+ * timeRequest video time to be updated
966966 */
967 - updateVideoTimeReq: function( time_req ) {
968 - mw.log( 'EmbedPlayer::updateVideoTimeReq:' + time_req );
969 - var time_parts = time_req.split( '/' );
970 - this.updateVideoTime( time_parts[0], time_parts[1] );
 967+ updateVideoTimeReq: function( timeRequest ) {
 968+ mw.log( 'EmbedPlayer::updateVideoTimeReq:' + timeRequest );
 969+ var timeParts = timeRequest.split( '/' );
 970+ this.updateVideoTime( timeParts[0], timeParts[1] );
971971 },
972972
973973 /**
974 - * Update Video time from provided start_npt and end_npt values
 974+ * Update Video time from provided startNpt and endNpt values
975975 *
976976 * @param {String}
977 - * start_npt the new start time in npt format
978 - * @pamra {String} end_npt the new end time in npt format
 977+ * startNpt the new start time in npt format ( hh:mm:ss.ms )
 978+ * @pamra {String}
 979+ * endNpt the new end time in npt format ( hh:mm:ss.ms )
979980 */
980 - updateVideoTime: function( start_npt, end_npt ) {
 981+ updateVideoTime: function( startNpt, endNpt ) {
981982 // update media
982 - this.mediaElement.updateSourceTimes( start_npt, end_npt );
 983+ this.mediaElement.updateSourceTimes( startNpt, endNpt );
983984
984985 // update mv_time
985 - this.controlBuilder.setStatus( start_npt + '/' + end_npt );
 986+ this.controlBuilder.setStatus( startNpt + '/' + endNpt );
986987
987988 // reset slider
988989 this.updatePlayHead( 0 );
@@ -990,7 +991,7 @@
991992 if ( this.mediaElement.selectedSource.URLTimeEncoding ) {
992993 this.serverSeekTime = 0;
993994 } else {
994 - this.serverSeekTime = mw.npt2seconds( start_npt );
 995+ this.serverSeekTime = mw.npt2seconds( startNpt );
995996 }
996997 },
997998
@@ -1014,18 +1015,18 @@
10151016 updateThumbTime:function( floatSeconds ) {
10161017 // mw.log('updateThumbTime:'+floatSeconds);
10171018 var _this = this;
1018 - if ( typeof this.org_thum_src == 'undefined' ) {
1019 - this.org_thum_src = this.poster;
 1019+ if ( typeof this.orgThumSrc == 'undefined' ) {
 1020+ this.orgThumSrc = this.poster;
10201021 }
1021 - if ( this.org_thum_src.indexOf( 't=' ) !== -1 ) {
1022 - this.last_thumb_url = mw.replaceUrlParams( this.org_thum_src,
 1022+ if ( this.orgThumSrc.indexOf( 't=' ) !== -1 ) {
 1023+ this.lastThumbUrl = mw.replaceUrlParams( this.orgThumSrc,
10231024 {
10241025 't' : mw.seconds2npt( floatSeconds + parseInt( this.startOffset ) )
10251026 }
10261027 );
10271028 if ( !this.thumbnail_updating ) {
1028 - this.updatePoster( this.last_thumb_url , false );
1029 - this.last_thumb_url = null;
 1029+ this.updatePoster( this.lastThumbUrl , false );
 1030+ this.lastThumbUrl = null;
10301031 }
10311032 }
10321033 },
@@ -1095,9 +1096,9 @@
10961097 _this.thumbnail_updating = false;
10971098
10981099 // if we have a thumb queued update to that
1099 - if ( _this.last_thumb_url ) {
1100 - var src_url = _this.last_thumb_url;
1101 - _this.last_thumb_url = null;
 1100+ if ( _this.lastThumbUrl ) {
 1101+ var src_url = _this.lastThumbUrl;
 1102+ _this.lastThumbUrl = null;
11021103 _this.updatePosterSrc( src_url );
11031104 }
11041105 } );
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaElement.js
@@ -60,14 +60,14 @@
6161 * request argument (ie &t=start_time/end_time)
6262 *
6363 * @param {String}
64 - * start_npt Start time in npt format
 64+ * startNpt Start time in npt format
6565 * @param {String}
66 - * end_npt End time in npt format
 66+ * endNpt End time in npt format
6767 */
68 - updateSourceTimes: function( start_npt, end_npt ) {
 68+ updateSourceTimes: function( startNpt, endNpt ) {
6969 var _this = this;
7070 $.each( this.sources, function( inx, mediaSource ) {
71 - mediaSource.updateSrcTime( start_npt, end_npt );
 71+ mediaSource.updateSrcTime( startNpt, endNpt );
7272 } );
7373 },
7474
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/EmbedPlayer/resources/mw.MediaSource.js
@@ -88,10 +88,10 @@
8989 id: null,
9090
9191 // Start time in npt format
92 - start_npt: null,
 92+ startNpt: null,
9393
9494 // End time in npt format
95 - end_npt: null,
 95+ endNpt: null,
9696
9797 // Language of the file
9898 srclang: null,
@@ -189,23 +189,23 @@
190190 * @param {String}
191191 * end_time: in NPT format
192192 */
193 - updateSrcTime: function ( start_npt, end_npt ) {
194 - // mw.log("f:updateSrcTime: "+ start_npt+'/'+ end_npt + ' from org: ' +
195 - // this.start_npt+ '/'+this.end_npt);
 193+ updateSrcTime: function ( startNpt, endNpt ) {
 194+ // mw.log("f:updateSrcTime: "+ startNpt+'/'+ endNpt + ' from org: ' +
 195+ // this.startNpt+ '/'+this.endNpt);
196196 // mw.log("pre uri:" + this.src);
197197 // if we have time we can use:
198198 if ( this.URLTimeEncoding ) {
199199 // make sure its a valid start time / end time (else set default)
200 - if ( !mw.npt2seconds( start_npt ) ) {
201 - start_npt = this.start_npt;
 200+ if ( !mw.npt2seconds( startNpt ) ) {
 201+ startNpt = this.startNpt;
202202 }
203203
204 - if ( !mw.npt2seconds( end_npt ) ) {
205 - end_npt = this.end_npt;
 204+ if ( !mw.npt2seconds( endNpt ) ) {
 205+ endNpt = this.endNpt;
206206 }
207207
208208 this.src = mw.replaceUrlParams( this.src, {
209 - 't': start_npt + '/' + end_npt
 209+ 't': startNpt + '/' + endNpt
210210 });
211211
212212 // update the duration
@@ -221,8 +221,8 @@
222222 */
223223 setDuration: function ( duration ) {
224224 this.duration = duration;
225 - if ( !this.end_npt ) {
226 - this.end_npt = mw.seconds2npt( this.startOffset + duration );
 225+ if ( !this.endNpt ) {
 226+ this.endNpt = mw.seconds2npt( this.startOffset + duration );
227227 }
228228 },
229229
@@ -252,8 +252,8 @@
253253 return this.src;
254254 }
255255 var endvar = '';
256 - if ( this.end_npt ) {
257 - endvar = '/' + this.end_npt;
 256+ if ( this.endNpt ) {
 257+ endvar = '/' + this.endNpt;
258258 }
259259 return mw.replaceUrlParams( this.src,
260260 {
@@ -331,17 +331,17 @@
332332 var annoURL = new mw.Uri( mw.absoluteUrl( this.getSrc() ) );
333333 if ( annoURL.query.t ) {
334334 var times = annoURL.query.t.split( '/' );
335 - this.start_npt = times[0];
336 - this.end_npt = times[1];
337 - this.startOffset = mw.npt2seconds( this.start_npt );
338 - this.duration = mw.npt2seconds( this.end_npt ) - this.startOffset;
 335+ this.startNpt = times[0];
 336+ this.endNpt = times[1];
 337+ this.startOffset = mw.npt2seconds( this.startNpt );
 338+ this.duration = mw.npt2seconds( this.endNpt ) - this.startOffset;
339339 } else {
340340 // look for this info as attributes
341341 if ( this.startOffset ) {
342 - this.start_npt = mw.seconds2npt( this.startOffset );
 342+ this.startNpt = mw.seconds2npt( this.startOffset );
343343 }
344344 if ( this.duration ) {
345 - this.end_npt = mw.seconds2npt( parseInt( this.duration ) + parseInt( this.startOffset ) );
 345+ this.endNpt = mw.seconds2npt( parseInt( this.duration ) + parseInt( this.startOffset ) );
346346 }
347347 }
348348 }

Status & tagging log