Index: branches/new-upload/phase3/skins/common/sticky.js |
— | — | @@ -85,7 +85,7 @@ |
86 | 86 | // Netscape 4.x browser resize fix |
87 | 87 | function MM_reloadPage(init) { |
88 | 88 | 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; }} |
90 | 90 | else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) {location.reload();}} |
91 | 91 | |
92 | 92 | // Create browser-independent layer and browser objects |
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -82,6 +82,11 @@ |
83 | 83 | 'title': 'Advanced Options' |
84 | 84 | } |
85 | 85 | }, |
| 86 | + /* |
| 87 | + * sets the default display item: |
| 88 | + * can be any content_providers key or 'all' |
| 89 | + */ |
| 90 | + disp_item : 'metavid', |
86 | 91 | /** the default content providers list. |
87 | 92 | * |
88 | 93 | * (should be note that special tabs like "upload" and "combined" don't go into the content proviers list: |
— | — | @@ -114,8 +119,7 @@ |
115 | 120 | */ |
116 | 121 | 'this_wiki':{ |
117 | 122 | 'enabled': 0, |
118 | | - 'checked': 0, |
119 | | - 'd' : 0, |
| 123 | + 'checked': 0, |
120 | 124 | 'title' : 'This Wiki', |
121 | 125 | 'desc' : '(should be updated with the proper text) maybe import from some config value', |
122 | 126 | 'api_url': wgServer + wgScriptPath + '/api.php', |
— | — | @@ -125,8 +129,7 @@ |
126 | 130 | }, |
127 | 131 | 'wiki_commons':{ |
128 | 132 | 'enabled': 1, |
129 | | - 'checked': 1, |
130 | | - 'd' : 0, |
| 133 | + 'checked': 1, |
131 | 134 | 'title' :'Wikipedia Commons', |
132 | 135 | 'desc' : 'Wikimedia Commons is a media file repository making available public domain '+ |
133 | 136 | 'and freely-licensed educational media content (images, sound and video clips) to all.', |
— | — | @@ -149,7 +152,6 @@ |
150 | 153 | 'archive_org':{ |
151 | 154 | 'enabled':1, |
152 | 155 | 'checked':1, |
153 | | - 'd' :0, |
154 | 156 | 'title' : 'Archive.org', |
155 | 157 | 'desc' : 'The Internet Archive, a digital library of cultural artifacts', |
156 | 158 | 'homepage':'http://www.archive.org/about/about.php', |
— | — | @@ -163,7 +165,6 @@ |
164 | 166 | 'metavid':{ |
165 | 167 | 'enabled':1, |
166 | 168 | 'checked':1, |
167 | | - 'd' :1, |
168 | 169 | 'title' :'Metavid.org', |
169 | 170 | 'homepage':'http://metavid.org', |
170 | 171 | 'desc' : 'Metavid hosts thousands of hours of US house and senate floor proceedings', |
— | — | @@ -281,9 +282,9 @@ |
282 | 283 | } |
283 | 284 | //could not find it return unknown_license |
284 | 285 | return { |
285 | | - 'title' : gM('unknown_license'), |
| 286 | + 'title' : gM('unknown_license'), |
286 | 287 | 'img_html' : '<span>' + gM('unknown_license') + '</span>', |
287 | | - 'lurl' : license_url |
| 288 | + 'lurl' : license_url |
288 | 289 | }; |
289 | 290 | }, |
290 | 291 | //some default layout values: |
— | — | @@ -298,7 +299,7 @@ |
299 | 300 | |
300 | 301 | init: function( iObj ){ |
301 | 302 | var _this = this; |
302 | | - js_log('remoteSearchDriver:init'); |
| 303 | + js_log('remoteSearchDriver:init'); |
303 | 304 | for( var i in default_remote_search_options ) { |
304 | 305 | if( iObj[i]){ |
305 | 306 | this[ i ] = iObj[i]; |
— | — | @@ -318,7 +319,8 @@ |
319 | 320 | this.content_providers[ cpc ][ cinx ] = this.cpconfig[cpc][ cinx]; |
320 | 321 | } |
321 | 322 | } |
322 | | - } |
| 323 | + } |
| 324 | + |
323 | 325 | //set up the target invocation: |
324 | 326 | if( $j(this.target_invocation).length==0 ){ |
325 | 327 | js_error("RemoteSearchDriver:: no target invocation provided") |
— | — | @@ -326,7 +328,7 @@ |
327 | 329 | $j(this.target_invocation).css('cursor','pointer').attr('title', gM('add_media_wizard')).click(function(){ |
328 | 330 | _this.doInitDisplay(); |
329 | 331 | }); |
330 | | - } |
| 332 | + } |
331 | 333 | }, |
332 | 334 | doInitDisplay:function(){ |
333 | 335 | var _this = this; |
— | — | @@ -344,7 +346,7 @@ |
345 | 347 | _this.getTexboxSelection(); |
346 | 348 | |
347 | 349 | $j(_this.target_container).dialog('open'); |
348 | | - }) |
| 350 | + }); |
349 | 351 | }, |
350 | 352 | //gets the in and out points for insert position or grabs the selected text for search |
351 | 353 | getTexboxSelection:function(){ |
— | — | @@ -520,19 +522,10 @@ |
521 | 523 | }); |
522 | 524 | }, |
523 | 525 | runSearch: function(){ |
524 | | - js_log("f:runSearch"); |
| 526 | + js_log("f:runSearch::" + this.disp_item); |
525 | 527 | //draw_direct_flag |
526 | 528 | 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 | + |
537 | 530 | cp = this.content_providers[this.disp_item]; |
538 | 531 | |
539 | 532 | //check if we need to update: |
— | — | @@ -660,7 +653,7 @@ |
661 | 654 | }); |
662 | 655 | return false; |
663 | 656 | }else if( !this.checkRepoLocal( cp ) && this.import_url_mode == 'none'){ |
664 | | - if( this.disp_item == 'combined'){ |
| 657 | + if( this.disp_item == 'combined' ){ |
665 | 658 | //combined results are harder to error handle just ignore that repo |
666 | 659 | cp.sObj.loading = false; |
667 | 660 | }else{ |
— | — | @@ -668,9 +661,12 @@ |
669 | 662 | } |
670 | 663 | return false; |
671 | 664 | } |
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); |
675 | 671 | //else we need to run the search: |
676 | 672 | var iObj = {'cp':cp, 'rsd':_this}; |
677 | 673 | eval('cp.sObj = new '+cp.lib+'Search( iObj );'); |
— | — | @@ -683,24 +679,30 @@ |
684 | 680 | |
685 | 681 | //do search |
686 | 682 | cp.sObj.getSearchResults(); |
| 683 | + js_log('rand getSearchResults on cp disp is: '+ _this.disp_item); |
687 | 684 | _this.checkResultsDone(); |
688 | 685 | }); |
689 | 686 | }, |
| 687 | + /* check for all the results to finish */ |
690 | 688 | checkResultsDone: function(){ |
| 689 | + js_log( "checkResultsDone:entry: " + rsdMVRS.disp_item + ' not: ' + this.disp_item); |
| 690 | + |
691 | 691 | var _this = this; |
692 | | - var loading_done = true; |
| 692 | + var loading_done = true; |
| 693 | + |
693 | 694 | for(var cp_id in this.content_providers){ |
694 | | - cp = this.content_providers[ cp_id ]; |
| 695 | + var cp = this.content_providers[ cp_id ]; |
695 | 696 | if(typeof cp['sObj'] != 'undefined'){ |
696 | 697 | if( cp.sObj.loading ) |
697 | 698 | loading_done=false; |
698 | 699 | } |
699 | | - } |
700 | | - |
701 | | - if( loading_done ){ |
702 | | - js_log("checkResultsDone: load done"); |
| 700 | + } |
| 701 | + if( loading_done ){ |
703 | 702 | 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'); |
705 | 707 | setTimeout( _this.instance_name + '.checkResultsDone()', 30); |
706 | 708 | } |
707 | 709 | }, |
— | — | @@ -716,7 +718,7 @@ |
717 | 719 | var cp = this.content_providers[cp_id]; |
718 | 720 | if( cp.enabled && cp.checked){ |
719 | 721 | //add selected default if set |
720 | | - if( cp.d == 1) |
| 722 | + if( this.disp_item == cp_id) |
721 | 723 | selected_tab=inx; |
722 | 724 | |
723 | 725 | o+='<li class="rsd_cp_tab">'; |
— | — | @@ -805,13 +807,13 @@ |
806 | 808 | return false; |
807 | 809 | }, |
808 | 810 | drawOutputResults: function(){ |
809 | | - js_log('f:drawOutputResults'); |
| 811 | + js_log('f:drawOutputResults::' + this.disp_item); |
810 | 812 | var _this = this; |
811 | 813 | var o=''; |
812 | 814 | |
813 | 815 | var cp_id = this.disp_item; |
814 | 816 | var cp = this.content_providers[this.disp_item]; |
815 | | - |
| 817 | + |
816 | 818 | //empty the existing results: |
817 | 819 | $j('#tab-' + cp_id).empty(); |
818 | 820 | |
— | — | @@ -849,8 +851,7 @@ |
850 | 852 | o+='<img title="'+rItem.title+'" class="rsd_res_item" id="res_' + cp_id + '_' + rInx +'" style="float:left;width:' + |
851 | 853 | _this.thumb_width + 'px; padding:5px;" src="' + |
852 | 854 | cp.sObj.getImageTransform( rItem, {'width':_this.thumb_width } ) |
853 | | - + '">'; |
854 | | - |
| 855 | + + '">'; |
855 | 856 | //add license icons if present |
856 | 857 | if( rItem.license ) |
857 | 858 | o+= _this.getlicenseImgSet( rItem.license ); |
— | — | @@ -861,6 +862,7 @@ |
862 | 863 | } |
863 | 864 | drawResultCount++; |
864 | 865 | }); |
| 866 | + js_log('append to: ' + '#tab-' + cp_id); |
865 | 867 | //put in the tab output (plus clear the output) |
866 | 868 | $j('#tab-' + cp_id).append( o + '<div style="clear:both"/>'); |
867 | 869 | } |
— | — | @@ -1505,16 +1507,7 @@ |
1506 | 1508 | }, |
1507 | 1509 | selectTab:function( selected_cp_id ){ |
1508 | 1510 | 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; |
1519 | 1512 | if( this.disp_item == 'upload' ){ |
1520 | 1513 | this.doUploadInteface(); |
1521 | 1514 | }else{ |
Index: branches/new-upload/phase3/js2/mwEmbed/mv_embed.js |
— | — | @@ -48,8 +48,6 @@ |
49 | 49 | //for when useing mv_embed with script-loader in root mediawiki path |
50 | 50 | var mediaWiki_mvEmbed_path = 'js2/mwEmbed/'; |
51 | 51 | |
52 | | -// |
53 | | - |
54 | 52 | var global_player_list = new Array(); //the global player list per page |
55 | 53 | var global_req_cb = new Array(); //the global request callback array |
56 | 54 | var _global = this; //global obj |
— | — | @@ -725,7 +723,7 @@ |
726 | 724 | ], function(){ |
727 | 725 | iObj['instance_name']= 'rsdMVRS'; |
728 | 726 | _global['rsdMVRS'] = new remoteSearchDriver( iObj ); |
729 | | - if(callback) |
| 727 | + if( callback ) |
730 | 728 | callback(); |
731 | 729 | }); |
732 | 730 | }); |
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 @@ |
1571 | 1571 | setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 150); |
1572 | 1572 | return this.wrapEmebedContainer( this.getEmbedObj() ); |
1573 | 1573 | }, |
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(){ |
1579 | 1575 | //give the embed element a unique pid (work around for flowplayer persistence) |
1580 | 1576 | if( this.old_pid!=0 ){ |
1581 | 1577 | this.pid = this.pid +'_'+ this.old_pid; |
1582 | 1578 | } |
1583 | 1579 | return '<a '+ |
1584 | | - 'href="'+ this.media_element.selected_source.getURI( this.seek_time_sec ) + '" '+ |
| 1580 | + 'href="'+ this.getSrc() + '" '+ |
1585 | 1581 | 'style="display:block;width:' + parseInt(this.width) + 'px;height:' + parseInt(this.height) + 'px" '+ |
1586 | 1582 | 'id="'+this.pid+'">'+ |
1587 | 1583 | '</a>'; |
— | — | @@ -1588,10 +1584,10 @@ |
1589 | 1585 | postEmbedJS: function() |
1590 | 1586 | { |
1591 | 1587 | 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' ) ; |
1593 | 1589 | var flowConfig = { |
1594 | 1590 | clip: { |
1595 | | - url: _this.media_element.selected_source.getURI(this.seek_time_sec), |
| 1591 | + url: this.getSrc(), |
1596 | 1592 | // when this is false playback does not start until play button is pressed |
1597 | 1593 | autoPlay: true |
1598 | 1594 | }, |
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/javaEmbed.js |
— | — | @@ -29,7 +29,7 @@ |
30 | 30 | //if still unset set to an arbitrary time 60 seconds: |
31 | 31 | if(!this.duration)this.duration=60; |
32 | 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 ); |
| 33 | + var mediaSrc = this.getSrc(); |
34 | 34 | |
35 | 35 | if(mediaSrc.indexOf('://')!=-1 & parseUri(document.URL).host != parseUri(mediaSrc).host){ |
36 | 36 | if(window.cortadoDomainLocations[parseUri(mediaSrc).host]){ |
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/vlcEmbed.js |
— | — | @@ -186,8 +186,7 @@ |
187 | 187 | //for now trust the duration from url over vlc input.length |
188 | 188 | if( !this.getDuration() && this.vlc.input.length > 0 ) |
189 | 189 | { |
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); |
192 | 191 | this.duration = this.vlc.input.length /1000; |
193 | 192 | } |
194 | 193 | this.currentTime = this.vlc.input.time/1000; |
— | — | @@ -195,7 +194,7 @@ |
196 | 195 | this.currentTime = this.currentTime - this.startOffset; |
197 | 196 | }, |
198 | 197 | 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 |
200 | 199 | }, |
201 | 200 | onStop: function(){ |
202 | 201 | js_log('vlc:onStop:'); |
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js |
— | — | @@ -90,7 +90,7 @@ |
91 | 91 | 'title', |
92 | 92 | 'URLTimeEncoding', //boolean if we support temporal url requests on the source media |
93 | 93 | 'startOffset', |
94 | | - 'duration', |
| 94 | + 'durationHint', |
95 | 95 | 'start', |
96 | 96 | 'end', |
97 | 97 | 'default', |
— | — | @@ -536,15 +536,17 @@ |
537 | 537 | var pUrl = parseUri ( this.src ); |
538 | 538 | if(typeof pUrl['queryKey']['t'] != 'undefined'){ |
539 | 539 | 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 ]; |
544 | 543 | if( $j(element).attr( attr ) ) { |
545 | 544 | this[ attr ] = $j(element).attr( attr ); |
546 | 545 | } |
547 | | - } |
548 | | - |
| 546 | + } |
| 547 | + //update duration from hit if present: |
| 548 | + if(this.durationHint) |
| 549 | + this.duration = this.durationHint; |
| 550 | + |
549 | 551 | if ( $j(element).attr('type')) |
550 | 552 | this.mime_type = $j(element).attr('type'); |
551 | 553 | else if ($j(element).attr('content-type')) |
— | — | @@ -656,15 +658,11 @@ |
657 | 659 | } |
658 | 660 | if(this.duration){ |
659 | 661 | this.end_ntp = seconds2npt( parseInt(this.duration) + parseInt(this.start_offset) ); |
660 | | - } |
| 662 | + } |
661 | 663 | } |
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); |
668 | 664 | } |
| 665 | + //else nothing to parse just keep whatever info we already have |
| 666 | + |
669 | 667 | //js_log('f:parseURLDuration() for:' + this.src + ' d:' + this.duration); |
670 | 668 | }, |
671 | 669 | /** Attempts to detect the type of a media file based on the URI. |
— | — | @@ -1187,22 +1185,19 @@ |
1188 | 1186 | return default_time_req; |
1189 | 1187 | return this.media_element.selected_source.start_ntp+'/'+this.media_element.selected_source.end_ntp; |
1190 | 1188 | }, |
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 | + |
1207 | 1202 | //return the duration |
1208 | 1203 | return this.duration; |
1209 | 1204 | }, |
— | — | @@ -1230,7 +1225,7 @@ |
1231 | 1226 | //do seek function (should be overwritten by implementing embedLibs) |
1232 | 1227 | // first check if seek can be done on locally downloaded content. |
1233 | 1228 | 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); |
1235 | 1230 | if( this.supportsURLTimeEncoding() ){ |
1236 | 1231 | |
1237 | 1232 | //make sure this.seek_time_sec is up-to-date: |
— | — | @@ -1248,9 +1243,9 @@ |
1249 | 1244 | //add in the offset: |
1250 | 1245 | if(this.seek_time_sec && this.seek_time_sec!=0){ |
1251 | 1246 | 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 | + } |
1255 | 1250 | }, |
1256 | 1251 | doEmbedHTML:function() |
1257 | 1252 | { |
— | — | @@ -2154,7 +2149,7 @@ |
2155 | 2150 | if( this.start_offset ){ |
2156 | 2151 | //if start offset include that calculation |
2157 | 2152 | 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) )); |
2159 | 2154 | }else{ |
2160 | 2155 | this.setSliderValue( this.currentTime / this.duration ); |
2161 | 2156 | this.setStatus( seconds2npt(this.currentTime) + '/' + seconds2npt(this.duration )); |
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/nativeEmbed.js |
— | — | @@ -25,7 +25,7 @@ |
26 | 26 | //we want to let mv_embed handle the controls so notice the absence of control attribute |
27 | 27 | // controls=false results in controls being displayed: |
28 | 28 | //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); |
30 | 30 | var eb = '<video ' + |
31 | 31 | 'id="' + this.pid + '" ' + |
32 | 32 | 'style="width:' + this.width+'px;height:' + this.height + 'px;" ' + |
— | — | @@ -33,7 +33,7 @@ |
34 | 34 | 'src="' + this.getSrc() + '" '; |
35 | 35 | |
36 | 36 | if(!this.onlyLoadFlag) |
37 | | - eb+= 'autoplay="'+this.autoplay+'" '; |
| 37 | + eb+='autoplay="true" '; |
38 | 38 | |
39 | 39 | //continue with the other attr: |
40 | 40 | eb+= 'oncanplaythrough="$j(\'#'+this.id+'\').get(0).oncanplaythrough();return false;" ' + |
— | — | @@ -68,16 +68,25 @@ |
69 | 69 | } |
70 | 70 | }, |
71 | 71 | 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 ); |
73 | 73 | //@@todo check if the clip is loaded here (if so we can do a local seek) |
74 | 74 | 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 | + } |
76 | 82 | }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); |
80 | 84 | } |
81 | 85 | }, |
| 86 | + doNativeSeek:function(perc){ |
| 87 | + this.seek_time_sec=0; |
| 88 | + this.vid.currentTime = perc * this.vid.duration; |
| 89 | + this.parent_monitor(); |
| 90 | + }, |
82 | 91 | setCurrentTime: function(pos, callback){ |
83 | 92 | var _this = this; |
84 | 93 | this.getVID(); |
— | — | @@ -136,7 +145,10 @@ |
137 | 146 | this.getVID(); |
138 | 147 | js_log('f:onloadedmetadata metadata ready (update duration)'); |
139 | 148 | //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 | + } |
141 | 153 | }, |
142 | 154 | onprogress: function(e){ |
143 | 155 | this.bufferedPercent = e.loaded / e.total; |