Index: trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mvPlayList.js |
— | — | @@ -51,6 +51,8 @@ |
52 | 52 | loading:true, |
53 | 53 | loading_external_data:true, //if we are loading external data (set to loading by default) |
54 | 54 | |
| 55 | + activeClipList:null, |
| 56 | + |
55 | 57 | interface_url:null, //the interface url |
56 | 58 | tracks:{}, |
57 | 59 | default_track:null, // the default track to add clips to. |
— | — | @@ -70,7 +72,8 @@ |
71 | 73 | js_log('mvPlayList:init:'); |
72 | 74 | this.tracks={}; |
73 | 75 | this.default_track=null; |
74 | | - |
| 76 | + |
| 77 | + this.activeClipList = new activeClipList(); |
75 | 78 | //add default track & default track pointer: |
76 | 79 | this.tracks[0]= new trackObj(); |
77 | 80 | this.default_track = this.tracks[0]; |
— | — | @@ -233,10 +236,14 @@ |
234 | 237 | |
235 | 238 | var durSum=0; |
236 | 239 | $j.each( this.default_track.clips, function( i, clip ){ |
237 | | - if( clip.embed ){ |
238 | | - js_log('plDUR:add : '+ clip.getDuration() + ' src:' + clip.embed.src); |
| 240 | + if( clip.embed ){ |
239 | 241 | clip.dur_offset = durSum; |
240 | | - durSum += clip.getDuration(); |
| 242 | + if( clip.embed.supports['playlist_swap_loader'] ){ |
| 243 | + //don't include transition time (for playlist_swap_loader compatible clips) should have a better name for that |
| 244 | + durSum += clip.getSoloDuration(); |
| 245 | + }else{ |
| 246 | + durSum += clip.getDuration(); |
| 247 | + } |
241 | 248 | }else{ |
242 | 249 | js_log("ERROR: clip " +clip.id + " not ready"); |
243 | 250 | } |
— | — | @@ -530,14 +537,21 @@ |
531 | 538 | //@@todo where the plugin supports pre_loading future clips and manage that in javascript |
532 | 539 | //stop current clip |
533 | 540 | this.cur_clip.embed.stop(); |
534 | | - this.updateCurrentClip(next_clip); |
| 541 | + |
| 542 | + this.updateCurrentClip(next_clip); |
| 543 | + |
535 | 544 | this.cur_clip.embed.play(); |
536 | 545 | }, |
537 | | - updateCurrentClip:function(new_clip){ |
538 | | - js_log('f:updateCurrentClip:'+new_clip.id); |
| 546 | + updateCurrentClip:function(new_clip){ |
| 547 | + js_log('f:updateCurrentClip:'+new_clip.id); |
| 548 | + //keep the active play clip in sync: |
| 549 | + if( this.cur_clip ) |
| 550 | + this.activeClipList.remove(this.cur_clip ) |
| 551 | + this.activeClipList.add( new_clip ); |
| 552 | + |
539 | 553 | //do swap: |
540 | 554 | $j('#clipDesc_'+this.cur_clip.id).hide(); |
541 | | - this.cur_clip=new_clip; |
| 555 | + this.cur_clip=new_clip; |
542 | 556 | $j('#clipDesc_'+this.cur_clip.id).show(); |
543 | 557 | //update the playhead: |
544 | 558 | this.setSliderValue( this.cur_clip.dur_offset / this.getDuration() ); |
— | — | @@ -573,33 +587,38 @@ |
574 | 588 | //playlist play |
575 | 589 | play: function(){ |
576 | 590 | var plObj=this; |
577 | | - js_log('pl play'); |
| 591 | + //js_log('pl play'); |
578 | 592 | //hide the playlist play button: |
579 | 593 | $j('#big_play_link_'+this.id).hide(); |
580 | 594 | |
581 | 595 | //un-pause if paused: |
582 | 596 | if(this.paused) |
583 | | - this.paused=false; |
| 597 | + this.paused=false; |
584 | 598 | |
585 | | - //update the control: |
586 | | - |
| 599 | + //update the control: |
587 | 600 | this.start_clip = this.cur_clip; |
588 | 601 | this.start_clip_src= this.cur_clip.src; |
589 | 602 | |
590 | 603 | if(this.cur_clip.embed.supports['playlist_swap_loader'] ){ |
| 604 | + //set the cur_clip to active |
| 605 | + this.activeClipList.add(this.cur_clip); |
| 606 | + |
591 | 607 | //navtive support: |
592 | 608 | // * pre-loads clips |
593 | 609 | // * mv_playlist smil extension, manages transitions animations overlays etc. |
594 | | - js_log('clip obj supports playlist swap_loader (ie playlist controlled playback)'); |
595 | | - //@@todo pre-load each clip: |
596 | | - this.cur_clip.embed.play(); |
| 610 | + //js_log('clip obj supports playlist swap_loader (ie playlist controlled playback)'); |
| 611 | + //@@todo pre-load each clip: |
| 612 | + //play all active clips (playlist_swap_loader can have more than one clip active) |
| 613 | + $j.each(this.activeClipList.getClipList(), function(inx, clip){ |
| 614 | + clip.embed.play(); |
| 615 | + }); |
597 | 616 | }else if(this.cur_clip.embed.supports['playlist_driver']){ |
598 | | - js_log('playlist_driver'); |
| 617 | + //js_log('playlist_driver'); |
599 | 618 | //embedObject is feed the playlist info directly and manages next/prev |
600 | | - this.cur_clip.embed.playMovieAt(this.cur_clip.order); |
| 619 | + this.cur_clip.embed.playMovieAt( this.cur_clip.order ); |
601 | 620 | }else{ |
602 | 621 | //not much playlist support just play the first clip: |
603 | | - js_log('basic play'); |
| 622 | + //js_log('basic play'); |
604 | 623 | //play cur_clip |
605 | 624 | this.cur_clip.embed.play(); |
606 | 625 | } |
— | — | @@ -610,18 +629,23 @@ |
611 | 630 | this.cur_clip.embed.toggleMute(); |
612 | 631 | }, |
613 | 632 | pause:function(){ |
614 | | - js_log('f:pause: playlist'); |
| 633 | + //js_log('f:pause: playlist'); |
615 | 634 | var ct = new Date(); |
616 | 635 | this.pauseTime = this.currentTime; |
617 | 636 | this.paused=true; |
618 | | - js_log('pause time: '+ this.pauseTime + ' call embed pause:'); |
619 | | - this.cur_clip.embed.pause(); |
| 637 | + //js_log('pause time: '+ this.pauseTime + ' call embed pause:'); |
| 638 | + |
| 639 | + //pause all the active clips: |
| 640 | + $j.each(this.activeClipList.getClipList(), function(inx, clip){ |
| 641 | + clip.embed.pause(); |
| 642 | + }); |
620 | 643 | }, |
621 | 644 | fullscreen:function(){ |
622 | 645 | this.cur_clip.embed.fullscreen(); |
623 | 646 | }, |
624 | 647 | //playlist stops playback for the current clip (and resets state for start clips) |
625 | 648 | stop:function(){ |
| 649 | + var _this = this; |
626 | 650 | /*js_log("pl stop:"+ this.start_clip.id + ' c:'+this.cur_clip.id); |
627 | 651 | //if start clip |
628 | 652 | if(this.start_clip.id!=this.cur_clip.id){ |
— | — | @@ -635,15 +659,34 @@ |
636 | 660 | this.start_clip.embed.thumbnail_disp=true; |
637 | 661 | } |
638 | 662 | //empty the play-back container |
639 | | - $j('#mv_ebct_'+this.id).empty();*/ |
| 663 | + $j('#mv_ebct_'+this.id).empty();*/ |
640 | 664 | |
| 665 | + //stop all the clips: monitor: |
| 666 | + window.clearInterval( this.smil_monitorTimerId ); |
| 667 | + /*for (var i=0;i<this.clips.length;i++){ |
| 668 | + var clip = this.clips[i]; |
| 669 | + if(clip){ |
| 670 | + clip.embed.stop(); |
| 671 | + $j('#clipDesc_'+clip.id).hide(); |
| 672 | + } |
| 673 | + }*/ |
| 674 | + //stop, hide and remove all active clips: |
| 675 | + $j.each(this.activeClipList.getClipList(), function(inx, clip){ |
| 676 | + if(clip){ |
| 677 | + clip.embed.stop(); |
| 678 | + $j('#clipDesc_'+clip.id).hide(); |
| 679 | + _this.activeClipList.remove(clip); |
| 680 | + } |
| 681 | + }); |
| 682 | + //set the current clip to the first clip: |
| 683 | + this.cur_clip = this.start_clip; |
| 684 | + //display the first clip thumb: |
| 685 | + this.cur_clip.embed.stop(); |
641 | 686 | //make sure the current clip is vissable: |
642 | | - $j('#clipDesc_'+this.cur_clip.id).css({display:'inline'}); |
643 | | - |
644 | | - //do stop current clip |
645 | | - this.cur_clip.embed.stop(); |
646 | | - //stop the monitor: |
647 | | - window.clearInterval( this.smil_monitorTimerId ); |
| 687 | + $j('#clipDesc_'+this.cur_clip.id).show(); |
| 688 | + //reset the currentTime: |
| 689 | + this.currentTime = 0; |
| 690 | + //FIXME still some issues with "stoping" and reseting the playlist |
648 | 691 | }, |
649 | 692 | doSeek:function(v){ |
650 | 693 | js_log('pl:doSeek:'+v); |
— | — | @@ -738,7 +781,7 @@ |
739 | 782 | |
740 | 783 | var cov = parseInt( this.cur_clip.order ) + parseInt( clip_offset ); |
741 | 784 | var cmax = this.getClipCount()-1; |
742 | | - js_log( 'f:getClip: '+clip_offset + ' cov:'+cov +' cmax:'+ cmax); |
| 785 | + //js_log( 'f:getClip: '+clip_offset + ' cov:'+cov +' cmax:'+ cmax); |
743 | 786 | |
744 | 787 | //force first or last clip if offset is outOfBounds |
745 | 788 | if( cov >= 0 && cov <= cmax ){ |
— | — | @@ -1074,7 +1117,7 @@ |
1075 | 1118 | }*/ |
1076 | 1119 | }, |
1077 | 1120 | play:function(){ |
1078 | | - js_log('pl eb play'); |
| 1121 | + //js_log('pl eb play'); |
1079 | 1122 | var plObj = this.pc.pp; |
1080 | 1123 | //check if we are already playing |
1081 | 1124 | if( !this.thumbnail_disp ){ |
— | — | @@ -1262,6 +1305,16 @@ |
1263 | 1306 | this.stop(); |
1264 | 1307 | |
1265 | 1308 | //update the playlist current time: |
| 1309 | + //check for a trsnOut from the previus clip to subtract |
| 1310 | + /*var prev_clip = this.getClip(-1); |
| 1311 | + var transOffset = 0; |
| 1312 | + if( prev_clip.id != this.cur_clip.id ){ |
| 1313 | + if( prev_clip.transOut ){ |
| 1314 | + transOffset = prev_clip.transOut.getDuration(); |
| 1315 | + js_log("should add: " + transOffset + " off:" + this.cur_clip.dur_offset+ " to " +this.cur_clip.embed.currentTime + |
| 1316 | + ' = ' + ( this.cur_clip.dur_offset + this.cur_clip.embed.currentTime + transOffset) ); |
| 1317 | + } |
| 1318 | + }*/ |
1266 | 1319 | this.currentTime = this.cur_clip.dur_offset + this.cur_clip.embed.currentTime; |
1267 | 1320 | |
1268 | 1321 | //update slider: |
— | — | @@ -1390,8 +1443,11 @@ |
1391 | 1444 | if(typeof(other_pClip)=='undefined' || other_pClip.id == tObj.pClip.pp.cur_clip.id) |
1392 | 1445 | js_log('Error: crossfade without media asset'); |
1393 | 1446 | //if not sliding start playback: |
1394 | | - if(!tObj.pClip.pp.userSlide) |
1395 | | - other_pClip.embed.play(); |
| 1447 | + if(!tObj.pClip.pp.userSlide){ |
| 1448 | + other_pClip.embed.play(); |
| 1449 | + //manualy ad the extra layer to the activeClipList |
| 1450 | + tObj.pClip.pp.activeClipList.add( other_pClip ); |
| 1451 | + } |
1396 | 1452 | tObj.overlay_selector_id = 'clipDesc_'+other_pClip.id; |
1397 | 1453 | }else{ |
1398 | 1454 | tObj.overlay_selector_id =this.getOverlaySelector(tObj); |
— | — | @@ -1672,12 +1728,22 @@ |
1673 | 1729 | * getDuration |
1674 | 1730 | * @returns duration in int |
1675 | 1731 | */ |
1676 | | - getDuration:function(){ |
| 1732 | + getDuration:function(){ |
1677 | 1733 | //check for smil dur: |
1678 | 1734 | if( this.dur ) |
1679 | 1735 | return this.dur; |
1680 | 1736 | return this.embed.getDuration(); |
1681 | | - } |
| 1737 | + }, |
| 1738 | + //gets the duration of the clip subracting transitions |
| 1739 | + getSoloDuration:function(){ |
| 1740 | + var fulldur = this.getDuration(); |
| 1741 | + //see if we need to subtract from time eating transitions (transOut) |
| 1742 | + if(this.transOut) |
| 1743 | + fulldur -= this.transOut.getDuration(); |
| 1744 | + |
| 1745 | + js_log("getSoloDuration:: td: " + this.getDuration() + ' sd:' + fulldur); |
| 1746 | + return fulldur; |
| 1747 | + } |
1682 | 1748 | } |
1683 | 1749 | /* object to manage embedding html with smil timings |
1684 | 1750 | * grabs settings from parent clip |
— | — | @@ -1712,6 +1778,9 @@ |
1713 | 1779 | if(_this.dur) |
1714 | 1780 | _this.dur = smilParseTime(_this.dur); |
1715 | 1781 | }, |
| 1782 | + getDuration:function(){ |
| 1783 | + return this.dur; |
| 1784 | + }, |
1716 | 1785 | //returns the values of supported_attributes: |
1717 | 1786 | getAttributeObj:function(){ |
1718 | 1787 | var elmObj = {}; |
— | — | @@ -1811,9 +1880,38 @@ |
1812 | 1881 | function smilParseTime(time_str){ |
1813 | 1882 | return parseInt(time_str.replace('s', '')); |
1814 | 1883 | } |
1815 | | -/*************************** |
1816 | | - * end SMIL specific code |
1817 | | - ***************************/ |
| 1884 | +//stores a list pointers to active clips (maybe this should just be a property of clips (but results in lots of seeks) |
| 1885 | +var activeClipList = function(){ |
| 1886 | + return this.init(); |
| 1887 | +} |
| 1888 | +activeClipList.prototype = { |
| 1889 | + init:function(){ |
| 1890 | + this.clipList = new Array(); |
| 1891 | + }, |
| 1892 | + add:function( clip ){ |
| 1893 | + //make sure the clip is not already active: |
| 1894 | + for(var i =0;i < this.clipList.lenght; i++){ |
| 1895 | + var active_clip = this.clipList[i]; |
| 1896 | + if(clip.id == active_clip.id) //clip already active: |
| 1897 | + return false; |
| 1898 | + } |
| 1899 | + this.clipList.push( clip ); |
| 1900 | + return true; |
| 1901 | + }, |
| 1902 | + remove:function( clip ){ |
| 1903 | + for(var i = 0; i < this.clipList.length; i++){ |
| 1904 | + var active_clip = this.clipList[i]; |
| 1905 | + if(clip.id == active_clip.id){ |
| 1906 | + this.clipList.splice(i, 1); |
| 1907 | + return true; |
| 1908 | + } |
| 1909 | + } |
| 1910 | + return false; |
| 1911 | + }, |
| 1912 | + getClipList:function(){ |
| 1913 | + return this.clipList; |
| 1914 | + } |
| 1915 | +} |
1818 | 1916 | var trackObj = function( initObj ){ |
1819 | 1917 | return this.init( initObj ); |
1820 | 1918 | } |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libSequencer/mvSequencer.js |
— | — | @@ -252,10 +252,10 @@ |
253 | 253 | rewrite_by_id( this.plObj_id ); |
254 | 254 | setTimeout(this.instance_name +'.checkReadyPlObj()', 25); |
255 | 255 | }, |
256 | | - updateSeqSaveButtons:function(){ |
257 | | - var cancel_button = '<a style="border:' + |
258 | | - 'solid gray;font-size:1.2em;" onClick="window.confirm("' + gM('edit_cancel_confirm') + '\")" '+ |
259 | | - 'href="javascript:'+this.instance_name+'.closeModEditor()">'+ |
| 256 | + updateSeqSaveButtons:function(){ |
| 257 | + var _this = this; |
| 258 | + var cancel_button = '<a id="mv_cancel_seq_button" href="#" style="border:' + |
| 259 | + 'solid gray;font-size:1.2em;" ">' + |
260 | 260 | gM('edit_cancel') + '</a> '; |
261 | 261 | if( this.sequenceEditToken ){ |
262 | 262 | $j('#'+this.sequence_container_id+'_save_cancel').html( cancel_button + |
— | — | @@ -268,6 +268,15 @@ |
269 | 269 | }else{ |
270 | 270 | $j('#'+this.sequence_container_id+'_save_cancel').html( cancel_button + gM('no_edit_permissions') ); |
271 | 271 | } |
| 272 | + //assing bindings |
| 273 | + $j('#mv_cancel_seq_button').unbind().click(function(){ |
| 274 | + var x = window.confirm( gM('edit_cancel_confirm') ); |
| 275 | + if( x ){ |
| 276 | + _this.closeModEditor(); |
| 277 | + }else{ |
| 278 | + //close request canceled. |
| 279 | + } |
| 280 | + }); |
272 | 281 | }, |
273 | 282 | //display a menu item (hide the rest) |
274 | 283 | disp:function( item ){ |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedVideo/mv_nativeEmbed.js |
— | — | @@ -13,11 +13,10 @@ |
14 | 14 | 'overlays':true, |
15 | 15 | 'playlist_swap_loader':true //if the object supports playlist functions |
16 | 16 | }, |
17 | | - getEmbedHTML : function (){ |
18 | | - var id = (this.pc!=null)?this.pc.pp.id:this.id; |
| 17 | + getEmbedHTML : function (){ |
19 | 18 | var embed_code = this.getEmbedObj(); |
20 | 19 | js_log("embed code: " + embed_code) |
21 | | - setTimeout('$j(\'#' + id + '\').get(0).postEmbedJS()', 150); |
| 20 | + setTimeout('$j(\'#' + this.id + '\').get(0).postEmbedJS()', 150); |
22 | 21 | return this.wrapEmebedContainer( embed_code); |
23 | 22 | }, |
24 | 23 | getEmbedObj:function(){ |
— | — | @@ -81,8 +80,8 @@ |
82 | 81 | //update duration if not set (for now trust the getDuration more than this.vid.duration |
83 | 82 | this.duration = ( this.getDuration() ) ?this.getDuration() : this.vid.duration; |
84 | 83 | |
85 | | - //update currentTime |
86 | | - this.currentTime = this.vid.currentTime; |
| 84 | + //update currentTime |
| 85 | + this.currentTime = this.vid.currentTime; |
87 | 86 | |
88 | 87 | //once currentTime is updated call parent_monitor |
89 | 88 | this.parent_monitor(); |
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedVideo/mv_baseEmbed.js |
— | — | @@ -1775,8 +1775,8 @@ |
1776 | 1776 | */ |
1777 | 1777 | play:function(){ |
1778 | 1778 | var this_id = (this.pc!=null)?this.pc.pp.id:this.id; |
1779 | | - js_log( "mv_embed play:" + this.id); |
1780 | | - js_log('thum disp:'+this.thumbnail_disp); |
| 1779 | + //js_log( "mv_embed play:" + this.id); |
| 1780 | + //js_log('thum disp:'+this.thumbnail_disp); |
1781 | 1781 | //check if thumbnail is being displayed and embed html |
1782 | 1782 | if( this.thumbnail_disp ){ |
1783 | 1783 | if( !this.selected_player ){ |
— | — | @@ -1807,7 +1807,7 @@ |
1808 | 1808 | */ |
1809 | 1809 | pause: function(){ |
1810 | 1810 | var this_id = (this.pc!=null)?this.pc.pp.id:this.id; |
1811 | | - js_log('mv_embed:do pause'); |
| 1811 | + //js_log('mv_embed:do pause'); |
1812 | 1812 | //(playing) do pause |
1813 | 1813 | this.paused=true; |
1814 | 1814 | //update the ctrl "paused state" |