r51662 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51661‎ | r51662 | r51663 >
Date:20:52, 9 June 2009
Author:dale
Status:deferred
Tags:
Comment:
* conditional usage of oggz_chop for native
we only do an oggz_chop request if:

oggz_chop is turned on
AND
we don't have a local buffer of the requested segment
Modified paths:
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/flashEmbed.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/javaEmbed.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/mv_javaEmbed.js (deleted) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/nativeEmbed.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/vlcEmbed.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/mv_embed.js (modified) (history)
  • /branches/new-upload/phase3/skins/common/sticky.js (modified) (history)

Diff [purge]

Index: branches/new-upload/phase3/skins/common/sticky.js
@@ -85,7 +85,7 @@
8686 // Netscape 4.x browser resize fix
8787 function MM_reloadPage(init) {
8888 if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
89 - document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; top.onresize=MM_reloadPage; }}
 89+ document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; top.onresize=MM_reloadPage; }}
9090 else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) {location.reload();}}
9191
9292 // Create browser-independent layer and browser objects
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js
@@ -82,6 +82,11 @@
8383 'title': 'Advanced Options'
8484 }
8585 },
 86+ /*
 87+ * sets the default display item:
 88+ * can be any content_providers key or 'all'
 89+ */
 90+ disp_item : 'metavid',
8691 /** the default content providers list.
8792 *
8893 * (should be note that special tabs like "upload" and "combined" don't go into the content proviers list:
@@ -114,8 +119,7 @@
115120 */
116121 'this_wiki':{
117122 'enabled': 0,
118 - 'checked': 0,
119 - 'd' : 0,
 123+ 'checked': 0,
120124 'title' : 'This Wiki',
121125 'desc' : '(should be updated with the proper text) maybe import from some config value',
122126 'api_url': wgServer + wgScriptPath + '/api.php',
@@ -125,8 +129,7 @@
126130 },
127131 'wiki_commons':{
128132 'enabled': 1,
129 - 'checked': 1,
130 - 'd' : 0,
 133+ 'checked': 1,
131134 'title' :'Wikipedia Commons',
132135 'desc' : 'Wikimedia Commons is a media file repository making available public domain '+
133136 'and freely-licensed educational media content (images, sound and video clips) to all.',
@@ -149,7 +152,6 @@
150153 'archive_org':{
151154 'enabled':1,
152155 'checked':1,
153 - 'd' :0,
154156 'title' : 'Archive.org',
155157 'desc' : 'The Internet Archive, a digital library of cultural artifacts',
156158 'homepage':'http://www.archive.org/about/about.php',
@@ -163,7 +165,6 @@
164166 'metavid':{
165167 'enabled':1,
166168 'checked':1,
167 - 'd' :1,
168169 'title' :'Metavid.org',
169170 'homepage':'http://metavid.org',
170171 'desc' : 'Metavid hosts thousands of hours of US house and senate floor proceedings',
@@ -281,9 +282,9 @@
282283 }
283284 //could not find it return unknown_license
284285 return {
285 - 'title' : gM('unknown_license'),
 286+ 'title' : gM('unknown_license'),
286287 'img_html' : '<span>' + gM('unknown_license') + '</span>',
287 - 'lurl' : license_url
 288+ 'lurl' : license_url
288289 };
289290 },
290291 //some default layout values:
@@ -298,7 +299,7 @@
299300
300301 init: function( iObj ){
301302 var _this = this;
302 - js_log('remoteSearchDriver:init');
 303+ js_log('remoteSearchDriver:init');
303304 for( var i in default_remote_search_options ) {
304305 if( iObj[i]){
305306 this[ i ] = iObj[i];
@@ -318,7 +319,8 @@
319320 this.content_providers[ cpc ][ cinx ] = this.cpconfig[cpc][ cinx];
320321 }
321322 }
322 - }
 323+ }
 324+
323325 //set up the target invocation:
324326 if( $j(this.target_invocation).length==0 ){
325327 js_error("RemoteSearchDriver:: no target invocation provided")
@@ -326,7 +328,7 @@
327329 $j(this.target_invocation).css('cursor','pointer').attr('title', gM('add_media_wizard')).click(function(){
328330 _this.doInitDisplay();
329331 });
330 - }
 332+ }
331333 },
332334 doInitDisplay:function(){
333335 var _this = this;
@@ -344,7 +346,7 @@
345347 _this.getTexboxSelection();
346348
347349 $j(_this.target_container).dialog('open');
348 - })
 350+ });
349351 },
350352 //gets the in and out points for insert position or grabs the selected text for search
351353 getTexboxSelection:function(){
@@ -520,19 +522,10 @@
521523 });
522524 },
523525 runSearch: function(){
524 - js_log("f:runSearch");
 526+ js_log("f:runSearch::" + this.disp_item);
525527 //draw_direct_flag
526528 var draw_direct_flag = true;
527 -
528 - //set the display item if not already set:
529 - for(var cp_id in this.content_providers){
530 - if( this.content_providers[ cp_id ].d ){
531 - if (!this.disp_item ){
532 - this.disp_item = cp_id;
533 - break;
534 - }
535 - }
536 - }
 529+
537530 cp = this.content_providers[this.disp_item];
538531
539532 //check if we need to update:
@@ -660,7 +653,7 @@
661654 });
662655 return false;
663656 }else if( !this.checkRepoLocal( cp ) && this.import_url_mode == 'none'){
664 - if( this.disp_item == 'combined'){
 657+ if( this.disp_item == 'combined' ){
665658 //combined results are harder to error handle just ignore that repo
666659 cp.sObj.loading = false;
667660 }else{
@@ -668,9 +661,12 @@
669662 }
670663 return false;
671664 }
672 - //set up the library req:
673 - var libReq = ['baseRemoteSearch', cp.lib +'Search' ];
674 - mvJsLoader.doLoad( libReq, function(){
 665+ //set up the library req:
 666+ mvJsLoader.doLoad( [
 667+ 'baseRemoteSearch',
 668+ cp.lib +'Search'
 669+ ], function(){
 670+ js_log("loaded .. disp is: " + _this.disp_item);
675671 //else we need to run the search:
676672 var iObj = {'cp':cp, 'rsd':_this};
677673 eval('cp.sObj = new '+cp.lib+'Search( iObj );');
@@ -683,24 +679,30 @@
684680
685681 //do search
686682 cp.sObj.getSearchResults();
 683+ js_log('rand getSearchResults on cp disp is: '+ _this.disp_item);
687684 _this.checkResultsDone();
688685 });
689686 },
 687+ /* check for all the results to finish */
690688 checkResultsDone: function(){
 689+ js_log( "checkResultsDone:entry: " + rsdMVRS.disp_item + ' not: ' + this.disp_item);
 690+
691691 var _this = this;
692 - var loading_done = true;
 692+ var loading_done = true;
 693+
693694 for(var cp_id in this.content_providers){
694 - cp = this.content_providers[ cp_id ];
 695+ var cp = this.content_providers[ cp_id ];
695696 if(typeof cp['sObj'] != 'undefined'){
696697 if( cp.sObj.loading )
697698 loading_done=false;
698699 }
699 - }
700 -
701 - if( loading_done ){
702 - js_log("checkResultsDone: load done");
 700+ }
 701+ if( loading_done ){
703702 this.drawOutputResults();
704 - }else{
 703+ }else{
 704+ js_log("before setTimeout: " + rsdMVRS.disp_item);
 705+ //make sure the instance name is up-to-date refrence to _this;
 706+ eval( _this.instance_name + ' = _this');
705707 setTimeout( _this.instance_name + '.checkResultsDone()', 30);
706708 }
707709 },
@@ -716,7 +718,7 @@
717719 var cp = this.content_providers[cp_id];
718720 if( cp.enabled && cp.checked){
719721 //add selected default if set
720 - if( cp.d == 1)
 722+ if( this.disp_item == cp_id)
721723 selected_tab=inx;
722724
723725 o+='<li class="rsd_cp_tab">';
@@ -805,13 +807,13 @@
806808 return false;
807809 },
808810 drawOutputResults: function(){
809 - js_log('f:drawOutputResults');
 811+ js_log('f:drawOutputResults::' + this.disp_item);
810812 var _this = this;
811813 var o='';
812814
813815 var cp_id = this.disp_item;
814816 var cp = this.content_providers[this.disp_item];
815 -
 817+
816818 //empty the existing results:
817819 $j('#tab-' + cp_id).empty();
818820
@@ -849,8 +851,7 @@
850852 o+='<img title="'+rItem.title+'" class="rsd_res_item" id="res_' + cp_id + '_' + rInx +'" style="float:left;width:' +
851853 _this.thumb_width + 'px; padding:5px;" src="' +
852854 cp.sObj.getImageTransform( rItem, {'width':_this.thumb_width } )
853 - + '">';
854 -
 855+ + '">';
855856 //add license icons if present
856857 if( rItem.license )
857858 o+= _this.getlicenseImgSet( rItem.license );
@@ -861,6 +862,7 @@
862863 }
863864 drawResultCount++;
864865 });
 866+ js_log('append to: ' + '#tab-' + cp_id);
865867 //put in the tab output (plus clear the output)
866868 $j('#tab-' + cp_id).append( o + '<div style="clear:both"/>');
867869 }
@@ -1505,16 +1507,7 @@
15061508 },
15071509 selectTab:function( selected_cp_id ){
15081510 js_log('select tab: ' + selected_cp_id);
1509 - this.disp_item = selected_cp_id;
1510 - //set display to unselected:
1511 - for(var cp_id in this.content_providers){
1512 - cp = this.content_providers[ cp_id ];
1513 - if( cp.checked || selected_cp_id == cp_id){
1514 - cp.d = 1;
1515 - }else{
1516 - cp.d = 0;
1517 - }
1518 - }
 1511+ this.disp_item = selected_cp_id;
15191512 if( this.disp_item == 'upload' ){
15201513 this.doUploadInteface();
15211514 }else{
Index: branches/new-upload/phase3/js2/mwEmbed/mv_embed.js
@@ -48,8 +48,6 @@
4949 //for when useing mv_embed with script-loader in root mediawiki path
5050 var mediaWiki_mvEmbed_path = 'js2/mwEmbed/';
5151
52 -//
53 -
5452 var global_player_list = new Array(); //the global player list per page
5553 var global_req_cb = new Array(); //the global request callback array
5654 var _global = this; //global obj
@@ -725,7 +723,7 @@
726724 ], function(){
727725 iObj['instance_name']= 'rsdMVRS';
728726 _global['rsdMVRS'] = new remoteSearchDriver( iObj );
729 - if(callback)
 727+ if( callback )
730728 callback();
731729 });
732730 });
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/mv_javaEmbed.js
@@ -1,167 +0,0 @@
2 -window.cortadoDomainLocations = {
3 - 'upload.wikimedia.org' : 'http://upload.wikimedia.org/jars/cortado.jar',
4 - 'tinyvid.tv' : 'http://tinyvid.tv/static/cortado.jar'
5 -}
6 -
7 -var javaEmbed = {
8 - instanceOf:'javaEmbed',
9 - iframe_src:'',
10 - logged_domain_error:false,
11 - supports: {
12 - 'play_head':true,
13 - 'pause':true,
14 - 'stop':true,
15 - 'fullscreen':false,
16 - 'time_display':true,
17 - 'volume_control':false
18 - },
19 - getEmbedHTML : function (){
20 - //big delay on embed html cuz its just for status updates and ie6 is crazy.
21 - if(this.controls)
22 - setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 500);
23 - //set a default duration of 30 seconds: cortao should detect duration.
24 - return this.wrapEmebedContainer( this.getEmbedObj() );
25 - },
26 - getEmbedObj:function(){
27 - js_log("java play url:" + this.getURI( this.seek_time_sec ));
28 - //get the duration
29 - this.getDuration();
30 - //if still unset set to an arbitrary time 60 seconds:
31 - if(!this.duration)this.duration=60;
32 - //@@todo we should have src property in our base embed object
33 - var mediaSrc = this.media_element.selected_source.getURI( this.seek_time_sec );
34 -
35 - if(mediaSrc.indexOf('://')!=-1 & parseUri(document.URL).host != parseUri(mediaSrc).host){
36 - if(window.cortadoDomainLocations[parseUri(mediaSrc).host]){
37 - applet_loc = window.cortadoDomainLocations[parseUri(mediaSrc).host];
38 - }else{
39 - applet_loc = 'http://theora.org/cortado.jar';
40 - }
41 - }else{
42 - //should be identical to cortado.jar
43 - applet_loc = mv_embed_path+'binPlayers/cortado/cortado.jar';
44 - }
45 - //load directly in the page..
46 - // (media must be on the same server or applet must be signed)
47 - var appplet_code = ''+
48 - '<applet id="' + this.pid + '" code="com.fluendo.player.Cortado.class" archive="' + applet_loc + '" width="' + this.width + '" height="' + this.height + '"> '+ "\n"+
49 - '<param name="url" value="' + mediaSrc + '" /> ' + "\n"+
50 - '<param name="local" value="false"/>'+ "\n"+
51 - '<param name="keepaspect" value="true" />'+ "\n"+
52 - '<param name="video" value="true" />'+"\n"+
53 - '<param name="showStatus" value="hide" />' + "\n"+
54 - '<param name="audio" value="true" />'+"\n"+
55 - '<param name="seekable" value="true" />'+"\n"+
56 - '<param name="duration" value="' + this.duration + '" />'+"\n"+
57 - '<param name="bufferSize" value="4096" />'+"\n"+
58 - '</applet>';
59 -
60 - // Wrap it in an iframe to avoid hanging the event thread in FF 2/3 and similar
61 - // Doesn't work in MSIE or Safari/Mac or Opera 9.5
62 - if ( embedTypes.mozilla ) {
63 - var iframe = document.createElement( 'iframe' );
64 - iframe.setAttribute( 'width', params.width );
65 - iframe.setAttribute( 'height', playerHeight );
66 - iframe.setAttribute( 'scrolling', 'no' );
67 - iframe.setAttribute( 'frameborder', 0 );
68 - iframe.setAttribute( 'marginWidth', 0 );
69 - iframe.setAttribute( 'marginHeight', 0 );
70 - iframe.setAttribute( 'id', 'cframe_' + this.id)
71 - elt.appendChild( iframe );
72 - var newDoc = iframe.contentDocument;
73 - newDoc.open();
74 - newDoc.write( '<html><body>' + appplet_code + '</body></html>' );
75 - newDoc.close(); // spurious error in some versions of FF, no workaround known
76 - } else {
77 - return appplet_code;
78 - }
79 - },
80 - postEmbedJS:function(){
81 - //reset logged domain error flag:
82 - this.logged_domain_error = false;
83 - //start monitor:
84 - this.monitor();
85 - },
86 - monitor:function(){
87 - this.getJCE()
88 - if(this.jce && this.jce.getPlayPosition){
89 - try{
90 - //java reads ogg media time.. so no need to add the start or seek offset:
91 - //js_log(' ct: ' + this.jce.getPlayPosition() + ' ' + this.supportsURLTimeEncoding());
92 - this.currentTime = this.jce.getPlayPosition();
93 - if(this.startOffset && ! this.supportsURLTimeEncoding()){
94 - this.currentTime = this.currentTime - this.startOffset;
95 - }
96 - if( this.jce.getPlayPosition() < 0){
97 - js_log('pp:'+this.jce.getPlayPosition());
98 - //probably reached clip end
99 - this.onClipDone();
100 - }
101 - }catch (e){
102 - js_log('could not get time from jPlayer: ' + e);
103 - }
104 - }
105 - //once currentTime is updated call parent_monitor
106 - this.parent_monitor();
107 - },
108 - /*
109 - * (local cortado seek does not seem to work very well)
110 - */
111 - doSeek:function(perc){
112 - js_log('java:seek:p: ' + perc+ ' : ' + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
113 -
114 - if( this.supportsURLTimeEncoding() ){
115 - this.parent_doSeek(perc);
116 - //this.seek_time_sec = npt2seconds( this.start_ntp ) + parseFloat( perc * this.getDuration() );
117 - // this.jce.setParam('url', this.getURI( this.seek_time_sec ))
118 - //this.jce.restart();
119 - }else{
120 - this.getJCE();
121 - if(this.jce){
122 - //do a (genneraly broken) local seek:
123 - js_log("cortado javascript seems to always fail ... but here we go... doSeek(" + perc * this.getDuration() );
124 - this.jce.doSeek( perc * this.getDuration() );
125 - }
126 - }
127 - },
128 - //get java cortado embed object
129 - getJCE:function(){
130 - if ( embedTypes.mozilla ) {
131 - this.jce = window.frames['cframe_' + this.id ].document.getElementById( this.pid );
132 - }else{
133 - this.jce = $j('#'+this.pid).get( 0 );
134 - }
135 - /*if( ! mv_java_iframe ){
136 -
137 - }else{
138 - if( $j('#iframe_' + this.pid ).length > 0 )
139 - try{
140 - this.jce = $j('#iframe_' + this.pid ).get(0).contentWindow.jPlayer;
141 - }catch (e){
142 - if(!this.logged_domain_error)
143 - js_log("failed to grab jce we wont have time updates for java");
144 - this.logged_domain_error = true;
145 - }
146 - else
147 - return false;
148 - } */
149 - },
150 - doThumbnailHTML:function(){
151 - //empty out player html (jquery with java applets does not work) :
152 - var pelm = document.getElementById('mv_embedded_player_' + this.id );
153 - pelm.innerHTML = '';
154 - this.parent_doThumbnailHTML();
155 - },
156 - play:function(){
157 - this.getJCE();
158 - this.parent_play();
159 - if( this.jce )
160 - this.jce.doPlay();
161 - },
162 - pause:function(){
163 - this.getJCE();
164 - this.parent_pause();
165 - if( this.jce )
166 - this.jce.doPause();
167 - }
168 -}
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/flashEmbed.js
@@ -1570,17 +1570,13 @@
15711571 setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 150);
15721572 return this.wrapEmebedContainer( this.getEmbedObj() );
15731573 },
1574 - getEmbedObj:function(){
1575 - /*return '<a href="' + this.media_element.selected_source.getURI(this.seek_time_sec) +'" '+
1576 - 'style="display:block;width:' + this.width + 'px;height:' + this.height + 'px" '+
1577 - 'id="' + this.pid + '"> rewrite me'+
1578 - '</a>';*/
 1574+ getEmbedObj:function(){
15791575 //give the embed element a unique pid (work around for flowplayer persistence)
15801576 if( this.old_pid!=0 ){
15811577 this.pid = this.pid +'_'+ this.old_pid;
15821578 }
15831579 return '<a '+
1584 - 'href="'+ this.media_element.selected_source.getURI( this.seek_time_sec ) + '" '+
 1580+ 'href="'+ this.getSrc() + '" '+
15851581 'style="display:block;width:' + parseInt(this.width) + 'px;height:' + parseInt(this.height) + 'px" '+
15861582 'id="'+this.pid+'">'+
15871583 '</a>';
@@ -1588,10 +1584,10 @@
15891585 postEmbedJS: function()
15901586 {
15911587 var _this = this;
1592 - js_log('embedFlow: uri:'+ _this.media_element.selected_source.getURI(this.seek_time_sec) + "\n"+ mv_embed_path + 'binPlayers/flowplayer/flowplayer-3.0.1.swf' ) ;
 1588+ js_log('embedFlow: uri:'+ this.getSrc() + "\n"+ mv_embed_path + 'binPlayers/flowplayer/flowplayer-3.0.1.swf' ) ;
15931589 var flowConfig = {
15941590 clip: {
1595 - url: _this.media_element.selected_source.getURI(this.seek_time_sec),
 1591+ url: this.getSrc(),
15961592 // when this is false playback does not start until play button is pressed
15971593 autoPlay: true
15981594 },
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/javaEmbed.js
@@ -29,7 +29,7 @@
3030 //if still unset set to an arbitrary time 60 seconds:
3131 if(!this.duration)this.duration=60;
3232 //@@todo we should have src property in our base embed object
33 - var mediaSrc = this.media_element.selected_source.getURI( this.seek_time_sec );
 33+ var mediaSrc = this.getSrc();
3434
3535 if(mediaSrc.indexOf('://')!=-1 & parseUri(document.URL).host != parseUri(mediaSrc).host){
3636 if(window.cortadoDomainLocations[parseUri(mediaSrc).host]){
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/vlcEmbed.js
@@ -186,8 +186,7 @@
187187 //for now trust the duration from url over vlc input.length
188188 if( !this.getDuration() && this.vlc.input.length > 0 )
189189 {
190 - js_log('setting duration to ' + this.vlc.input.length /1000);
191 - this.media_element.selected_source.setDuration( this.vlc.input.length /1000);
 190+ js_log('setting duration to ' + this.vlc.input.length /1000);
192191 this.duration = this.vlc.input.length /1000;
193192 }
194193 this.currentTime = this.vlc.input.time/1000;
@@ -195,7 +194,7 @@
196195 this.currentTime = this.currentTime - this.startOffset;
197196 },
198197 onPause: function(){
199 - this.parent_pause(); //update the inteface if paused via native control
 198+ this.parent_pause(); //update the inteface if paused via native control
200199 },
201200 onStop: function(){
202201 js_log('vlc:onStop:');
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js
@@ -90,7 +90,7 @@
9191 'title',
9292 'URLTimeEncoding', //boolean if we support temporal url requests on the source media
9393 'startOffset',
94 - 'duration',
 94+ 'durationHint',
9595 'start',
9696 'end',
9797 'default',
@@ -536,15 +536,17 @@
537537 var pUrl = parseUri ( this.src );
538538 if(typeof pUrl['queryKey']['t'] != 'undefined'){
539539 this['URLTimeEncoding']=true;
540 - }
541 -
542 - for(var i=0; i < mv_default_source_attr.length; i++){ //for in loop oky on object
543 - var attr = mv_default_source_attr[ i ];
 540+ }
 541+ for(var i=0; i < mv_default_source_attr.length; i++){ //array loop:
 542+ var attr = mv_default_source_attr[ i ];
544543 if( $j(element).attr( attr ) ) {
545544 this[ attr ] = $j(element).attr( attr );
546545 }
547 - }
548 -
 546+ }
 547+ //update duration from hit if present:
 548+ if(this.durationHint)
 549+ this.duration = this.durationHint;
 550+
549551 if ( $j(element).attr('type'))
550552 this.mime_type = $j(element).attr('type');
551553 else if ($j(element).attr('content-type'))
@@ -656,15 +658,11 @@
657659 }
658660 if(this.duration){
659661 this.end_ntp = seconds2npt( parseInt(this.duration) + parseInt(this.start_offset) );
660 - }
 662+ }
661663 }
662 - }else{
663 - //else normal media request (can't predict the duration without the plugin reading it)
664 - this.duration = null;
665 - this.start_offset = 0;
666 - this.startOffset = 0;
667 - this.start_ntp = seconds2npt(this.start_offset);
668664 }
 665+ //else nothing to parse just keep whatever info we already have
 666+
669667 //js_log('f:parseURLDuration() for:' + this.src + ' d:' + this.duration);
670668 },
671669 /** Attempts to detect the type of a media file based on the URI.
@@ -1187,22 +1185,19 @@
11881186 return default_time_req;
11891187 return this.media_element.selected_source.start_ntp+'/'+this.media_element.selected_source.end_ntp;
11901188 },
1191 - getDuration:function(){
1192 - //update some local pointers for the selected source:
1193 - if( this.media_element.selected_source.duration &&
1194 - this.media_element.selected_source.duration != 0 )
1195 - {
1196 - this.duration = this.media_element.selected_source.duration;
1197 - this.start_offset = this.media_element.selected_source.start_offset;
1198 - this.start_ntp = this.media_element.selected_source.start_ntp;
1199 - this.end_ntp = this.media_element.selected_source.end_ntp;
1200 - }else{
1201 - //update start end_ntp if duration !=0 (set from plugin)
1202 - if(this.duration && this.duration !=0){
1203 - this.start_ntp = '0:0:0';
1204 - this.end_ntp = seconds2npt( this.duration );
1205 - }
1206 - }
 1189+ getDuration:function(){
 1190+ //update some local pointers for the selected source:
 1191+ this.duration = this.media_element.selected_source.duration;
 1192+ this.start_offset = this.media_element.selected_source.start_offset;
 1193+ this.start_ntp = this.media_element.selected_source.start_ntp;
 1194+ this.end_ntp = this.media_element.selected_source.end_ntp;
 1195+
 1196+ //update start end_ntp if duration !=0 (set from plugin)
 1197+ if(!this.start_ntp)
 1198+ this.start_ntp = '0:0:0';
 1199+ if(!this.end_ntp && this.duration)
 1200+ this.end_ntp = seconds2npt( this.duration );
 1201+
12071202 //return the duration
12081203 return this.duration;
12091204 },
@@ -1230,7 +1225,7 @@
12311226 //do seek function (should be overwritten by implementing embedLibs)
12321227 // first check if seek can be done on locally downloaded content.
12331228 doSeek : function( perc ){
1234 - js_log('f:baseEmbed:doSeek:' + perc + ' to st:' + this.seek_time_sec );
 1229+ alert('f:baseEmbed:doSeek:' + perc + ' to st:' + this.seek_time_sec + ' sf:' + this.start_ntp);
12351230 if( this.supportsURLTimeEncoding() ){
12361231
12371232 //make sure this.seek_time_sec is up-to-date:
@@ -1248,9 +1243,9 @@
12491244 //add in the offset:
12501245 if(this.seek_time_sec && this.seek_time_sec!=0){
12511246 this.currentTime+=this.seek_time_sec;
1252 - }else if(this.start_offset && this.start_offset!=0){
1253 - this.currentTime+=this.start_offset;
1254 - }
 1247+ }else if(this.start_offset && this.start_offset!=0){
 1248+ this.currentTime = parseFloat(this.currentTime) + parseFloat(this.start_offset);
 1249+ }
12551250 },
12561251 doEmbedHTML:function()
12571252 {
@@ -2154,7 +2149,7 @@
21552150 if( this.start_offset ){
21562151 //if start offset include that calculation
21572152 this.setSliderValue( ( this.currentTime - this.start_offset ) / this.duration );
2158 - this.setStatus( seconds2npt(this.currentTime) + '/'+ seconds2npt(this.start_offset+this.duration ));
 2153+ this.setStatus( seconds2npt(this.currentTime) + '/'+ seconds2npt(parseFloat(this.start_offset)+parseFloat(this.duration) ));
21592154 }else{
21602155 this.setSliderValue( this.currentTime / this.duration );
21612156 this.setStatus( seconds2npt(this.currentTime) + '/' + seconds2npt(this.duration ));
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/nativeEmbed.js
@@ -25,7 +25,7 @@
2626 //we want to let mv_embed handle the controls so notice the absence of control attribute
2727 // controls=false results in controls being displayed:
2828 //http://lists.whatwg.org/pipermail/whatwg-whatwg.org/2008-August/016159.html
29 - js_log("native play url:" + this.getURI( this.seek_time_sec ));
 29+ js_log("native play url:" + this.getSrc() + ' start_offset: '+ this.start_ntp + ' end: ' + this.end_ntp);
3030 var eb = '<video ' +
3131 'id="' + this.pid + '" ' +
3232 'style="width:' + this.width+'px;height:' + this.height + 'px;" ' +
@@ -33,7 +33,7 @@
3434 'src="' + this.getSrc() + '" ';
3535
3636 if(!this.onlyLoadFlag)
37 - eb+= 'autoplay="'+this.autoplay+'" ';
 37+ eb+='autoplay="true" ';
3838
3939 //continue with the other attr:
4040 eb+= 'oncanplaythrough="$j(\'#'+this.id+'\').get(0).oncanplaythrough();return false;" ' +
@@ -68,16 +68,25 @@
6969 }
7070 },
7171 doSeek:function(perc){
72 - js_log('native:seek:p: ' + perc+ ' : ' + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
 72+ //js_log('native:seek:p: ' + perc+ ' : ' + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
7373 //@@todo check if the clip is loaded here (if so we can do a local seek)
7474 if( this.supportsURLTimeEncoding() || !this.vid){
75 - this.parent_doSeek(perc);
 75+ //make sure we could not do a local seek instead:
 76+ if( perc < this.bufferedPercent ){
 77+ js_log("do local seek " + perc + ' is already buffered < ' + this.bufferedPercent);
 78+ this.doNativeSeek(perc);
 79+ }else{
 80+ this.parent_doSeek(perc);
 81+ }
7682 }else if(this.vid.duration ){
77 - this.seek_time_sec=0;
78 - this.vid.currentTime = perc * this.vid.duration;
79 - this.parent_monitor();
 83+ this.doNativeSeek(perc);
8084 }
8185 },
 86+ doNativeSeek:function(perc){
 87+ this.seek_time_sec=0;
 88+ this.vid.currentTime = perc * this.vid.duration;
 89+ this.parent_monitor();
 90+ },
8291 setCurrentTime: function(pos, callback){
8392 var _this = this;
8493 this.getVID();
@@ -136,7 +145,10 @@
137146 this.getVID();
138147 js_log('f:onloadedmetadata metadata ready (update duration)');
139148 //update duration if not set (for now trust the getDuration more than this.vid.duration
140 - this.duration = ( this.getDuration() ) ?this.getDuration() : this.vid.duration;
 149+ if( this.getDuration()==0 ){
 150+ js_log('updaed duration via native video duration: '+ this.vid.duration)
 151+ this.duration = this.vid.duration;
 152+ }
141153 },
142154 onprogress: function(e){
143155 this.bufferedPercent = e.loaded / e.total;

Status & tagging log