Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/searchLibs/baseRemoteSearch.js |
— | — | @@ -188,7 +188,11 @@ |
189 | 189 | getEmbedWikiCode:function(rObj){ |
190 | 190 | var layout = ( rObj.layout)? rObj.layout:"right" |
191 | 191 | 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 | + |
193 | 197 | if(rObj.target_width) |
194 | 198 | o+='|' + rObj.target_width + 'px'; |
195 | 199 | |
— | — | @@ -198,6 +202,10 @@ |
199 | 203 | o+=']]'; |
200 | 204 | return o; |
201 | 205 | }, |
| 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 | + }, |
202 | 210 | updateDataForImport:function( rObj ){ |
203 | 211 | return rObj; |
204 | 212 | } |
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/searchLibs/archiveOrgSearch.js |
— | — | @@ -60,7 +60,9 @@ |
61 | 61 | for(var resource_id in data.response.docs){ |
62 | 62 | var resource = data.response.docs[resource_id]; |
63 | 63 | 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, |
65 | 67 | 'link' : _this.dtUrl + resource.identifier, |
66 | 68 | 'title' : resource.title, |
67 | 69 | 'poster' : _this.dnUrl + resource.identifier+'/format=thumbnail', |
— | — | @@ -72,7 +74,8 @@ |
73 | 75 | 'mime' : 'application/ogg', |
74 | 76 | //set the licence: (rsd is a pointer to the parent remoteSearchDriver ) |
75 | 77 | 'license' : this.rsd.getLicenceFromUrl( resource.licenseurl ), |
76 | | - 'pSobj' :_this |
| 78 | + 'pSobj' :_this |
| 79 | + |
77 | 80 | }; |
78 | 81 | this.resultsObj[ resource_id ] = rObj; |
79 | 82 | |
— | — | @@ -90,7 +93,7 @@ |
91 | 94 | var _this = this; |
92 | 95 | do_api_req( { |
93 | 96 | 'data':{'avinfo':1}, |
94 | | - 'url':_this.dnUrl + rObj.titleKey + '/format=Ogg+video' |
| 97 | + 'url':_this.dnUrl + rObj.resourceKey + '/format=Ogg+video' |
95 | 98 | },function(data){ |
96 | 99 | var cat = data; |
97 | 100 | if(data['length']) |
— | — | @@ -99,6 +102,7 @@ |
100 | 103 | rObj.width = data['width']; |
101 | 104 | if(data['height']) |
102 | 105 | rObj.height = data['height']; |
| 106 | + |
103 | 107 | callback(); |
104 | 108 | }); |
105 | 109 | }, |
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/searchLibs/metavidSearch.js |
— | — | @@ -55,7 +55,7 @@ |
56 | 56 | rObj['start_time'] = proe.queryKey['t'].split('/')[0]; |
57 | 57 | rObj['end_time'] = proe.queryKey['t'].split('/')[1]; |
58 | 58 | rObj['stream_name'] = proe.queryKey['stream_name']; |
59 | | - |
| 59 | + |
60 | 60 | //all metavid content is public domain: |
61 | 61 | rObj['license'] = _this.rsd.getLicenceFromKey( 'pd' ); |
62 | 62 | |
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/seqRemoteSearchDriver.js |
— | — | @@ -29,28 +29,36 @@ |
30 | 30 | this[i] = tmpRSD[i]; |
31 | 31 | } |
32 | 32 | } |
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 | + } |
42 | 44 | } |
43 | | - } |
| 45 | + }*/ |
44 | 46 | }, |
45 | 47 | resourceEdit:function(){ |
46 | 48 | var _this = this; |
47 | 49 | |
48 | | - }, |
| 50 | + }, |
49 | 51 | addResultBindings:function(){ |
50 | 52 | //set up seq: |
51 | 53 | var _this = this; |
52 | 54 | //setup parent bindings: |
53 | 55 | this.parent_addResultBindings(); |
54 | 56 | |
| 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 | + |
55 | 63 | //add an additional drag binding |
56 | 64 | $j( '.rsd_res_item' ).draggable('destroy').draggable({ |
57 | 65 | helper:function(){ |
— | — | @@ -82,7 +90,40 @@ |
83 | 91 | |
84 | 92 | }, |
85 | 93 | 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 | + }); |
87 | 128 | }, |
88 | 129 | getClipEditControlActions:function(){ |
89 | 130 | var _this = this; |
— | — | @@ -105,7 +146,7 @@ |
106 | 147 | |
107 | 148 | $j('#seq_resource_import').dialog('destroy').dialog({ |
108 | 149 | bgiframe: true, |
109 | | - width:640, |
| 150 | + width:700, |
110 | 151 | height:480, |
111 | 152 | modal: true, |
112 | 153 | buttons: { |
— | — | @@ -118,6 +159,13 @@ |
119 | 160 | //do parent resource edit (with updated target) |
120 | 161 | this.parent_resourceEdit(rObj, rsdElement); |
121 | 162 | }, |
| 163 | + getEditToken:function(callback){ |
| 164 | + if(this.pSeq.sequenceEditToken){ |
| 165 | + callback( this.pSeq.sequenceEditToken ) |
| 166 | + }else{ |
| 167 | + this.parent_getEditToken(callback); |
| 168 | + } |
| 169 | + }, |
122 | 170 | cancelClipEditCB:function(){ |
123 | 171 | js_log('seqRSD:cancelClipEditCB'); |
124 | 172 | $j('#seq_resource_import').dialog('close').dialog('destroy').remove(); |
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvFirefogg.js |
— | — | @@ -430,9 +430,11 @@ |
431 | 431 | 'enablechunks': true |
432 | 432 | }; |
433 | 433 | //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; |
437 | 439 | |
438 | 440 | if( _this.formData['wpWatchthis'] ) |
439 | 441 | aReq['watch'] = _this.formData['wpWatchthis']; |
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/remoteSearchDriver.js |
— | — | @@ -91,7 +91,7 @@ |
92 | 92 | * sets the default display item: |
93 | 93 | * can be any content_providers key or 'all' |
94 | 94 | */ |
95 | | - disp_item : 'metavid', |
| 95 | + disp_item : 'archive_org', |
96 | 96 | /** the default content providers list. |
97 | 97 | * |
98 | 98 | * (should be note that special tabs like "upload" and "combined" don't go into the content proviers list: |
— | — | @@ -714,13 +714,13 @@ |
715 | 715 | cp.offset = (cp.offset) ? cp.offset : cp.sObj.offset; |
716 | 716 | |
717 | 717 | //do search |
718 | | - cp.sObj.getSearchResults(); |
719 | | - js_log('rand getSearchResults on cp disp is: '+ _this.disp_item); |
| 718 | + cp.sObj.getSearchResults(); |
720 | 719 | _this.checkResultsDone(); |
721 | 720 | }); |
722 | 721 | }, |
723 | 722 | /* check for all the results to finish */ |
724 | 723 | checkResultsDone: function(){ |
| 724 | + //js_log('rsd:checkResultsDone'); |
725 | 725 | var _this = this; |
726 | 726 | var loading_done = true; |
727 | 727 | |
— | — | @@ -736,7 +736,7 @@ |
737 | 737 | }else{ |
738 | 738 | //make sure the instance name is up-to-date refrence to _this; |
739 | 739 | eval( _this.instance_name + ' = _this'); |
740 | | - setTimeout( _this.instance_name + '.checkResultsDone()', 30); |
| 740 | + setTimeout( _this.instance_name + '.checkResultsDone()', 50); |
741 | 741 | } |
742 | 742 | }, |
743 | 743 | drawTabs: function(){ |
— | — | @@ -1064,7 +1064,7 @@ |
1065 | 1065 | var _this = this; |
1066 | 1066 | return { |
1067 | 1067 | 'insert' :function(rObj){ |
1068 | | - _this.insertResource(); |
| 1068 | + _this.insertResource(rObj); |
1069 | 1069 | }, |
1070 | 1070 | 'preview':function(rObj){ |
1071 | 1071 | _this.previewResource( rObj ) |
— | — | @@ -1147,8 +1147,7 @@ |
1148 | 1148 | checkImportResource:function( rObj, cir_callback){ |
1149 | 1149 | //@@todo get the localized File/Image namespace name or do a general {NS}:Title |
1150 | 1150 | var cp = rObj.pSobj.cp; |
1151 | | - var _this = this; |
1152 | | - rObj.target_resource_title = rObj.titleKey.replace(/File:|Image:/,''); |
| 1151 | + var _this = this; |
1153 | 1152 | |
1154 | 1153 | //check if local repository |
1155 | 1154 | //or if import mode if just "linking" |
— | — | @@ -1156,11 +1155,15 @@ |
1157 | 1156 | //local repo jump directly to check Import Resource callback: |
1158 | 1157 | cir_callback( rObj ); |
1159 | 1158 | }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:/,''); |
1161 | 1161 | rObj.target_resource_title = cp.resource_prefix +rObj.target_resource_title; |
1162 | 1162 | |
1163 | 1163 | //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 | + }; |
1165 | 1168 | |
1166 | 1169 | do_api_req( { |
1167 | 1170 | 'data':reqObj, |
— | — | @@ -1283,6 +1286,7 @@ |
1284 | 1287 | 'mvBaseUploadInterface', |
1285 | 1288 | '$j.ui.progressbar' |
1286 | 1289 | ],function(){ |
| 1290 | + |
1287 | 1291 | //initicate a download similar to url copy: |
1288 | 1292 | myUp = new mvBaseUploadInterface({ |
1289 | 1293 | 'api_url' : _this.local_wiki_api_url, |
— | — | @@ -1295,13 +1299,32 @@ |
1296 | 1300 | cir_callback(); |
1297 | 1301 | } |
1298 | 1302 | }); |
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 | + |
1304 | 1314 | }); |
1305 | 1315 | }, |
| 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 | + }, |
1306 | 1329 | /** |
1307 | 1330 | * doImportSpecialPage |
1308 | 1331 | * can be depricated once we support upload api support is widespred. |
— | — | @@ -1490,6 +1513,7 @@ |
1491 | 1514 | $j('#rsd_resource_preview').remove(); |
1492 | 1515 | $j('#rsd_resource_edit').remove(); |
1493 | 1516 | $j(this.target_container).dialog('close'); |
| 1517 | + $j(this.target_container).remove(); |
1494 | 1518 | }, |
1495 | 1519 | setResultBarControl:function( ){ |
1496 | 1520 | var _this = this; |
Index: branches/new-upload/phase3/js2/mwEmbed/libAddMedia/mvBaseUploadInterface.js |
— | — | @@ -177,7 +177,15 @@ |
178 | 178 | }else if( _this.upload_mode == 'api' && $j('#wpSourceTypeURL').get(0).checked){ |
179 | 179 | js_log('doHttpUpload (no form submit) '); |
180 | 180 | //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 ); |
182 | 190 | }else{ |
183 | 191 | js_error( 'Error: unrecongized upload mode: ' + _this.upload_mode ); |
184 | 192 | } |
— | — | @@ -189,27 +197,30 @@ |
190 | 198 | $j('#dlbox-centered').html( '<h5>' + _this.getProgressTitle() + '</h5>' + |
191 | 199 | mv_get_loading_img( 'left:40%;top:20%') |
192 | 200 | ); |
| 201 | + //setup request: |
193 | 202 | 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 | + } |
204 | 210 | |
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; |
207 | 217 | } |
| 218 | + //do the api req |
208 | 219 | do_api_req({ |
209 | 220 | 'data': req, |
210 | 221 | 'url' : _this.api_url |
211 | 222 | }, function( data ){ |
212 | 223 | _this.processApiResult( data ); |
213 | | - }); |
| 224 | + }); |
214 | 225 | }, |
215 | 226 | doAjaxWarningIgnore:function(){ |
216 | 227 | var _this = this; |
— | — | @@ -345,10 +356,12 @@ |
346 | 357 | bObj[ gM('return-to-form') ] = function(){ |
347 | 358 | $j(this).dialog('close'); |
348 | 359 | }; |
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 ; |
350 | 362 | }else{ |
351 | 363 | if( apiRes.error.info ){ |
352 | 364 | _this.updateProgressWin( gM('uploaderror'), apiRes.error.info ,bObj); |
| 365 | + return ; |
353 | 366 | }else{ |
354 | 367 | gMsgLoadRemote(error_code, function(){ |
355 | 368 | js_log('send msg: ' + gM( error_code )); |
Index: branches/new-upload/phase3/js2/mwEmbed/libSequencer/mvPlayList.js |
— | — | @@ -76,7 +76,7 @@ |
77 | 77 | |
78 | 78 | this.activeClipList = new activeClipList(); |
79 | 79 | //add default track & default track pointer: |
80 | | - this.tracks[0]= new trackObj(); |
| 80 | + this.tracks[0]= new trackObj({'inx':0}); |
81 | 81 | this.default_track = this.tracks[0]; |
82 | 82 | |
83 | 83 | //get all the attributes: |
— | — | @@ -120,31 +120,13 @@ |
121 | 121 | $j('body').append('<div class="ui-widget-overlay" style="width: 100%; height: 100%px; z-index: 10;"></div>'); |
122 | 122 | $j('body').append('<div id="sequencer_target" style="z-index:11;position:fixed;top:10px;left:10px;right:10px;bottom:10px;" ' + |
123 | 123 | '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 | + |
144 | 125 | //@@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; |
149 | 131 | */ |
150 | 132 | //load sequencer: |
151 | 133 | $j("#sequencer_target").sequencer({ |
— | — | @@ -178,8 +160,8 @@ |
179 | 161 | js_log("f:getPlaylist: " + this.srcType ); |
180 | 162 | //@@todo lazy load plLib |
181 | 163 | 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){ |
184 | 166 | //js parent preservation for local overwritten methods |
185 | 167 | if(this[method])this['parent_' + method] = this[method]; |
186 | 168 | this[method]=plObj[method]; |
— | — | @@ -243,6 +225,7 @@ |
244 | 226 | } |
245 | 227 | }, |
246 | 228 | doWhenClipLoadDone:function(){ |
| 229 | + js_log('mvPlaylist:doWhenClipLoadDone'); |
247 | 230 | this.ready_to_play = true; |
248 | 231 | this.loading = false; |
249 | 232 | this.getHTML(); |
— | — | @@ -364,9 +347,9 @@ |
365 | 348 | //takes in the playlist |
366 | 349 | // inherits all the properties |
367 | 350 | // 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){ |
371 | 354 | $j('#'+this.id).html('loading playlist<blink>...</blink>'); |
372 | 355 | if( this.loading_external_data ){ |
373 | 356 | //load the data source chain of functions (to update the innerHTML) |
— | — | @@ -386,7 +369,7 @@ |
387 | 370 | } |
388 | 371 | }, |
389 | 372 | renderDisplay:function(){ |
390 | | - js_log('track length: ' +this.default_track.getClipCount() );'' |
| 373 | + js_log('mvPlaylist:renderDisplay:: track length: ' +this.default_track.getClipCount() );'' |
391 | 374 | |
392 | 375 | var plObj=this; |
393 | 376 | //setup layout for title and dc_ clip container |
— | — | @@ -418,25 +401,32 @@ |
419 | 402 | this.updateBaseStatus(); |
420 | 403 | }, |
421 | 404 | 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>'); |
428 | 412 | //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; |
431 | 415 | clip.embed.play_button=false; |
432 | 416 | |
433 | 417 | 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 ); |
437 | 427 | }else{ |
438 | 428 | js_log('cound not find: clipDesc_'+clip.id); |
439 | 429 | } |
440 | | - }); |
| 430 | + }); |
441 | 431 | if(this.cur_clip) |
442 | 432 | $j('#clipDesc_'+this.cur_clip.id).css( { display:'inline' } ); |
443 | 433 | }, |
— | — | @@ -488,6 +478,7 @@ |
489 | 479 | $j( $j.btnHtml('edit', 'editBtn_'+this.id, 'pencil', |
490 | 480 | {'style':'position:absolute;right:0;;font-size:x-small;height:10px;margin-bottom:0;padding-bottom:7px;padding-top:0;'} ) |
491 | 481 | ).click(function(){ |
| 482 | + _this.stop(); |
492 | 483 | _this.doEditor(); |
493 | 484 | return false; |
494 | 485 | }).appendTo('#ptitle_'+this.id); |
— | — | @@ -923,7 +914,7 @@ |
924 | 915 | }else{ |
925 | 916 | var track = this.tracks[ clipObj.track_id ] |
926 | 917 | } |
927 | | - js_log('add clip' + clipObj.id +' to track: at:' + pos); |
| 918 | + js_log('add clip:' + clipObj.id +' to track: at:' + pos); |
928 | 919 | //set the first clip to current (maybe deprecated ) |
929 | 920 | if(clipObj.order==0){ |
930 | 921 | if(!this.cur_clip)this.cur_clip=clipObj; |
— | — | @@ -1207,8 +1198,7 @@ |
1208 | 1199 | stop:function(){ |
1209 | 1200 | js_log('pl:do stop'); |
1210 | 1201 | //set up convenience pointer to parent playlist |
1211 | | - var plObj = this.pc.pp; |
1212 | | - var plEmbed = this; |
| 1202 | + var plObj = this.pc.pp; |
1213 | 1203 | |
1214 | 1204 | var th=Math.round( plObj.pl_layout.clip_desc * plObj.height ); |
1215 | 1205 | var tw=Math.round( th * plObj.pl_layout.clip_aspect ); |
— | — | @@ -1216,32 +1206,8 @@ |
1217 | 1207 | this.pe_stop(); |
1218 | 1208 | var pl_height = (plObj.sequencer=='true')?plObj.height+27:plObj.height; |
1219 | 1209 | |
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 | + |
1246 | 1212 | }, |
1247 | 1213 | play:function(){ |
1248 | 1214 | //js_log('pl eb play'); |
— | — | @@ -1737,15 +1703,16 @@ |
1738 | 1704 | }, |
1739 | 1705 | tryAddMedia:function(mediaElement, order, track_id){ |
1740 | 1706 | js_log('SMIL:tryAddMedia:' + mediaElement); |
| 1707 | + var _this = this; |
1741 | 1708 | //set up basic mvSMILClip send it the mediaElemnt & mvClip init: |
1742 | 1709 | 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, |
1746 | 1712 | "pp":this, //set the parent playlist object pointer |
1747 | 1713 | "order": order |
1748 | | - } |
1749 | | - ); |
| 1714 | + }; |
| 1715 | + var clipObj = new mvSMILClip(mediaElement, cConfig ); |
| 1716 | + |
1750 | 1717 | //set optional params track |
1751 | 1718 | if( typeof track_id != 'undefined') |
1752 | 1719 | clipObj["track_id"] = track_id; |
— | — | @@ -1753,9 +1720,9 @@ |
1754 | 1721 | //debugger; |
1755 | 1722 | if ( clipObj ){ |
1756 | 1723 | //set up embed: |
1757 | | - clipObj.setUpEmbedObj(); |
| 1724 | + clipObj.setUpEmbedObj(); |
1758 | 1725 | //add clip to track: |
1759 | | - this.addCliptoTrack( clipObj , order); |
| 1726 | + this.addCliptoTrack( clipObj , order); |
1760 | 1727 | return true; |
1761 | 1728 | } |
1762 | 1729 | //@@todo we could throw error details here once we integrate try catches everywhere :P |
— | — | @@ -1764,8 +1731,9 @@ |
1765 | 1732 | } |
1766 | 1733 | //http://www.w3.org/TR/2007/WD-SMIL3-20070713/smil-extended-media-object.html#smilMediaNS-BasicMedia |
1767 | 1734 | //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( |
1770 | 1738 | 'src', |
1771 | 1739 | 'type', |
1772 | 1740 | 'region', |
— | — | @@ -1773,6 +1741,7 @@ |
1774 | 1742 | 'transOut', |
1775 | 1743 | 'fill', |
1776 | 1744 | 'dur', |
| 1745 | + 'title', |
1777 | 1746 | |
1778 | 1747 | 'uri', |
1779 | 1748 | 'poster' |
— | — | @@ -1798,14 +1767,15 @@ |
1799 | 1768 | }else{ |
1800 | 1769 | this[method] = myMvClip[method]; |
1801 | 1770 | } |
1802 | | - } |
| 1771 | + } |
1803 | 1772 | |
1804 | 1773 | //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]; |
1806 | 1776 | if( $j(sClipElm).attr(attr)){ |
1807 | 1777 | _this[attr] = $j(sClipElm).attr(attr); |
1808 | 1778 | } |
1809 | | - }) |
| 1779 | + } |
1810 | 1780 | this['tagName'] = sClipElm.tagName; |
1811 | 1781 | |
1812 | 1782 | if( sClipElm.firstChild ){ |
— | — | @@ -1848,7 +1818,7 @@ |
1849 | 1819 | this.params[ sClipElm.getElementsByTagName('param')[i].getAttribute("name") ] = |
1850 | 1820 | sClipElm.getElementsByTagName('param')[i].firstChild.nodeValue; |
1851 | 1821 | } |
1852 | | - } |
| 1822 | + } |
1853 | 1823 | return this; |
1854 | 1824 | }, |
1855 | 1825 | //returns the values of supported_attributes: |
— | — | @@ -2064,8 +2034,9 @@ |
2065 | 2035 | //http://www.w3.org/TR/SMIL3/smil-timing.html#edef-seq |
2066 | 2036 | // but we don't really support anywhere near the full concept of seq containers yet either |
2067 | 2037 | supported_attributes: new Array( |
2068 | | - 'title', |
2069 | | - 'desc:' |
| 2038 | + 'title', |
| 2039 | + 'desc', |
| 2040 | + 'inx' |
2070 | 2041 | ), |
2071 | 2042 | disp_mode:'timeline_thumb', |
2072 | 2043 | init : function(iObj){ |
— | — | @@ -2121,7 +2092,7 @@ |
2122 | 2093 | |
2123 | 2094 | /* utility functions |
2124 | 2095 | * (could be combined with other stuff) |
2125 | | - */ |
| 2096 | +*/ |
2126 | 2097 | |
2127 | 2098 | function getAbsolutePos(objectId) { |
2128 | 2099 | // 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 @@ |
62 | 62 | "mv_other_options" : "Other Options", |
63 | 63 | "mv_contextmenu_opt" : "Enable Context Menus" |
64 | 64 | }); |
65 | | - |
66 | 65 | //used to set default values and validate the passed init object |
67 | 66 | var sequencerDefaultValues = { |
68 | 67 | |
— | — | @@ -81,7 +80,7 @@ |
82 | 81 | |
83 | 82 | sequence_tools_id:'mv_sequence_tools', |
84 | 83 | timeline_id:'mv_timeline', |
85 | | - plObj_id:'seq_plobj', |
| 84 | + plObj_id:'seq_pl', |
86 | 85 | plObj:'null', |
87 | 86 | |
88 | 87 | timeline_scale:.06, //in pixel to second ratio ie 100pixles for every ~30seconds |
— | — | @@ -221,9 +220,9 @@ |
222 | 221 | |
223 | 222 | //add the container divs (with basic layout ~universal~ |
224 | 223 | $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;' + |
228 | 227 | 'left:0px;right:0px;top:'+(this.video_height+34)+'px;bottom:35px;overflow:auto;">'+ |
229 | 228 | gM('loading_timeline')+ '</div>'+ |
230 | 229 | '<div class="seq_status" style="position:absolute;left:0px;width:300px;"></div>'+ |
— | — | @@ -632,16 +631,16 @@ |
633 | 632 | _this.key_shift_down = true; |
634 | 633 | |
635 | 634 | if( e.which == 17) |
636 | | - this_seq.key_ctrl_down = true; |
| 635 | + _this.key_ctrl_down = true; |
637 | 636 | |
638 | | - if( (e.which == 67 && this_seq.key_ctrl_down) && !_this.inputFocus) |
| 637 | + if( (e.which == 67 && _this.key_ctrl_down) && !_this.inputFocus) |
639 | 638 | _this.copySelectedClips(); |
640 | 639 | |
641 | | - if( (e.which == 88 && this_seq.key_ctrl_down) && !_this.inputFocus) |
| 640 | + if( (e.which == 88 && _this.key_ctrl_down) && !_this.inputFocus) |
642 | 641 | _this.cutSelectedClips(); |
643 | 642 | |
644 | 643 | //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) |
646 | 645 | _this.pasteClipBoardClips(); |
647 | 646 | |
648 | 647 | }); |
— | — | @@ -655,22 +654,22 @@ |
656 | 655 | _this.key_ctrl_down = false; |
657 | 656 | |
658 | 657 | //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) |
660 | 659 | _this.removeSelectedClips(); |
661 | 660 | }); |
662 | 661 | }, |
663 | 662 | //check all nodes for focus |
664 | 663 | //@@todo it would probably be faster to search a given subnode instead of all text |
665 | 664 | doFocusBindings:function(){ |
666 | | - var this_seq = this; |
| 665 | + var _this = this; |
667 | 666 | //if an input or text area has focus disable delete key binding |
668 | 667 | $j("input,textarea").focus(function () { |
669 | 668 | js_log("inputFocus:true"); |
670 | | - this_seq.inputFocus = true; |
| 669 | + _this.inputFocus = true; |
671 | 670 | }); |
672 | 671 | $j("input,textarea").blur( function () { |
673 | 672 | js_log("inputFocus:blur"); |
674 | | - this_seq.inputFocus = false; |
| 673 | + _this.inputFocus = false; |
675 | 674 | }) |
676 | 675 | }, |
677 | 676 | update_tl_hook:function(jh_time_ms){ |
— | — | @@ -711,19 +710,21 @@ |
712 | 711 | } |
713 | 712 | o+=">\n"; |
714 | 713 | for( var k in curTrack.clips ){ |
715 | | - var curClip = curTrack.clips[k]; |
| 714 | + var curClip = curTrack.clips[k]; |
716 | 715 | o+="\t\t<ref "; |
717 | 716 | var cAttr = curClip.getAttributeObj(); |
| 717 | + var lt = ''; |
718 | 718 | for(var j in cAttr){ |
719 | 719 | 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"; |
721 | 722 | } |
722 | 723 | o+=">\n" //close the clip |
723 | 724 | for(var pName in curClip.params){ |
724 | 725 | var pVal = curClip.params[pName]; |
725 | 726 | o+="\t\t\t" + '<param name="'+ pName + '">' + pVal + '</param>' + "\n"; |
726 | 727 | } |
727 | | - o+="\t\t</ref>\n"; |
| 728 | + o+="\t\t</ref>\n\n"; |
728 | 729 | } |
729 | 730 | o+="\n</seq>\n"; |
730 | 731 | } |
— | — | @@ -794,7 +795,7 @@ |
795 | 796 | pasteClipBoardClips:function(){ |
796 | 797 | js_log('f:pasteClipBoardClips'); |
797 | 798 | //@@todo query the server for updated clipboard |
798 | | - //paste before the "current clip" |
| 799 | + //paste before the "current clip" |
799 | 800 | this.addClips( this.clipboard, this.plObj.cur_clip.order ); |
800 | 801 | }, |
801 | 802 | copySelectedClips:function(){ |
— | — | @@ -847,21 +848,27 @@ |
848 | 849 | //doEdit selected clips (updated selected resource) |
849 | 850 | this.doEditSelectedClip(); |
850 | 851 | }, |
| 852 | + addClip:function( clip, before_clip_pos, track_inx){ |
| 853 | + this.addClips([clip], before_clip_pos, track_inx) |
| 854 | + }, |
851 | 855 | //add a single or set of clips |
852 | 856 | //to a given position and track_inx |
853 | 857 | addClips:function( clipSet, before_clip_pos, track_inx){ |
854 | 858 | this_seq = this; |
| 859 | + |
855 | 860 | if(!track_inx) |
856 | | - track_inx = this.plObj.default_track |
| 861 | + track_inx = this.plObj.default_track.inx; |
| 862 | + |
857 | 863 | if(!before_clip_pos) |
858 | | - before_clip_pos= |
| 864 | + before_clip_pos= this.plObj.default_track.getClipCount(); |
| 865 | + |
859 | 866 | 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 | + |
863 | 869 | $j.each(clipSet, function(inx, clipInitDom){ |
864 | 870 | var mediaElement = document.createElement('ref'); |
865 | 871 | for(var i in clipInitDom){ |
| 872 | + js_log("set: " + i + ' to ' + clipInitDom[i]); |
866 | 873 | if(i!='id') |
867 | 874 | $j(mediaElement).attr(i, clipInitDom[i]); |
868 | 875 | } |
— | — | @@ -1511,6 +1518,7 @@ |
1512 | 1519 | }, |
1513 | 1520 | //override renderDisplay |
1514 | 1521 | renderDisplay:function(){ |
| 1522 | + js_log('mvSequence:renderDisplay'); |
1515 | 1523 | //setup layout for title and dc_ clip container |
1516 | 1524 | $j(this).html('<div id="dc_'+this.id+'" style="width:'+this.width+'px;' + |
1517 | 1525 | 'height:'+(this.height)+'px;position:relative;" />'); |
Index: branches/new-upload/phase3/js2/mwEmbed/libClipEdit/mvClipEdit.js |
— | — | @@ -11,6 +11,7 @@ |
12 | 12 | "mv_apply_crop":"Apply Crop to Image", |
13 | 13 | "mv_reset_crop":"Rest Crop", |
14 | 14 | "mv_insert_image_page":"Insert Into page", |
| 15 | + "mv_insert_into_sequence": "Insert Into Sequence", |
15 | 16 | "mv_preview_insert":"Preview Insert", |
16 | 17 | "mv_cancel_image_insert": "Cancel Insert", |
17 | 18 | |
— | — | @@ -230,11 +231,15 @@ |
231 | 232 | return doEditHtml(); |
232 | 233 | for(var i in data.query.pages){ |
233 | 234 | 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 | + } |
235 | 240 | } |
236 | 241 | |
237 | 242 | //do a regular ex to get the ~likely~ template values |
238 | | - //(ofcourse this sucks) |
| 243 | + //(of course this sucks) |
239 | 244 | //but maybe this will make its way into the api sometime soon to support wysiwyg type editors |
240 | 245 | //idealy it would expose a good deal of info about the template params |
241 | 246 | js_log('matching against: ' + template_rev); |
— | — | @@ -446,12 +451,17 @@ |
447 | 452 | for(var cbType in _this.controlActionsCb){ |
448 | 453 | switch(cbType){ |
449 | 454 | 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 | + }); |
451 | 461 | break; |
452 | 462 | case 'insert': |
453 | 463 | $j(b_target).append( $j.btnHtml(gM('mv_insert_image_page'), 'mv_insert_image_page', 'check' ) + ' ' ) |
454 | 464 | .children('.mv_insert_image_page').btnBind() |
455 | | - .click(function(){ |
| 465 | + .click(function(){ |
456 | 466 | _this.applyEdit(); |
457 | 467 | _this.controlActionsCb['insert']( _this.rObj ); |
458 | 468 | }).show('slow'); |
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/javaEmbed.js |
— | — | @@ -89,8 +89,6 @@ |
90 | 90 | //java reads ogg media time.. so no need to add the start or seek offset: |
91 | 91 | //js_log(' ct: ' + this.jce.getPlayPosition() + ' ' + this.supportsURLTimeEncoding()); |
92 | 92 | this.currentTime = this.jce.getPlayPosition(); |
93 | | - |
94 | | - |
95 | 93 | if( this.jce.getPlayPosition() < 0){ |
96 | 94 | js_log('pp:'+this.jce.getPlayPosition()); |
97 | 95 | //probably reached clip end |
— | — | @@ -108,21 +106,43 @@ |
109 | 107 | */ |
110 | 108 | doSeek:function(perc){ |
111 | 109 | js_log('java:seek:p: ' + perc+ ' : ' + this.supportsURLTimeEncoding() + ' dur: ' + this.getDuration() + ' sts:' + this.seek_time_sec ); |
112 | | - |
| 110 | + this.getJCE(); |
| 111 | + |
113 | 112 | if( this.supportsURLTimeEncoding() ){ |
114 | 113 | this.parent_doSeek(perc); |
115 | 114 | //this.seek_time_sec = npt2seconds( this.start_ntp ) + parseFloat( perc * this.getDuration() ); |
116 | 115 | // this.jce.setParam('url', this.getURI( this.seek_time_sec )) |
117 | 116 | //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()) ); |
118 | 121 | }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); |
125 | 123 | } |
126 | 124 | }, |
| 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 | + }, |
127 | 147 | //get java cortado embed object |
128 | 148 | getJCE:function(){ |
129 | 149 | if ( embedTypes.mozilla ) { |
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/htmlEmbed.js |
— | — | @@ -4,7 +4,7 @@ |
5 | 5 | * (we make assumptions about this.pc (parent clip) being available) |
6 | 6 | */ |
7 | 7 | var pcHtmlEmbedDefaults={ |
8 | | - 'dur':4 //default duration of 4seconds |
| 8 | + 'dur':4 //default duration of 4 seconds |
9 | 9 | } |
10 | 10 | var htmlEmbed ={ |
11 | 11 | supports: { |
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/vlcEmbed.js |
— | — | @@ -93,9 +93,34 @@ |
94 | 94 | this.vlc.input.position = perc; |
95 | 95 | this.setStatus( 'seeking...' ); |
96 | 96 | } |
| 97 | + }else{ |
| 98 | + this.doPlayThenSeek(perc); |
97 | 99 | } |
98 | 100 | this.parent_monitor(); |
99 | 101 | }, |
| 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 | + }, |
100 | 125 | playMovieAt: function (order){ |
101 | 126 | //@@todo add clips to playlist after (order) and then play |
102 | 127 | this.play(); |
— | — | @@ -186,7 +211,7 @@ |
187 | 212 | //for now trust the duration from url over vlc input.length |
188 | 213 | if( !this.getDuration() && this.vlc.input.length > 0 ) |
189 | 214 | { |
190 | | - js_log('setting duration to ' + this.vlc.input.length /1000); |
| 215 | + //js_log('setting duration to ' + this.vlc.input.length /1000); |
191 | 216 | this.duration = this.vlc.input.length /1000; |
192 | 217 | } |
193 | 218 | this.currentTime = this.vlc.input.time/1000; |
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/embedVideo.js |
— | — | @@ -374,9 +374,8 @@ |
375 | 375 | npt2seconds(embedObj.getTimeReq().split('/')[0]); |
376 | 376 | }, |
377 | 377 | 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); |
381 | 380 | //js_log('perc:' + perc + ' * ' + embedObj.getDuration() + ' jt:'+ this.jump_time); |
382 | 381 | embedObj.setStatus( gM('seek_to')+' '+embedObj.jump_time ); |
383 | 382 | //update the thumbnail / frame |
Index: branches/new-upload/phase3/js2/mwEmbed/libEmbedVideo/nativeEmbed.js |
— | — | @@ -78,15 +78,39 @@ |
79 | 79 | }else{ |
80 | 80 | this.parent_doSeek(perc); |
81 | 81 | } |
82 | | - }else if(this.vid.duration ){ |
| 82 | + }else if(this.vid && this.vid.duration ){ |
83 | 83 | this.doNativeSeek(perc); |
| 84 | + }else{ |
| 85 | + this.doPlayThenSeek(perc) |
84 | 86 | } |
85 | | - }, |
| 87 | + }, |
86 | 88 | doNativeSeek:function(perc){ |
87 | 89 | this.seek_time_sec=0; |
88 | 90 | this.vid.currentTime = perc * this.vid.duration; |
89 | 91 | this.parent_monitor(); |
90 | 92 | }, |
| 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 | + }, |
91 | 115 | setCurrentTime: function(pos, callback){ |
92 | 116 | var _this = this; |
93 | 117 | this.getVID(); |