r51841 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r51840‎ | r51841 | r51842 >
Date:03:28, 14 June 2009
Author:dale
Status:deferred
Tags:
Comment:
* added doPlayThenSeek to support seeking while video is "stooped" (for instances where oggz_chop is not installed) .. we first play/load then seek.
* re-worked addMediaWizard to work better with archive.org sources
* improved addMediaWizard with sequencer integration. (some issues remain)
Modified paths:
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libAddMedia/seqRemoteSearchDriver.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/htmlEmbed.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/javaEmbed.js (modified) (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/libSequencer/mvPlayList.js (modified) (history)
  • /branches/new-upload/phase3/js2/mwEmbed/libSequencer/mvSequencer.js (modified) (history)

Diff [purge]

Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js
@@ -188,7 +188,11 @@
189189 getEmbedWikiCode:function(rObj){
190190 var layout = ( rObj.layout)? rObj.layout:"right"
191191 var o= '[[' + this.rsd.cFileNS + ':' + rObj.target_resource_title + '|thumb|'+layout;
192 -
 192+
 193+ if(!rObj.target_width && rObj.width){
 194+ rObj.target_width = (rObj.width < 640)? rObj.width: '640';
 195+ }
 196+
193197 if(rObj.target_width)
194198 o+='|' + rObj.target_width + 'px';
195199
@@ -198,6 +202,10 @@
199203 o+=']]';
200204 return o;
201205 },
 206+ updateTargetResourceTitle:function(rObj){
 207+ rObj.target_resource_title = rObj.titleKey.replace(/File:|Image:/,'');
 208+ rObj.target_resource_title = this.cp.resource_prefix + rObj.target_resource_title;
 209+ },
202210 updateDataForImport:function( rObj ){
203211 return rObj;
204212 }
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js
@@ -60,7 +60,9 @@
6161 for(var resource_id in data.response.docs){
6262 var resource = data.response.docs[resource_id];
6363 var rObj = {
64 - 'titleKey' : resource.identifier,
 64+ //@@todo we should add .ogv or oga if video or audio:
 65+ 'titleKey' : resource.identifier + '.ogg',
 66+ 'resourceKey': resource.identifier,
6567 'link' : _this.dtUrl + resource.identifier,
6668 'title' : resource.title,
6769 'poster' : _this.dnUrl + resource.identifier+'/format=thumbnail',
@@ -72,7 +74,8 @@
7375 'mime' : 'application/ogg',
7476 //set the licence: (rsd is a pointer to the parent remoteSearchDriver )
7577 'license' : this.rsd.getLicenceFromUrl( resource.licenseurl ),
76 - 'pSobj' :_this
 78+ 'pSobj' :_this
 79+
7780 };
7881 this.resultsObj[ resource_id ] = rObj;
7982
@@ -90,7 +93,7 @@
9194 var _this = this;
9295 do_api_req( {
9396 'data':{'avinfo':1},
94 - 'url':_this.dnUrl + rObj.titleKey + '/format=Ogg+video'
 97+ 'url':_this.dnUrl + rObj.resourceKey + '/format=Ogg+video'
9598 },function(data){
9699 var cat = data;
97100 if(data['length'])
@@ -99,6 +102,7 @@
100103 rObj.width = data['width'];
101104 if(data['height'])
102105 rObj.height = data['height'];
 106+
103107 callback();
104108 });
105109 },
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js
@@ -55,7 +55,7 @@
5656 rObj['start_time'] = proe.queryKey['t'].split('/')[0];
5757 rObj['end_time'] = proe.queryKey['t'].split('/')[1];
5858 rObj['stream_name'] = proe.queryKey['stream_name'];
59 -
 59+
6060 //all metavid content is public domain:
6161 rObj['license'] = _this.rsd.getLicenceFromKey( 'pd' );
6262
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/seqRemoteSearchDriver.js
@@ -29,28 +29,36 @@
3030 this[i] = tmpRSD[i];
3131 }
3232 }
33 - //extend actions:
34 - this.pSeq.parent_do_refresh_timeline = this.pSeq.do_refresh_timeline;
35 - this.pSeq.do_refresh_timeline = function(){
36 - js_log("seqRs refresh chain::" + _this.pSeq.disp_menu_item);
37 - //call the parent
38 - _this.pSeq.parent_do_refresh_timeline();
39 - //add our local bindings if our window is 'active'
40 - if(_this.pSeq.disp_menu_item == 'cliplib'){
41 - _this.addResultBindings();
 33+ //extend parent_do_refresh_timeline actions:
 34+ /*if(!this.pSeq.parent_do_refresh_timeline){
 35+ this.pSeq.parent_do_refresh_timeline = this.pSeq.do_refresh_timeline;
 36+ this.pSeq.do_refresh_timeline = function(){
 37+ js_log("seqRs refresh chain::" + _this.pSeq.disp_menu_item);
 38+ //call the parent
 39+ _this.pSeq.parent_do_refresh_timeline();
 40+ //add our local bindings if our window is 'active'
 41+ if(_this.pSeq.disp_menu_item == 'cliplib'){
 42+ _this.addResultBindings();
 43+ }
4244 }
43 - }
 45+ }*/
4446 },
4547 resourceEdit:function(){
4648 var _this = this;
4749
48 - },
 50+ },
4951 addResultBindings:function(){
5052 //set up seq:
5153 var _this = this;
5254 //setup parent bindings:
5355 this.parent_addResultBindings();
5456
 57+ //add an aditional click binding
 58+ $j('.rsd_res_item').click(function(){
 59+ js_log('SeqRemoteSearch: rsd_res_item: click (remove sequence_add_target)');
 60+ _this.sequence_add_target =false;
 61+ });
 62+
5563 //add an additional drag binding
5664 $j( '.rsd_res_item' ).draggable('destroy').draggable({
5765 helper:function(){
@@ -82,7 +90,40 @@
8391
8492 },
8593 insertResource:function(rObj){
86 - js_log("SEQ insert resource");
 94+ var _this = this;
 95+ js_log("SEQ insert resource after:" + _this.sequence_add_target );
 96+ //@@todo show watting of sorts.
 97+
 98+ //get target order:
 99+ var cat = rObj;
 100+ //check for target insert path
 101+ this.checkImportResource( rObj, function(){
 102+ //get the local src file (if we imported) :
 103+ do_api_req({
 104+ 'data': {
 105+ 'action' : 'query',
 106+ 'prop' : 'imageinfo',
 107+ 'iiprop' : 'url'
 108+ },
 109+ 'url': _this.local_wiki_api_url
 110+ }, function(data){
 111+ debugger;
 112+ });
 113+
 114+ var clipConfig = {
 115+ 'src' : rObj.src,
 116+ 'type' : rObj.mime,
 117+ 'uri' : _this.cFileNS + ':' + rObj.target_resource_title,
 118+ 'poster' : rObj.poster,
 119+ 'title' : rObj.title
 120+ };
 121+ if(rObj.start_time && rObj.end_time){
 122+ clipConfig['dur'] = npt2seconds( rObj.end_time ) - npt2seconds( rObj.start_time );
 123+ }
 124+ //try and add the clip:
 125+ _this.pSeq.addClip( clipConfig );
 126+ $j('#seq_resource_import').dialog('destroy').remove();
 127+ });
87128 },
88129 getClipEditControlActions:function(){
89130 var _this = this;
@@ -105,7 +146,7 @@
106147
107148 $j('#seq_resource_import').dialog('destroy').dialog({
108149 bgiframe: true,
109 - width:640,
 150+ width:700,
110151 height:480,
111152 modal: true,
112153 buttons: {
@@ -118,6 +159,13 @@
119160 //do parent resource edit (with updated target)
120161 this.parent_resourceEdit(rObj, rsdElement);
121162 },
 163+ getEditToken:function(callback){
 164+ if(this.pSeq.sequenceEditToken){
 165+ callback( this.pSeq.sequenceEditToken )
 166+ }else{
 167+ this.parent_getEditToken(callback);
 168+ }
 169+ },
122170 cancelClipEditCB:function(){
123171 js_log('seqRSD:cancelClipEditCB');
124172 $j('#seq_resource_import').dialog('close').dialog('destroy').remove();
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js
@@ -430,9 +430,11 @@
431431 'enablechunks': true
432432 };
433433 //check for editToken:
434 - var etoken = _this.formData['wpEditToken'];
435 - if(etoken)
436 - aReq['token'] = etoken;
 434+ if(!this.etoken)
 435+ this.etoken = _this.formData['wpEditToken'];
 436+
 437+ if(this.etoken)
 438+ aReq['token'] = this.etoken;
437439
438440 if( _this.formData['wpWatchthis'] )
439441 aReq['watch'] = _this.formData['wpWatchthis'];
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js
@@ -91,7 +91,7 @@
9292 * sets the default display item:
9393 * can be any content_providers key or 'all'
9494 */
95 - disp_item : 'metavid',
 95+ disp_item : 'archive_org',
9696 /** the default content providers list.
9797 *
9898 * (should be note that special tabs like "upload" and "combined" don't go into the content proviers list:
@@ -714,13 +714,13 @@
715715 cp.offset = (cp.offset) ? cp.offset : cp.sObj.offset;
716716
717717 //do search
718 - cp.sObj.getSearchResults();
719 - js_log('rand getSearchResults on cp disp is: '+ _this.disp_item);
 718+ cp.sObj.getSearchResults();
720719 _this.checkResultsDone();
721720 });
722721 },
723722 /* check for all the results to finish */
724723 checkResultsDone: function(){
 724+ //js_log('rsd:checkResultsDone');
725725 var _this = this;
726726 var loading_done = true;
727727
@@ -736,7 +736,7 @@
737737 }else{
738738 //make sure the instance name is up-to-date refrence to _this;
739739 eval( _this.instance_name + ' = _this');
740 - setTimeout( _this.instance_name + '.checkResultsDone()', 30);
 740+ setTimeout( _this.instance_name + '.checkResultsDone()', 50);
741741 }
742742 },
743743 drawTabs: function(){
@@ -1064,7 +1064,7 @@
10651065 var _this = this;
10661066 return {
10671067 'insert' :function(rObj){
1068 - _this.insertResource();
 1068+ _this.insertResource(rObj);
10691069 },
10701070 'preview':function(rObj){
10711071 _this.previewResource( rObj )
@@ -1147,8 +1147,7 @@
11481148 checkImportResource:function( rObj, cir_callback){
11491149 //@@todo get the localized File/Image namespace name or do a general {NS}:Title
11501150 var cp = rObj.pSobj.cp;
1151 - var _this = this;
1152 - rObj.target_resource_title = rObj.titleKey.replace(/File:|Image:/,'');
 1151+ var _this = this;
11531152
11541153 //check if local repository
11551154 //or if import mode if just "linking"
@@ -1156,11 +1155,15 @@
11571156 //local repo jump directly to check Import Resource callback:
11581157 cir_callback( rObj );
11591158 }else{
1160 - //not a local domain update target resource name with the prefix:
 1159+ //update target_resource_title
 1160+ rObj.target_resource_title = rObj.titleKey.replace(/File:|Image:/,'');
11611161 rObj.target_resource_title = cp.resource_prefix +rObj.target_resource_title;
11621162
11631163 //check if the resource is not already on this wiki
1164 - reqObj={'action':'query', 'titles': _this.cFileNS + ':' + rObj.target_resource_title};
 1164+ reqObj={
 1165+ 'action':'query',
 1166+ 'titles': _this.cFileNS + ':' + rObj.target_resource_title
 1167+ };
11651168
11661169 do_api_req( {
11671170 'data':reqObj,
@@ -1283,6 +1286,7 @@
12841287 'mvBaseUploadInterface',
12851288 '$j.ui.progressbar'
12861289 ],function(){
 1290+
12871291 //initicate a download similar to url copy:
12881292 myUp = new mvBaseUploadInterface({
12891293 'api_url' : _this.local_wiki_api_url,
@@ -1295,13 +1299,32 @@
12961300 cir_callback();
12971301 }
12981302 });
1299 - myUp.doHttpUpload({
1300 - 'url' : rObj.src,
1301 - 'filename' : rObj.target_resource_title,
1302 - 'comment' : $j('#rsd_import_ta').val()
1303 - });
 1303+ //set the edit token if we have it handy
 1304+ _this.getEditToken(function( token ){
 1305+ myUp.etoken = token;
 1306+ myUp.doHttpUpload({
 1307+ 'url' : rObj.src,
 1308+ 'filename' : rObj.target_resource_title,
 1309+ 'comment' : $j('#rsd_import_ta').val()
 1310+ });
 1311+ })
 1312+
 1313+
13041314 });
13051315 },
 1316+ getEditToken:function(callback){
 1317+ //first try the page form:
 1318+ var etoken = $j("input[name='wpEditToken']").val();
 1319+ if(etoken){
 1320+ callback( etoken );
 1321+ return ;
 1322+ }
 1323+ //@@todo try to load over ajax if( _this.local_wiki_api_url ) is set
 1324+ // (your on the api domain but are inserting from a normal page view)
 1325+ if( _this.local_wiki_api_url){
 1326+
 1327+ }
 1328+ },
13061329 /**
13071330 * doImportSpecialPage
13081331 * can be depricated once we support upload api support is widespred.
@@ -1490,6 +1513,7 @@
14911514 $j('#rsd_resource_preview').remove();
14921515 $j('#rsd_resource_edit').remove();
14931516 $j(this.target_container).dialog('close');
 1517+ $j(this.target_container).remove();
14941518 },
14951519 setResultBarControl:function( ){
14961520 var _this = this;
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js
@@ -177,7 +177,15 @@
178178 }else if( _this.upload_mode == 'api' && $j('#wpSourceTypeURL').get(0).checked){
179179 js_log('doHttpUpload (no form submit) ');
180180 //if the api is supported.. && source type is http do upload with http status updates
181 - _this.doHttpUpload();
 181+ var httpUpConf ={
 182+ 'url' : $j('#wpUploadFileURL').val(),
 183+ 'filename' : $j('#wpDestFile').val(),
 184+ 'comment' : $j('#wpUploadDescription').val()
 185+ }
 186+ //check for editToken
 187+ _this.etoken = $j("input[name='wpEditToken']").val();
 188+
 189+ _this.doHttpUpload( httpUpConf );
182190 }else{
183191 js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode );
184192 }
@@ -189,27 +197,30 @@
190198 $j('#dlbox-centered').html( '<h5>' + _this.getProgressTitle() + '</h5>' +
191199 mv_get_loading_img( 'left:40%;top:20%')
192200 );
 201+ //setup request:
193202 var req = {
194 - 'action' : 'upload',
195 - 'url' : $j('#wpUploadFileURL').val(),
196 - 'filename' : $j('#wpDestFile').val(),
197 - 'comment' : $j('#wpUploadDescription').val(),
198 - 'asyncdownload': true
199 - }
200 - //check for editToken
201 - _this.etoken = $j("input[name='wpEditToken']").val();
202 - if(_this.etoken)
203 - req['token'] = _this.etoken;
 203+ 'action' : 'upload',
 204+ 'asyncdownload' : true //do a s
 205+ };
 206+ //set config from options:
 207+ for(var i in opt){
 208+ req[i]= opt[i];
 209+ }
204210
205 - for(var i in opt){
206 - req[i]= opt[i];
 211+ //else try and get a token:
 212+ if(!_this.etoken && _this.api_url){
 213+ js_log('Error:doHttpUpload: missing token');
 214+
 215+ }else{
 216+ req['token'] =_this.etoken;
207217 }
 218+ //do the api req
208219 do_api_req({
209220 'data': req,
210221 'url' : _this.api_url
211222 }, function( data ){
212223 _this.processApiResult( data );
213 - });
 224+ });
214225 },
215226 doAjaxWarningIgnore:function(){
216227 var _this = this;
@@ -345,10 +356,12 @@
346357 bObj[ gM('return-to-form') ] = function(){
347358 $j(this).dialog('close');
348359 };
349 - _this.updateProgressWin( gM('uploaderror'), gM('unknown-error') + '<br>' + error_msg, bObj);
 360+ _this.updateProgressWin( gM('uploaderror'), gM('unknown-error') + '<br>' + error_msg, bObj);
 361+ return ;
350362 }else{
351363 if( apiRes.error.info ){
352364 _this.updateProgressWin( gM('uploaderror'), apiRes.error.info ,bObj);
 365+ return ;
353366 }else{
354367 gMsgLoadRemote(error_code, function(){
355368 js_log('send msg: ' + gM( error_code ));
Index: branches/new-upload/phase3/js2/mwEmbed/libSequencer/mvPlayList.js
@@ -76,7 +76,7 @@
7777
7878 this.activeClipList = new activeClipList();
7979 //add default track & default track pointer:
80 - this.tracks[0]= new trackObj();
 80+ this.tracks[0]= new trackObj({'inx':0});
8181 this.default_track = this.tracks[0];
8282
8383 //get all the attributes:
@@ -120,31 +120,13 @@
121121 $j('body').append('<div class="ui-widget-overlay" style="width: 100%; height: 100%px; z-index: 10;"></div>');
122122 $j('body').append('<div id="sequencer_target" style="z-index:11;position:fixed;top:10px;left:10px;right:10px;bottom:10px;" ' +
123123 'class="ui-widget ui-widget-content ui-corner-all"></div>');
124 - /*$j('#sequencer_target').dialog({
125 - bgiframe: true,
126 - autoOpen: true,
127 - modal: true,
128 - buttons: {
129 - 'Cancel': function() {
130 - $j(this).dialog('close');
131 - }
132 - },
133 - }).css({
134 - "position":"relative",
135 - "height": "90%"
136 - }).parent('.ui-dialog').css({
137 - 'width':'auto',
138 - 'height':'auto',
139 - 'top' : '10px',
140 - 'left' : '10px',
141 - 'right' : '10px',
142 - 'bottom': '10px'
143 - });*/
 124+
144125 //@@todo clone the playlist (for faster startup)
145 - /*var this_plObj_Clone = $j('#'+this.id).get(0).cloneNode(true);
146 - this_plObj_Clone.sequencer=true;
147 - this_plObj_Clone.id= 'seq_plobj';
148 - debugger;
 126+ /*
 127+ * var this_plObj_Clone = $j('#'+this.id).get(0).cloneNode(true);
 128+ * this_plObj_Clone.sequencer=true;
 129+ * this_plObj_Clone.id= 'seq_plobj';
 130+ * debugger;
149131 */
150132 //load sequencer:
151133 $j("#sequencer_target").sequencer({
@@ -178,8 +160,8 @@
179161 js_log("f:getPlaylist: " + this.srcType );
180162 //@@todo lazy load plLib
181163 eval('var plObj = '+this.srcType+'Playlist;');
182 - //import methods from the plObj to this
183 - for(var method in plObj){
 164+ //import methods from the plObj to this
 165+ for(var method in plObj){
184166 //js parent preservation for local overwritten methods
185167 if(this[method])this['parent_' + method] = this[method];
186168 this[method]=plObj[method];
@@ -243,6 +225,7 @@
244226 }
245227 },
246228 doWhenClipLoadDone:function(){
 229+ js_log('mvPlaylist:doWhenClipLoadDone');
247230 this.ready_to_play = true;
248231 this.loading = false;
249232 this.getHTML();
@@ -364,9 +347,9 @@
365348 //takes in the playlist
366349 // inherits all the properties
367350 // swaps in the playlist object html/interface div
368 - getHTML:function(){
369 - if(this.loading){
370 - js_log('called getHTML (loading)');
 351+ getHTML:function(){
 352+ js_log('mvPlaylist:getHTML: loading:' + this.loading);
 353+ if(this.loading){
371354 $j('#'+this.id).html('loading playlist<blink>...</blink>');
372355 if( this.loading_external_data ){
373356 //load the data source chain of functions (to update the innerHTML)
@@ -386,7 +369,7 @@
387370 }
388371 },
389372 renderDisplay:function(){
390 - js_log('track length: ' +this.default_track.getClipCount() );''
 373+ js_log('mvPlaylist:renderDisplay:: track length: ' +this.default_track.getClipCount() );''
391374
392375 var plObj=this;
393376 //setup layout for title and dc_ clip container
@@ -418,25 +401,32 @@
419402 this.updateBaseStatus();
420403 },
421404 setupClipDisplay:function(){
422 - var plObj = this;
423 - $j.each(this.default_track.clips, function(i, clip){
424 - $j('#dc_'+plObj.id).append('<div class="clip_container" id="clipDesc_'+clip.id+'" '+
425 - 'style="display:none;position:absolute;text-align: center;border:solid thin;width:'+plObj.width + 'px;'+
426 - 'height:'+(plObj.height )+'px;'+
427 - 'top:' + this.title_bar_height + 'px;left:0px"></div>');
 405+ js_log('mvPlaylist:setupClipDisplay:: clip len:'+ this.default_track.clips.length);
 406+ var _this = this;
 407+ $j.each(this.default_track.clips, function(i, clip){
 408+ $j('#dc_'+_this.id).append('<div class="clip_container cc_" id="clipDesc_'+clip.id+'" '+
 409+ 'style="display:none;position:absolute;text-align: center;border:solid thin;width:'+_this.width + 'px;'+
 410+ 'height:'+(_this.height )+'px;'+
 411+ 'top:' + this.title_bar_height + 'px;left:0px"></div>');
428412 //update the embed html:
429 - clip.embed.height=plObj.height;
430 - clip.embed.width=plObj.width;
 413+ clip.embed.height=_this.height;
 414+ clip.embed.width=_this.width;
431415 clip.embed.play_button=false;
432416
433417 clip.embed.getHTML();//get the thubnails for everything
434 - $j(clip.embed).css({ 'position':"absolute",'top':"0px", 'left':"0px"});
435 - if($j('#clipDesc_'+clip.id).get(0)){
436 - $j('#clipDesc_'+clip.id).get(0).appendChild(clip.embed);
 418+
 419+ $j(clip.embed).css({
 420+ 'position':"absolute",
 421+ 'top':"0px",
 422+ 'left':"0px"
 423+ });
 424+ if($j('#clipDesc_'+clip.id).length != 0){
 425+ js_log("should set: #clipDesc_"+clip.id + ' to: ' + $j(clip.embed).html() )
 426+ $j('#clipDesc_'+clip.id).append( clip.embed );
437427 }else{
438428 js_log('cound not find: clipDesc_'+clip.id);
439429 }
440 - });
 430+ });
441431 if(this.cur_clip)
442432 $j('#clipDesc_'+this.cur_clip.id).css( { display:'inline' } );
443433 },
@@ -488,6 +478,7 @@
489479 $j( $j.btnHtml('edit', 'editBtn_'+this.id, 'pencil',
490480 {'style':'position:absolute;right:0;;font-size:x-small;height:10px;margin-bottom:0;padding-bottom:7px;padding-top:0;'} )
491481 ).click(function(){
 482+ _this.stop();
492483 _this.doEditor();
493484 return false;
494485 }).appendTo('#ptitle_'+this.id);
@@ -923,7 +914,7 @@
924915 }else{
925916 var track = this.tracks[ clipObj.track_id ]
926917 }
927 - js_log('add clip' + clipObj.id +' to track: at:' + pos);
 918+ js_log('add clip:' + clipObj.id +' to track: at:' + pos);
928919 //set the first clip to current (maybe deprecated )
929920 if(clipObj.order==0){
930921 if(!this.cur_clip)this.cur_clip=clipObj;
@@ -1207,8 +1198,7 @@
12081199 stop:function(){
12091200 js_log('pl:do stop');
12101201 //set up convenience pointer to parent playlist
1211 - var plObj = this.pc.pp;
1212 - var plEmbed = this;
 1202+ var plObj = this.pc.pp;
12131203
12141204 var th=Math.round( plObj.pl_layout.clip_desc * plObj.height );
12151205 var tw=Math.round( th * plObj.pl_layout.clip_aspect );
@@ -1216,32 +1206,8 @@
12171207 this.pe_stop();
12181208 var pl_height = (plObj.sequencer=='true')?plObj.height+27:plObj.height;
12191209
1220 - plEmbed.getHTML();
1221 -
1222 - //restore control offsets:
1223 - /*(if(this.pc.pp.controls){
1224 - $j('#dc_'+plObj.id).animate({
1225 - height:pl_height
1226 - },"slow");
1227 - }*/
1228 - //if(plObj.sequencer=='true'){
1229 - /*}else{
1230 - //fade in elements
1231 - $j('#big_play_link_'+this.id+',#lb_'+this.id+',#le_'+this.id+',#seqThumb_'+plObj.id+',#pl_desc_txt_'+this.pc.id).fadeIn("slow");
1232 - //animate restore of resize
1233 - var res ={};
1234 - this.pc.setBaseEmbedDim(res);
1235 - //debugger;
1236 - $j('#img_thumb_'+this.id).animate(res,"slow",null,function(){
1237 - plEmbed.pc.setBaseEmbedDim(plEmbed);
1238 - plEmbed.getHTML();
1239 - //restore the detail
1240 - $j('#clipDesc_'+plEmbed.pc.id).empty();
1241 - plEmbed.pc.getDetail();
1242 - //$j('#seqThumb_'+plObj.id).css({position:'absolute',bottom:Math.round(this.height* pl_layout.seq_nav)});
1243 - //$j('#'+plEmbed.id+',#dc_'+plEmbed.id).css({position:'absolute', zindex:0,width:tw,height:th});
1244 - });
1245 - }*/
 1210+ this.getHTML();
 1211+
12461212 },
12471213 play:function(){
12481214 //js_log('pl eb play');
@@ -1737,15 +1703,16 @@
17381704 },
17391705 tryAddMedia:function(mediaElement, order, track_id){
17401706 js_log('SMIL:tryAddMedia:' + mediaElement);
 1707+ var _this = this;
17411708 //set up basic mvSMILClip send it the mediaElemnt & mvClip init:
17421709 var clipObj = {};
1743 - var clipObj = new mvSMILClip(mediaElement,
1744 - {
1745 - "id":'p_' + this.id + '_c_' + order,
 1710+ var cConfig = {
 1711+ "id":'p_' + _this.id + '_c_' + order,
17461712 "pp":this, //set the parent playlist object pointer
17471713 "order": order
1748 - }
1749 - );
 1714+ };
 1715+ var clipObj = new mvSMILClip(mediaElement, cConfig );
 1716+
17501717 //set optional params track
17511718 if( typeof track_id != 'undefined')
17521719 clipObj["track_id"] = track_id;
@@ -1753,9 +1720,9 @@
17541721 //debugger;
17551722 if ( clipObj ){
17561723 //set up embed:
1757 - clipObj.setUpEmbedObj();
 1724+ clipObj.setUpEmbedObj();
17581725 //add clip to track:
1759 - this.addCliptoTrack( clipObj , order);
 1726+ this.addCliptoTrack( clipObj , order);
17601727 return true;
17611728 }
17621729 //@@todo we could throw error details here once we integrate try catches everywhere :P
@@ -1764,8 +1731,9 @@
17651732 }
17661733 //http://www.w3.org/TR/2007/WD-SMIL3-20070713/smil-extended-media-object.html#smilMediaNS-BasicMedia
17671734 //and added resource description elements
1768 -var mv_smil_ref_supported_attributes = new Array(
1769 - 'id',
 1735+//@@ supporting the "ID" attribute turns out to be kind of tricky since we use it internally
 1736+// (for now don't include)
 1737+var mv_smil_ref_supported_attributes = new Array(
17701738 'src',
17711739 'type',
17721740 'region',
@@ -1773,6 +1741,7 @@
17741742 'transOut',
17751743 'fill',
17761744 'dur',
 1745+ 'title',
17771746
17781747 'uri',
17791748 'poster'
@@ -1798,14 +1767,15 @@
17991768 }else{
18001769 this[method] = myMvClip[method];
18011770 }
1802 - }
 1771+ }
18031772
18041773 //get supported media attr init non-set
1805 - $j.each(mv_smil_ref_supported_attributes, function(i, attr){
 1774+ for(var i =0; i < mv_smil_ref_supported_attributes.length;i++){
 1775+ var attr = mv_smil_ref_supported_attributes[i];
18061776 if( $j(sClipElm).attr(attr)){
18071777 _this[attr] = $j(sClipElm).attr(attr);
18081778 }
1809 - })
 1779+ }
18101780 this['tagName'] = sClipElm.tagName;
18111781
18121782 if( sClipElm.firstChild ){
@@ -1848,7 +1818,7 @@
18491819 this.params[ sClipElm.getElementsByTagName('param')[i].getAttribute("name") ] =
18501820 sClipElm.getElementsByTagName('param')[i].firstChild.nodeValue;
18511821 }
1852 - }
 1822+ }
18531823 return this;
18541824 },
18551825 //returns the values of supported_attributes:
@@ -2064,8 +2034,9 @@
20652035 //http://www.w3.org/TR/SMIL3/smil-timing.html#edef-seq
20662036 // but we don't really support anywhere near the full concept of seq containers yet either
20672037 supported_attributes: new Array(
2068 - 'title',
2069 - 'desc:'
 2038+ 'title',
 2039+ 'desc',
 2040+ 'inx'
20702041 ),
20712042 disp_mode:'timeline_thumb',
20722043 init : function(iObj){
@@ -2121,7 +2092,7 @@
21222093
21232094 /* utility functions
21242095 * (could be combined with other stuff)
2125 - */
 2096+*/
21262097
21272098 function getAbsolutePos(objectId) {
21282099 // Get an object left position from the upper left viewport corner
Index: branches/new-upload/phase3/js2/mwEmbed/libSequencer/mvSequencer.js
@@ -61,7 +61,6 @@
6262 "mv_other_options" : "Other Options",
6363 "mv_contextmenu_opt" : "Enable Context Menus"
6464 });
65 -
6665 //used to set default values and validate the passed init object
6766 var sequencerDefaultValues = {
6867
@@ -81,7 +80,7 @@
8281
8382 sequence_tools_id:'mv_sequence_tools',
8483 timeline_id:'mv_timeline',
85 - plObj_id:'seq_plobj',
 84+ plObj_id:'seq_pl',
8685 plObj:'null',
8786
8887 timeline_scale:.06, //in pixel to second ratio ie 100pixles for every ~30seconds
@@ -221,9 +220,9 @@
222221
223222 //add the container divs (with basic layout ~universal~
224223 $j(this.target_sequence_container).html(''+
225 - '<div id="'+this.video_container_id+'" style="position:absolute;right:0px;top:0px;' +
226 - 'width:'+this.video_width+'px;height:'+this.video_height+'px;border:solid thin blue;background:#FFF;font-color:black;"/>'+
227 - '<div id="'+this.timeline_id+'" class="ui-widget ui-widget-content ui-corner-all" style="position:absolute;' +
 224+ '<div id="' + this.video_container_id + '" style="position:absolute;right:0px;top:0px;' +
 225+ 'width:' + this.video_width + 'px;height:'+this.video_height+'px;border:solid thin blue;background:#FFF;font-color:black;"/>'+
 226+ '<div id="' + this.timeline_id + '" class="ui-widget ui-widget-content ui-corner-all" style="position:absolute;' +
228227 'left:0px;right:0px;top:'+(this.video_height+34)+'px;bottom:35px;overflow:auto;">'+
229228 gM('loading_timeline')+ '</div>'+
230229 '<div class="seq_status" style="position:absolute;left:0px;width:300px;"></div>'+
@@ -632,16 +631,16 @@
633632 _this.key_shift_down = true;
634633
635634 if( e.which == 17)
636 - this_seq.key_ctrl_down = true;
 635+ _this.key_ctrl_down = true;
637636
638 - if( (e.which == 67 && this_seq.key_ctrl_down) && !_this.inputFocus)
 637+ if( (e.which == 67 && _this.key_ctrl_down) && !_this.inputFocus)
639638 _this.copySelectedClips();
640639
641 - if( (e.which == 88 && this_seq.key_ctrl_down) && !_this.inputFocus)
 640+ if( (e.which == 88 && _this.key_ctrl_down) && !_this.inputFocus)
642641 _this.cutSelectedClips();
643642
644643 //paste cips on v + ctrl while not focused on a text area:
645 - if( (e.which == 86 && this_seq.key_ctrl_down) && !_this.inputFocus)
 644+ if( (e.which == 86 && _this.key_ctrl_down) && !_this.inputFocus)
646645 _this.pasteClipBoardClips();
647646
648647 });
@@ -655,22 +654,22 @@
656655 _this.key_ctrl_down = false;
657656
658657 //backspace or delete key while not focused on a text area:
659 - if( (e.which == 8 || e.which == 46) && !this_seq.inputFocus)
 658+ if( (e.which == 8 || e.which == 46) && !_this.inputFocus)
660659 _this.removeSelectedClips();
661660 });
662661 },
663662 //check all nodes for focus
664663 //@@todo it would probably be faster to search a given subnode instead of all text
665664 doFocusBindings:function(){
666 - var this_seq = this;
 665+ var _this = this;
667666 //if an input or text area has focus disable delete key binding
668667 $j("input,textarea").focus(function () {
669668 js_log("inputFocus:true");
670 - this_seq.inputFocus = true;
 669+ _this.inputFocus = true;
671670 });
672671 $j("input,textarea").blur( function () {
673672 js_log("inputFocus:blur");
674 - this_seq.inputFocus = false;
 673+ _this.inputFocus = false;
675674 })
676675 },
677676 update_tl_hook:function(jh_time_ms){
@@ -711,19 +710,21 @@
712711 }
713712 o+=">\n";
714713 for( var k in curTrack.clips ){
715 - var curClip = curTrack.clips[k];
 714+ var curClip = curTrack.clips[k];
716715 o+="\t\t<ref ";
717716 var cAttr = curClip.getAttributeObj();
 717+ var lt = '';
718718 for(var j in cAttr){
719719 var val = (j=='transIn' || j=='transOut') ? cAttr[j].id : cAttr[j];
720 - o+=j+'="' + val + '"\n\t\t';
 720+ o+=lt + j+'="' + val + '"';
 721+ lt ="\n\t\t\t";
721722 }
722723 o+=">\n" //close the clip
723724 for(var pName in curClip.params){
724725 var pVal = curClip.params[pName];
725726 o+="\t\t\t" + '<param name="'+ pName + '">' + pVal + '</param>' + "\n";
726727 }
727 - o+="\t\t</ref>\n";
 728+ o+="\t\t</ref>\n\n";
728729 }
729730 o+="\n</seq>\n";
730731 }
@@ -794,7 +795,7 @@
795796 pasteClipBoardClips:function(){
796797 js_log('f:pasteClipBoardClips');
797798 //@@todo query the server for updated clipboard
798 - //paste before the "current clip"
 799+ //paste before the "current clip"
799800 this.addClips( this.clipboard, this.plObj.cur_clip.order );
800801 },
801802 copySelectedClips:function(){
@@ -847,21 +848,27 @@
848849 //doEdit selected clips (updated selected resource)
849850 this.doEditSelectedClip();
850851 },
 852+ addClip:function( clip, before_clip_pos, track_inx){
 853+ this.addClips([clip], before_clip_pos, track_inx)
 854+ },
851855 //add a single or set of clips
852856 //to a given position and track_inx
853857 addClips:function( clipSet, before_clip_pos, track_inx){
854858 this_seq = this;
 859+
855860 if(!track_inx)
856 - track_inx = this.plObj.default_track
 861+ track_inx = this.plObj.default_track.inx;
 862+
857863 if(!before_clip_pos)
858 - before_clip_pos=
 864+ before_clip_pos= this.plObj.default_track.getClipCount();
 865+
859866 js_log("seq: add clip: at: "+ before_clip_pos + ' in track: ' + track_inx);
860 - var cur_pos = before_clip_pos;
861 - js_log('paste clip before_clip_pos: ' + before_clip_pos);
862 - var smilXML =
 867+ var cur_pos = before_clip_pos;
 868+
863869 $j.each(clipSet, function(inx, clipInitDom){
864870 var mediaElement = document.createElement('ref');
865871 for(var i in clipInitDom){
 872+ js_log("set: " + i + ' to ' + clipInitDom[i]);
866873 if(i!='id')
867874 $j(mediaElement).attr(i, clipInitDom[i]);
868875 }
@@ -1511,6 +1518,7 @@
15121519 },
15131520 //override renderDisplay
15141521 renderDisplay:function(){
 1522+ js_log('mvSequence:renderDisplay');
15151523 //setup layout for title and dc_ clip container
15161524 $j(this).html('<div id="dc_'+this.id+'" style="width:'+this.width+'px;' +
15171525 'height:'+(this.height)+'px;position:relative;" />');
Index: branches/new-upload/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js
@@ -11,6 +11,7 @@
1212 "mv_apply_crop":"Apply Crop to Image",
1313 "mv_reset_crop":"Rest Crop",
1414 "mv_insert_image_page":"Insert Into page",
 15+ "mv_insert_into_sequence": "Insert Into Sequence",
1516 "mv_preview_insert":"Preview Insert",
1617 "mv_cancel_image_insert": "Cancel Insert",
1718
@@ -230,11 +231,15 @@
231232 return doEditHtml();
232233 for(var i in data.query.pages){
233234 var page = data.query.pages[i];
234 - var template_rev = page['revisions'][0]['*'];
 235+ if(!page['revisions'] || !page['revisions'][0]['*']){
 236+ return doEditHtml();
 237+ }else{
 238+ var template_rev = page['revisions'][0]['*'];
 239+ }
235240 }
236241
237242 //do a regular ex to get the ~likely~ template values
238 - //(ofcourse this sucks)
 243+ //(of course this sucks)
239244 //but maybe this will make its way into the api sometime soon to support wysiwyg type editors
240245 //idealy it would expose a good deal of info about the template params
241246 js_log('matching against: ' + template_rev);
@@ -446,12 +451,17 @@
447452 for(var cbType in _this.controlActionsCb){
448453 switch(cbType){
449454 case 'insert_seq':
450 - $j(b_target).append( $j.btnHtml(gM('mv_insert_image_page'), 'mv_insert_image_page', 'check' ) + ' ' )
 455+ $j(b_target).append( $j.btnHtml(gM('mv_insert_into_sequence'), 'mv_insert_sequence', 'check' ) + ' ' )
 456+ .children('.mv_insert_sequence').btnBind()
 457+ .click(function(){
 458+ _this.applyEdit();
 459+ _this.controlActionsCb['insert_seq']( _this.rObj );
 460+ });
451461 break;
452462 case 'insert':
453463 $j(b_target).append( $j.btnHtml(gM('mv_insert_image_page'), 'mv_insert_image_page', 'check' ) + ' ' )
454464 .children('.mv_insert_image_page').btnBind()
455 - .click(function(){
 465+ .click(function(){
456466 _this.applyEdit();
457467 _this.controlActionsCb['insert']( _this.rObj );
458468 }).show('slow');
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/javaEmbed.js
@@ -89,8 +89,6 @@
9090 //java reads ogg media time.. so no need to add the start or seek offset:
9191 //js_log(' ct: ' + this.jce.getPlayPosition() + ' ' + this.supportsURLTimeEncoding());
9292 this.currentTime = this.jce.getPlayPosition();
93 -
94 -
9593 if( this.jce.getPlayPosition() < 0){
9694 js_log('pp:'+this.jce.getPlayPosition());
9795 //probably reached clip end
@@ -108,21 +106,43 @@
109107 */
110108 doSeek:function(perc){
111109 js_log('java:seek:p: ' + perc+ ' : ' + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec );
112 -
 110+ this.getJCE();
 111+
113112 if( this.supportsURLTimeEncoding() ){
114113 this.parent_doSeek(perc);
115114 //this.seek_time_sec = npt2seconds( this.start_ntp ) + parseFloat( perc * this.getDuration() );
116115 // this.jce.setParam('url', this.getURI( this.seek_time_sec ))
117116 //this.jce.restart();
 117+ }else if(this.jce){
 118+ //do a (genneraly broken) local seek:
 119+ js_log("cortado javascript seems to always fail ... but here we go... doSeek(" + (perc * parseFloat(this.getDuration()) ) );
 120+ this.jce.doSeek( perc * parseFloat(this.getDuration()) );
118121 }else{
119 - this.getJCE();
120 - if(this.jce){
121 - //do a (genneraly broken) local seek:
122 - js_log("cortado javascript seems to always fail ... but here we go... doSeek(" + perc * this.getDuration() );
123 - this.jce.doSeek( perc * this.getDuration() );
124 - }
 122+ this.doPlayThenSeek(perc);
125123 }
126124 },
 125+ doPlayThenSeek:function(perc){
 126+ js_log('doPlayThenSeek Hack');
 127+ var _this = this;
 128+ this.play();
 129+ var rfsCount = 0;
 130+ var readyForSeek = function(){
 131+ _this.getJCE();
 132+ //if we have .jre ~in theory~ we can seek (but probably not)
 133+ if(_this.jce){
 134+ _this.doSeek(perc);
 135+ }else{
 136+ //try to get player for 10 seconds:
 137+ if( rfsCount < 200 ){
 138+ setTimeout(readyForSeek, 50);
 139+ rfsCount++;
 140+ }else{
 141+ js_log('error:doPlayThenSeek failed');
 142+ }
 143+ }
 144+ }
 145+ readyForSeek();
 146+ },
127147 //get java cortado embed object
128148 getJCE:function(){
129149 if ( embedTypes.mozilla ) {
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/htmlEmbed.js
@@ -4,7 +4,7 @@
55 * (we make assumptions about this.pc (parent clip) being available)
66 */
77 var pcHtmlEmbedDefaults={
8 - 'dur':4 //default duration of 4seconds
 8+ 'dur':4 //default duration of 4 seconds
99 }
1010 var htmlEmbed ={
1111 supports: {
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/vlcEmbed.js
@@ -93,9 +93,34 @@
9494 this.vlc.input.position = perc;
9595 this.setStatus( 'seeking...' );
9696 }
 97+ }else{
 98+ this.doPlayThenSeek(perc);
9799 }
98100 this.parent_monitor();
99101 },
 102+ doPlayThenSeek:function(perc){
 103+ js_log('doPlayThenSeekHack');
 104+ var _this = this;
 105+ this.play();
 106+ var rfsCount = 0;
 107+ var readyForSeek = function(){
 108+ _this.getVLC();
 109+ var newState = _this.vlc.input.state;
 110+ //if playing we are ready to do the
 111+ if(newState==3){
 112+ _this.doSeek(perc);
 113+ }else{
 114+ //try to get player for 10 seconds:
 115+ if( rfsCount < 200 ){
 116+ setTimeout(readyForSeek, 50);
 117+ rfsCount++;
 118+ }else{
 119+ js_log('error:doPlayThenSeek failed');
 120+ }
 121+ }
 122+ }
 123+ readyForSeek();
 124+ },
100125 playMovieAt: function (order){
101126 //@@todo add clips to playlist after (order) and then play
102127 this.play();
@@ -186,7 +211,7 @@
187212 //for now trust the duration from url over vlc input.length
188213 if( !this.getDuration() && this.vlc.input.length > 0 )
189214 {
190 - js_log('setting duration to ' + this.vlc.input.length /1000);
 215+ //js_log('setting duration to ' + this.vlc.input.length /1000);
191216 this.duration = this.vlc.input.length /1000;
192217 }
193218 this.currentTime = this.vlc.input.time/1000;
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js
@@ -374,9 +374,8 @@
375375 npt2seconds(embedObj.getTimeReq().split('/')[0]);
376376 },
377377 slide: function(event, ui) {
378 - var perc = ui.value/1000;
379 -
380 - embedObj.jump_time = seconds2npt( parseInt( embedObj.getDuration() * perc ) + embedObj.start_time_sec);
 378+ var perc = ui.value/1000;
 379+ embedObj.jump_time = seconds2npt( parseFloat( parseFloat(embedObj.getDuration()) * perc ) + embedObj.start_time_sec);
381380 //js_log('perc:' + perc + ' * ' + embedObj.getDuration() + ' jt:'+ this.jump_time);
382381 embedObj.setStatus( gM('seek_to')+' '+embedObj.jump_time );
383382 //update the thumbnail / frame
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/nativeEmbed.js
@@ -78,15 +78,39 @@
7979 }else{
8080 this.parent_doSeek(perc);
8181 }
82 - }else if(this.vid.duration ){
 82+ }else if(this.vid && this.vid.duration ){
8383 this.doNativeSeek(perc);
 84+ }else{
 85+ this.doPlayThenSeek(perc)
8486 }
85 - },
 87+ },
8688 doNativeSeek:function(perc){
8789 this.seek_time_sec=0;
8890 this.vid.currentTime = perc * this.vid.duration;
8991 this.parent_monitor();
9092 },
 93+ doPlayThenSeek:function(perc){
 94+ js_log('doPlayThenSeek Hack');
 95+ var _this = this;
 96+ this.play();
 97+ var rfsCount = 0;
 98+ var readyForSeek = function(){
 99+ _this.getVID();
 100+ //if we have duration then we are ready to do the seek
 101+ if(this.vid && this.vid.duration){
 102+ _this.doSeek(perc);
 103+ }else{
 104+ //try to get player for 10 seconds:
 105+ if( rfsCount < 200 ){
 106+ setTimeout(readyForSeek, 50);
 107+ rfsCount++;
 108+ }else{
 109+ js_log('error:doPlayThenSeek failed');
 110+ }
 111+ }
 112+ }
 113+ readyForSeek();
 114+ },
91115 setCurrentTime: function(pos, callback){
92116 var _this = this;
93117 this.getVID();

Status & tagging log