Index: trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mvPlayList.js |
— | — | @@ -52,6 +52,7 @@ |
53 | 53 | loading_external_data:true, //if we are loading external data (set to loading by default) |
54 | 54 | |
55 | 55 | activeClipList:null, |
| 56 | + playlist_buffer_time: 20, // how many seconds of future clips we should buffer |
56 | 57 | |
57 | 58 | interface_url:null, //the interface url |
58 | 59 | tracks:{}, |
— | — | @@ -521,6 +522,46 @@ |
522 | 523 | loadEmbedPlaylist: function(){ |
523 | 524 | //js_log('load playlist'); |
524 | 525 | }, |
| 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 | + }, |
525 | 566 | //called to play the next clip if done call onClipDone |
526 | 567 | playNext: function(){ |
527 | 568 | //advance the playhead to the next clip |
— | — | @@ -769,7 +810,9 @@ |
770 | 811 | barHtml+='<div class="mv_progress mv_buffer"></div>'; |
771 | 812 | |
772 | 813 | barHtml+='</div>'; |
773 | | - //background:#DDDclip.getColor() |
| 814 | + |
| 815 | + //background:#DDD +clip.getColor(); |
| 816 | + |
774 | 817 | $j('#seeker_bar_'+_this.id).append(barHtml); |
775 | 818 | |
776 | 819 | //js_log('offset:' + cur_pixle +' width:'+pwidth+' add clip'+ clip.id + ' is '+clip.embed.getDuration() +' = ' + perc +' of ' + _this.track_len); |
— | — | @@ -1353,8 +1396,11 @@ |
1354 | 1397 | this.setStatus(seconds2npt(this.currentTime) + '/' + seconds2npt(this.getDuration()) ); |
1355 | 1398 | this.setSliderValue(this.currentTime / this.getDuration()); |
1356 | 1399 | } |
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 |
1359 | 1405 | this.doSmilActions(); |
1360 | 1406 | |
1361 | 1407 | if( ! this.smil_monitorTimerId ){ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed_iframe.php |
— | — | @@ -1,7 +1,7 @@ |
2 | 2 | <?php |
3 | 3 | /* |
4 | 4 | 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. |
6 | 6 | */ |
7 | 7 | |
8 | 8 | mv_embed_iframe(); |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedVideo/mv_nativeEmbed.js |
— | — | @@ -3,6 +3,7 @@ |
4 | 4 | instanceOf:'nativeEmbed', |
5 | 5 | canPlayThrough:false, |
6 | 6 | grab_try_count:0, |
| 7 | + onlyLoadFlag:false, |
7 | 8 | supports: { |
8 | 9 | 'play_head':true, |
9 | 10 | 'pause':true, |
— | — | @@ -24,27 +25,36 @@ |
25 | 26 | // controls=false results in controls being displayed: |
26 | 27 | //http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-August/016159.html |
27 | 28 | js_log("native play url:" + this.getURI( this.seek_time_sec )); |
28 | | - return '<video ' + |
| 29 | + var eb = '<video ' + |
29 | 30 | 'id="' + this.pid + '" ' + |
30 | 31 | 'style="width:' + this.width+'px;height:' + this.height + 'px;" ' + |
31 | 32 | '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;" ' + |
35 | 40 | 'onloadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' + |
36 | 41 | 'loadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" ' + |
37 | 42 | 'onprogress="$j(\'#'+this.id+'\').get(0).onprogress( event );return false;" '+ |
38 | 43 | 'onended="$j(\'#'+this.id+'\').get(0).onended();return false;" >' + |
39 | 44 | '</video>'; |
| 45 | + return eb; |
40 | 46 | }, |
41 | 47 | //@@todo : loading progress |
42 | 48 | postEmbedJS:function(){ |
43 | 49 | js_log("f:native:postEmbedJS:"); |
44 | 50 | 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 | + |
49 | 59 | setTimeout('$j(\'#'+this.id+'\').get(0).monitor()',100); |
50 | 60 | }else{ |
51 | 61 | js_log('could not grab vid obj trying again:' + typeof this.vid); |
— | — | @@ -136,9 +146,17 @@ |
137 | 147 | this.monitor(); |
138 | 148 | } |
139 | 149 | }, |
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 | + } |
143 | 161 | }, |
144 | 162 | // get the embed vlc object |
145 | 163 | getVID : function (){ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedVideo/mv_baseEmbed.js |
— | — | @@ -29,6 +29,7 @@ |
30 | 30 | "readyState":0, //http://www.whatwg.org/specs/web-apps/current-work/#readystate |
31 | 31 | "currentTime":0, //current playback position (should be updated by plugin) |
32 | 32 | "duration":null, //media duration (read from file or the temporal url) |
| 33 | + "networkState":0, |
33 | 34 | |
34 | 35 | //custom attributes for mv_embed: |
35 | 36 | "play_button":true, |
— | — | @@ -1807,6 +1808,10 @@ |
1808 | 1809 | $j('#' + this_id ).get(0).pause(); |
1809 | 1810 | }); |
1810 | 1811 | }, |
| 1812 | + load:function(){ |
| 1813 | + //should be done by child (no base way to load assets) |
| 1814 | + js_log('baseEmbed:load call'); |
| 1815 | + }, |
1811 | 1816 | /* |
1812 | 1817 | * base embed pause |
1813 | 1818 | * there is no general way to pause the video |