Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js |
— | — | @@ -316,6 +316,7 @@ |
317 | 317 | |
318 | 318 | var flashEmbed = { |
319 | 319 | instanceOf:'flashEmbed', |
| 320 | + monitorTimerId : 0, |
320 | 321 | supports: {'play_head':true, 'play_or_pause':true, 'stop':true, 'fullscreen':true, 'time_display':true, 'volume_control':true}, |
321 | 322 | getPluginEmbedHTML : function (){ |
322 | 323 | setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 150); |
— | — | @@ -326,36 +327,78 @@ |
327 | 328 | return '<div class="player" id="FlowPlayerAnnotationHolder_'+this.pid+'"></div>'+"\n"; |
328 | 329 | }, |
329 | 330 | postEmbedJS : function() |
330 | | - { |
331 | | - var clip = flashembed('FlowPlayerAnnotationHolder_'+this.pid, |
332 | | - { src: mv_embed_path + 'FlowPlayerDark.swf', width: this.width, height: this.height, id: this.pid}, |
333 | | - { config: { autoPlay: true, hideControls: true, |
334 | | - videoFile: this.media_element.selected_source.uri } }); |
335 | | - js_log('setInterval'); |
336 | | - this.update_interval = setInterval('document.getElementById(\''+this.id+'\').updateGUI()', 250); |
| 331 | + { |
| 332 | + this.getFLA(); |
| 333 | + if(!this.flv){ |
| 334 | + var clip = flashembed('FlowPlayerAnnotationHolder_'+this.pid, |
| 335 | + { src: mv_embed_path + 'FlowPlayerDark.swf', width: this.width, height: this.height, id: this.pid}, |
| 336 | + { config: { autoPlay: true, hideControls: true, |
| 337 | + videoFile: this.media_element.selected_source.uri } }); |
| 338 | + } |
| 339 | + if(this.fla){ |
| 340 | + js_log('flash ready:start monitor:'); |
| 341 | + setTimeout('$j(\'#'+this.id+'\').get(0).monitor()', 250); |
| 342 | + }else{ |
| 343 | + js_log('flash not ready'); |
| 344 | + setTimeout('$j(\'#'+this.id+'\').get(0).postEmbedJS()',100); |
| 345 | + } |
337 | 346 | }, |
338 | 347 | /* js hooks/controls */ |
339 | | - play : function(){ |
340 | | - if(this.thumbnail_disp) |
| 348 | + play : function(){ |
| 349 | + this.getFLA(); |
| 350 | + if(!this.fla || this.thumbnail_disp) |
341 | 351 | { |
342 | 352 | //call the parent |
343 | 353 | this.parent_play(); |
344 | 354 | }else{ |
345 | | - this.getPluginEmbed().DoPlay(); |
| 355 | + this.fla.DoPlay(); |
346 | 356 | this.paused=false; |
| 357 | + setTimeout('$j(\'#'+this.id+'\').get(0).monitor()', 250); |
347 | 358 | } |
348 | 359 | }, |
349 | 360 | pause : function() |
350 | 361 | { |
351 | 362 | this.getPluginEmbed().Pause(); |
| 363 | + //stop updates: |
| 364 | + if( this.monitorTimerId != 0 ) |
| 365 | + { |
| 366 | + clearInterval(this.monitorTimerId); |
| 367 | + this.monitorTimerId = 0; |
| 368 | + } |
352 | 369 | }, |
353 | | - updateGUI : function() |
| 370 | + monitor : function() |
354 | 371 | { |
355 | | - var time = this.getPluginEmbed().getTime(); |
356 | | - var duration = this.getPluginEmbed().getDuration(); |
357 | | - this.setStatus( seconds2ntp(time, false) + '/' + seconds2ntp(duration, false)); |
358 | | - if($j('#mv_seeker_slider_'+this.id).length!=0) |
359 | | - $j('#mv_seeker_slider_'+this.id).css({'marginLeft':(3 + 114 * time / duration) + 'px'}); |
| 372 | + this.getFLA(); |
| 373 | + var time = this.fla.getTime(); |
| 374 | + //flash is giving bogus duration get from this |
| 375 | + var end_ntp = (this.media_element.selected_source.end_ntp)? |
| 376 | + this.media_element.selected_source.end_ntp : |
| 377 | + seconds2ntp( this.fla.getDuration() ); |
| 378 | + var start_ntp = (this.media_element.selected_source.start_ntp)? |
| 379 | + this.media_element.selected_source.start_ntp : 0; |
| 380 | + this.setStatus( seconds2ntp(time, false) + '/' + end_ntp); |
| 381 | + js_log('cur time : ' + (time - ntp2seconds(start_ntp)) + |
| 382 | + ' / ' + |
| 383 | + (ntp2seconds(end_ntp)-ntp2seconds(start_ntp))); |
| 384 | + this.setSliderValue((time - ntp2seconds(start_ntp)) / (ntp2seconds(end_ntp)-ntp2seconds(start_ntp)) ); |
| 385 | + //do monitor update: |
| 386 | + if( ! this.monitorTimerId ){ |
| 387 | + if(document.getElementById(this.id)){ |
| 388 | + this.monitorTimerId = setInterval('$j(\'#'+this.id+'\').get(0).monitor()', 250); |
| 389 | + } |
| 390 | + } |
| 391 | + }, |
| 392 | + // get the embed fla object |
| 393 | + getFLA : function (){ |
| 394 | + this.fla = this.getPluginEmbed(); |
| 395 | + }, |
| 396 | + onStop: function(){ |
| 397 | + //stop updates: |
| 398 | + if( this.monitorTimerId != 0 ) |
| 399 | + { |
| 400 | + clearInterval(this.monitorTimerId); |
| 401 | + this.monitorTimerId = 0; |
| 402 | + } |
360 | 403 | } |
361 | 404 | } |
362 | 405 | |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js |
— | — | @@ -56,9 +56,9 @@ |
57 | 57 | if(this.controls){ |
58 | 58 | //activate the slider: scriptaculus based) |
59 | 59 | this.activateSlider(); |
60 | | - //start doing status updates every 1/10th of a second |
61 | | - setTimeout('document.getElementById(\''+this.id+'\').monitor()',100); |
62 | | - } |
| 60 | + //start doing status updates every 1/10th of a second |
| 61 | + } |
| 62 | + setTimeout('$j(\'#'+this.id+'\').get(0).monitor()',100); |
63 | 63 | }else{ |
64 | 64 | js_log('vlc not ready'); |
65 | 65 | setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()',100); |
— | — | @@ -184,9 +184,11 @@ |
185 | 185 | this.setSliderValue(this.vlc.input.position); |
186 | 186 | }else{ |
187 | 187 | //set via time: |
188 | | - //js_log('set slider:'+(this.vlc.input.time-this.start_offset) + ' / ' + this.mediaLen + |
189 | | - //' ='+ (this.vlc.input.time-this.start_offset)/this.mediaLen ); |
190 | | - this.setSliderValue( ((this.vlc.input.time-this.start_offset)/1000)/this.duration); |
| 188 | + /*js_log('t:' +(this.vlc.input.time/1000) +' - so:'+this.start_offset+ |
| 189 | + ' set slider:' + ((this.vlc.input.time/1000)-this.start_offset) + ' / ' + this.duration + |
| 190 | + ' ='+ ((this.vlc.input.time/1000)-this.start_offset)/this.duration ); |
| 191 | + */ |
| 192 | + this.setSliderValue( ((this.vlc.input.time/1000) -this.start_offset) / this.duration); |
191 | 193 | } |
192 | 194 | this.setStatus(seconds2ntp(this.currentTime) + ' / ' + seconds2ntp(this.duration+this.start_offset) ); |
193 | 195 | }else{ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js |
— | — | @@ -30,7 +30,8 @@ |
31 | 31 | var _global = this; |
32 | 32 | var mv_init_done=false; |
33 | 33 | |
34 | | -//this only affects roe based source media files |
| 34 | +//this restricts playable sources to ROE xml media without start end time atttribute |
| 35 | +var mv_restrict_roe_time_source = true; |
35 | 36 | |
36 | 37 | var debug_global_vid_ref=null; |
37 | 38 | /* |
— | — | @@ -46,7 +47,7 @@ |
47 | 48 | getMvEmbedPath(); |
48 | 49 | } |
49 | 50 | //here you can add in delay load refrence to test things with delayed load time: |
50 | | -mv_embed_path = mv_embed_path + 'delay_load.php/'; |
| 51 | +//mv_embed_path = mv_embed_path + 'delay_load.php/'; |
51 | 52 | |
52 | 53 | //the default thumbnail for missing images: |
53 | 54 | var mv_default_thumb_url = mv_embed_path + 'images/vid_default_thumb.jpg'; |
— | — | @@ -278,19 +279,22 @@ |
279 | 280 | |
280 | 281 | //I am getting vlEmebed is not defined like 1/5 or 1/20th the time |
281 | 282 | //the load order should be more defined and ordered via callbacks |
282 | | - $j.getScript(plugin_path, function(){ |
| 283 | + /*$j.getScript(plugin_path, function(){ |
283 | 284 | js_log(_this.id + ' plugin loaded'); |
284 | 285 | _this.loaded = true; |
285 | 286 | for(var i in _this.loading_callbacks) |
286 | 287 | _this.loading_callbacks[i](); |
287 | 288 | _this.loading_callbacks = null; |
288 | | - }); |
289 | | - /*eval('var lib = {"'+this.library+'Embed":\'embedLibs/mv_'+this.library+'Embed.js\'}'); |
| 289 | + }); */ |
| 290 | + eval('var lib = {"'+this.library+'Embed":\'embedLibs/mv_'+this.library+'Embed.js\'}'); |
290 | 291 | mvJsLoader.doLoad(lib,function(){ |
291 | 292 | js_log(_this.id + ' plugin loaded'); |
292 | 293 | _this.loaded = true; |
293 | | - callback(); |
294 | | - });*/ |
| 294 | + //callback(); |
| 295 | + for(var i in _this.loading_callbacks) |
| 296 | + _this.loading_callbacks[i](); |
| 297 | + _this.loading_callbacks = null; |
| 298 | + }); |
295 | 299 | } |
296 | 300 | } |
297 | 301 | } |
— | — | @@ -1239,9 +1243,15 @@ |
1240 | 1244 | parts[1]=parts[1].replace('x-flv', 'flash'); |
1241 | 1245 | this.title = parts[1] + ' ' + parts[0]; |
1242 | 1246 | } |
| 1247 | + |
1243 | 1248 | if (element.hasAttribute("id")) |
1244 | 1249 | this.id = element.getAttribute("id"); |
1245 | | - |
| 1250 | + |
| 1251 | + //@@todo parse start time format and put into start_ntp |
| 1252 | + if(element.hasAttribute("start")) |
| 1253 | + this.start = element.getAttribute("start"); |
| 1254 | + if(element.hasAttribute("end")) |
| 1255 | + this.start = element.getAttribute("end"); |
1246 | 1256 | //js_log('Adding mediaSource of type ' + this.mime_type + ' and uri ' + this.uri + ' and title ' + this.title); |
1247 | 1257 | this.parseURLDuration(); |
1248 | 1258 | }, |
— | — | @@ -1363,9 +1373,7 @@ |
1364 | 1374 | mediaElement.prototype = |
1365 | 1375 | { |
1366 | 1376 | /** The array of mediaSource elements. */ |
1367 | | - sources:null, |
1368 | | - /** Playable sources **/ |
1369 | | - playable_sources:null, |
| 1377 | + sources:null, |
1370 | 1378 | addedROEData:false, |
1371 | 1379 | /** Selected mediaSource element. */ |
1372 | 1380 | selected_source:null, |
— | — | @@ -1378,7 +1386,6 @@ |
1379 | 1387 | var _this = this; |
1380 | 1388 | js_log('Initializing mediaElement...'); |
1381 | 1389 | this.sources = new Array(); |
1382 | | - this.playable_sources = new Array(); |
1383 | 1390 | this.thumbnail = mv_default_thumb_url; |
1384 | 1391 | // Process the <video> element |
1385 | 1392 | this.tryAddSource(video_element); |
— | — | @@ -1421,17 +1428,18 @@ |
1422 | 1429 | //@@todo read user preference for source |
1423 | 1430 | |
1424 | 1431 | // Select the default source |
1425 | | - for (var source in this.playable_sources){ |
1426 | | - if(this.playable_sources[source].marked_default){ |
1427 | | - this.selected_source = this.playable_sources[source]; |
| 1432 | + var playable_sources = this.getPlayableSources(); |
| 1433 | + for (var source in playable_sources){ |
| 1434 | + if(playable_sources[source].marked_default){ |
| 1435 | + this.selected_source = playable_sources[source]; |
1428 | 1436 | return true; |
1429 | 1437 | } |
1430 | 1438 | } |
1431 | 1439 | // select streams that start with 'mv_' first source |
1432 | 1440 | if (!this.selected_source) |
1433 | 1441 | { |
1434 | | - js_log('autoselecting first source:' + this.playable_sources[0]); |
1435 | | - this.selected_source = this.playable_sources[0]; |
| 1442 | + js_log('autoselecting first source:' + playable_sources[0]); |
| 1443 | + this.selected_source = playable_sources[0]; |
1436 | 1444 | } |
1437 | 1445 | }, |
1438 | 1446 | /** Returns the thumbnail URL for the media element. |
— | — | @@ -1476,12 +1484,21 @@ |
1477 | 1485 | } |
1478 | 1486 | } |
1479 | 1487 | var source = new mediaSource(element); |
1480 | | - this.sources.push(source); |
1481 | | - //check if we support the mime type and its a url based time segment |
1482 | | - if(this.isPlayableType(source.mime_type)){ |
1483 | | - this.playable_sources.push(source); |
1484 | | - } |
| 1488 | + this.sources.push(source); |
1485 | 1489 | }, |
| 1490 | + getPlayableSources: function(){ |
| 1491 | + var playable_sources= new Array(); |
| 1492 | + for(var i in this.sources){ |
| 1493 | + if(this.isPlayableType(this.sources[i].mime_type)){ |
| 1494 | + if(mv_restrict_roe_time_source){ |
| 1495 | + if(this.sources[i]['start']) |
| 1496 | + continue; |
| 1497 | + } |
| 1498 | + playable_sources.push(this.sources[i]); |
| 1499 | + } |
| 1500 | + } |
| 1501 | + return playable_sources; |
| 1502 | + }, |
1486 | 1503 | /** Imports media sources from ROE data. |
1487 | 1504 | @param roe_data ROE data. |
1488 | 1505 | */ |
— | — | @@ -1787,7 +1804,7 @@ |
1788 | 1805 | if(this.supports['play_head'] && (available_width > 18)) |
1789 | 1806 | { |
1790 | 1807 | html_code += |
1791 | | - ' <div class="seeker" style="width: ' + (available_width - 18) + 'px;">'; |
| 1808 | + ' <div class="seeker" id="mv_seeker_'+this.id+'" style="width: ' + (available_width - 18) + 'px;">'; |
1792 | 1809 | html_code+= |
1793 | 1810 | ' <div class="seeker_bar">'+ |
1794 | 1811 | ' <div class="seeker_bar_outer"></div>'+ |
— | — | @@ -2238,7 +2255,7 @@ |
2239 | 2256 | var out='<span style="color:white"><blockquote>'; |
2240 | 2257 | var _this=this; |
2241 | 2258 | //js_log('selected src'+ _this.media_element.selected_source.url); |
2242 | | - $j.each(this.media_element.playable_sources, function(index, source) |
| 2259 | + $j.each(this.media_element.getPlayableSources(), function(index, source) |
2243 | 2260 | { |
2244 | 2261 | var default_player = embedTypes.players.defaultPlayer(source.getMIMEType()); |
2245 | 2262 | var source_select_code = 'document.getElementById(\''+_this.id+'\').closeDisplayedHTML(); document.getElementById(\''+_this.id+'\').media_element.selectSource(\''+index+'\');'; |
— | — | @@ -2255,8 +2272,7 @@ |
2256 | 2273 | retval+='<a href="#" onClick="' + source_select_code + 'embedTypes.players.userSelectPlayer(\''+default_player.id+'\',\''+source.getMIMEType()+'\'); return false;">'; |
2257 | 2274 | out += source.getTitle()+/*' - ' + default_player.getName() +*/ (is_not_selected?'</a>':'') + ' '; |
2258 | 2275 | out += /*'(<a href="#" onClick=\'$j("#player_select_list_'+index+'").fadeIn("slow");return false;\'>choose player</a>)' +*/ player_code; |
2259 | | - } |
2260 | | - else |
| 2276 | + }else |
2261 | 2277 | out+= source.getTitle() + ' - no player available'; |
2262 | 2278 | }); |
2263 | 2279 | out+='</blockquote></span>'; |
— | — | @@ -2483,10 +2499,12 @@ |
2484 | 2500 | setSliderValue: function(perc){ |
2485 | 2501 | var id = (this.pc)?this.pc.pp.id:this.id; |
2486 | 2502 | //this.slider.setValue(perc); |
2487 | | - var cur_slider = $j('#playhead_'+id).width(); |
2488 | | - var offset_perc = 1-(cur_slider / $j('#slider_'+id).width()); |
2489 | | - var val = Math.round( offset_perc* (perc * $j('#slider_'+id).width() ) ); |
2490 | | - $j('#playhead_'+id).css('left',val); |
| 2503 | + //var cur_slider = $j('#mv_seeker_'+id).width(); |
| 2504 | + //var offset_perc = 1-(cur_slider / $j('#mv_seeker_'+id).width()); |
| 2505 | + //offset_perc* |
| 2506 | + var val = Math.round( perc * $j('#mv_seeker_'+id).width() ); |
| 2507 | + $j('#mv_seeker_slider_'+id).css('marginLeft',val); |
| 2508 | + js_log('perc in: ' + perc + ' * ' + $j('#mv_seeker_'+id).width() + ' = set to: '+ val); |
2491 | 2509 | //js_log('op:' + offset_perc + ' *('+perc+' * ' + $j('#slider_'+id).width() + ')'); |
2492 | 2510 | }, |
2493 | 2511 | setStatus:function(value){ |
— | — | @@ -2582,8 +2600,10 @@ |
2583 | 2601 | return null; |
2584 | 2602 | } |
2585 | 2603 | times = ntp.split(':'); |
2586 | | - if(times.length!=3) |
| 2604 | + if(times.length!=3){ |
| 2605 | + js_log('ntp2seconds:not valid ntp:'+ntp); |
2587 | 2606 | return null; |
| 2607 | + } |
2588 | 2608 | //return seconds float (ie take seconds float value if present): |
2589 | 2609 | return parseInt(times[0]*3600)+parseInt(times[1]*60)+parseFloat(times[2]); |
2590 | 2610 | } |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/sample_page.php |
— | — | @@ -50,7 +50,7 @@ |
51 | 51 | '<a href="javascript:document.getElementById(\'vflash\').play();">Play</a> | '. |
52 | 52 | '<a href="javascript:document.getElementById(\'vflash\').stop();">Stop</a> <br />'; |
53 | 53 | |
54 | | -$sample_embed[2]['tag']='<video style="width:400px"><source type="video/ogg" src="http://128.114.20.64/media/senate_proceeding_05-15-08.ogg.anx?t=0:00:00/0:20:00" title="annodex ogg"/><source src="http://www.archive.org/download/mv_senate_proceeding_05-15-08/senate_proceeding_05-15-08.flv" title="flash"/></video>'; |
| 54 | +$sample_embed[2]['tag']='<video style="width:400px"><source src="http://mvbox2.cse.ucsc.edu/mvFlvServer.php/senate_proceeding_08-01-07.flv?t=0:20:00/0:21:00" title="flash"/></video>'; |
55 | 55 | $sample_embed[2]['desc']=''; |
56 | 56 | |
57 | 57 | //$sample_embed[1]['tag'] = '<video roe="http://192.168.0.104/mvWiki/index.php?title=Special:MvExportStream&feed_format=roe&stream_name=Senate_proceeding_08-01-07&t=0:00:00/0:05:00">'; |
— | — | @@ -114,7 +114,7 @@ |
115 | 115 | ?> |
116 | 116 | <table border="1" cellpadding="6" width="600"> |
117 | 117 | <? foreach($sample_embed as $key=>$aval){ |
118 | | - if($key!=3)continue; |
| 118 | + if($key!=2)continue; |
119 | 119 | ?> |
120 | 120 | <tr> |
121 | 121 | <td><?=$aval['tag']?></td> |