r50295 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r50294‎ | r50295 | r50296 >
Date:01:20, 7 May 2009
Author:dale
Status:deferred
Tags:
Comment:
stubs for pre-loading future clips
Modified paths:
  • /trunk/extensions/MetavidWiki/skins/mv_embed/WebContent (deleted) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedVideo/mv_baseEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedVideo/mv_nativeEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mvPlayList.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed_iframe.php (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mvPlayList.js
@@ -52,6 +52,7 @@
5353 loading_external_data:true, //if we are loading external data (set to loading by default)
5454
5555 activeClipList:null,
 56+ playlist_buffer_time: 20, // how many seconds of future clips we should buffer
5657
5758 interface_url:null, //the interface url
5859 tracks:{},
@@ -521,6 +522,46 @@
522523 loadEmbedPlaylist: function(){
523524 //js_log('load playlist');
524525 },
 526+ /** mannages the loading of future clips
 527+ * called regurally while we are playing clips
 528+ *
 529+ * load works like so:
 530+ * if the current clip is full loaded
 531+ * load clips untill buffredEndTime < playlist_buffer_time load next
 532+ *
 533+ * this won't work so well with time range loading for smil (need to work on that)
 534+ */
 535+ loadFutureClips:function(){
 536+ if( this.cur_clip.embed.bufferedPercent == 1){
 537+ //set the buffer to the currentTime - duration
 538+ var curBuffredTime = this.cur_clip.getDuration() - this.cur_clip.embed.currentTime;
 539+
 540+ if(curBuffredTime < 0)
 541+ curBuffredTime = 0;
 542+
 543+ js_log( "curBuffredTime:: " + curBuffredTime );
 544+ if( curBuffredTime < this.playlist_buffer_time ){
 545+ js_log(" we only have " + curBuffredTime + ' buffed but we need: ' + this.playlist_buffer_time);
 546+
 547+ for(var inx = this.cur_clip.order + 1; inx < this.default_track.clip.length; inx++ ){
 548+ var cClip = this.default_track.getClip( inx );
 549+
 550+ //check if the clip is already loaded (add its duration)
 551+ if( cClip.embed.bufferedPercent == 1){
 552+ curBuffredTime += cClip.embed.getDuration();
 553+ }
 554+ //check if we still have to load a resource:
 555+ if( curBuffredTime < this.playlist_buffer_time ){
 556+ //issue the load request
 557+ if( cClip.embed.networkState==0 ){
 558+ cClip.embed.load();
 559+ }
 560+ break; //check back next time
 561+ }
 562+ }
 563+ }
 564+ }
 565+ },
525566 //called to play the next clip if done call onClipDone
526567 playNext: function(){
527568 //advance the playhead to the next clip
@@ -769,7 +810,9 @@
770811 barHtml+='<div class="mv_progress mv_buffer"></div>';
771812
772813 barHtml+='</div>';
773 - //background:#DDDclip.getColor()
 814+
 815+ //background:#DDD +clip.getColor();
 816+
774817 $j('#seeker_bar_'+_this.id).append(barHtml);
775818
776819 //js_log('offset:' + cur_pixle +' width:'+pwidth+' add clip'+ clip.id + ' is '+clip.embed.getDuration() +' = ' + perc +' of ' + _this.track_len);
@@ -1353,8 +1396,11 @@
13541397 this.setStatus(seconds2npt(this.currentTime) + '/' + seconds2npt(this.getDuration()) );
13551398 this.setSliderValue(this.currentTime / this.getDuration());
13561399 }
1357 -
1358 - //status updates are handled by children clips ... playlist just manages smil actions
 1400+ //pre-load any future clips:
 1401+ this.loadFutureClips();
 1402+
 1403+
 1404+ //status updates are handled by children clips ... playlist mostly manages smil actions
13591405 this.doSmilActions();
13601406
13611407 if( ! this.smil_monitorTimerId ){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed_iframe.php
@@ -1,7 +1,7 @@
22 <?php
33 /*
44 mv_embed_iframe.php
5 -this allows for remote embedding without exposing the hosting site to javascript.
 5+this allows for remote embedding without exposing the hosting site to remote javascript.
66 */
77
88 mv_embed_iframe();
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedVideo/mv_nativeEmbed.js
@@ -3,6 +3,7 @@
44 instanceOf:'nativeEmbed',
55 canPlayThrough:false,
66 grab_try_count:0,
 7+ onlyLoadFlag:false,
78 supports: {
89 'play_head':true,
910 'pause':true,
@@ -24,27 +25,36 @@
2526 // controls=false results in controls being displayed:
2627 //http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-August/016159.html
2728 js_log("native play url:" + this.getURI( this.seek_time_sec ));
28 - return '<video ' +
 29+ var eb = '<video ' +
2930 'id="' + this.pid + '" ' +
3031 'style="width:' + this.width+'px;height:' + this.height + 'px;" ' +
3132 'width="' + this.width + '" height="'+this.height+'" '+
32 - 'src="' + this.media_element.selected_source.getURI( this.seek_time_sec ) + '" ' +
33 - 'autoplay="true" '+
34 - 'oncanplaythrough="$j(\'#'+this.id+'\').get(0).oncanplaythrough();return false;" ' +
 33+ 'src="' + this.media_element.selected_source.getURI( this.seek_time_sec ) + '" ';
 34+
 35+ if(!this.onlyLoadFlag)
 36+ eb+= 'autoplay="'+this.autoplay+'" ';
 37+
 38+ //continue with the other attr:
 39+ eb+= 'oncanplaythrough="$j(\'#'+this.id+'\').get(0).oncanplaythrough();return false;" ' +
3540 'onloadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' +
3641 'loadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' +
3742 'onprogress="$j(\'#'+this.id+'\').get(0).onprogress( event );return false;" '+
3843 'onended="$j(\'#'+this.id+'\').get(0).onended();return false;" >' +
3944 '</video>';
 45+ return eb;
4046 },
4147 //@@todo : loading progress
4248 postEmbedJS:function(){
4349 js_log("f:native:postEmbedJS:");
4450 this.getVID();
45 - if(typeof this.vid != 'undefined'){
46 - js_log("GOT video object sending PLAY()");
47 - this.vid.play();
48 - //this.vid.load(); //does not seem to work so well
 51+ if(typeof this.vid != 'undefined'){
 52+ //always load the media:
 53+ if( this.onlyLoadFlag ){
 54+ this.vid.load();
 55+ }else{
 56+ this.vid.play();
 57+ }
 58+
4959 setTimeout('$j(\'#'+this.id+'\').get(0).monitor()',100);
5060 }else{
5161 js_log('could not grab vid obj trying again:' + typeof this.vid);
@@ -136,9 +146,17 @@
137147 this.monitor();
138148 }
139149 },
140 - playMovieAt:function(order){
141 - js_log('f:playMovieAt '+order);
142 - this.play();
 150+ load:function(){
 151+ this.getVID();
 152+ if( !this.vid ){
 153+ //no vid loaded
 154+ js_log('native::load() ... doEmbed');
 155+ this.onlyLoadFlag = true;
 156+ this.doEmbedHTML();
 157+ }else{
 158+ //won't happen offten
 159+ this.vid.load();
 160+ }
143161 },
144162 // get the embed vlc object
145163 getVID : function (){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedVideo/mv_baseEmbed.js
@@ -29,6 +29,7 @@
3030 "readyState":0, //http://www.whatwg.org/specs/web-apps/current-work/#readystate
3131 "currentTime":0, //current playback position (should be updated by plugin)
3232 "duration":null, //media duration (read from file or the temporal url)
 33+ "networkState":0,
3334
3435 //custom attributes for mv_embed:
3536 "play_button":true,
@@ -1807,6 +1808,10 @@
18081809 $j('#' + this_id ).get(0).pause();
18091810 });
18101811 },
 1812+ load:function(){
 1813+ //should be done by child (no base way to load assets)
 1814+ js_log('baseEmbed:load call');
 1815+ },
18111816 /*
18121817 * base embed pause
18131818 * there is no general way to pause the video

Status & tagging log