r41046 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r41045‎ | r41046 | r41047 >
Date:00:25, 20 September 2008
Author:dale
Status:old
Tags:
Comment:
smil transition updates other minor bug fixes
Modified paths:
  • /trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_nativeEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_oggplayEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_smil.smil.xml (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_smil.smil.xml
@@ -28,7 +28,7 @@
2929 transOut="xFade"
3030 type="video/ogg"
3131 fill="transition"
32 - dur="10s"
 32+ dur="12s"
3333 poster="sample_fish.jpg"/>
3434
3535 <video src="sample_eclipse.ogg?t=0:0:0/0:0:06"
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_nativeEmbed.js
@@ -38,12 +38,12 @@
3939 //@@todo : loading progress
4040 postEmbedJS:function(){
4141 this.getVID();
42 - if(this.vid){
 42+ if(typeof this.vid != 'undefined'){
4343 this.vid.play();
4444 //this.vid.load(); //does not seem to work so well
4545 setTimeout('$j(\'#'+this.id+'\').get(0).monitor()',100);
4646 }else{
47 - js_log('could not grab vid obj:' + typeof this.vid);
 47+ js_log('could not grab vid obj trying again:' + typeof this.vid);
4848 setTimeout('$j(\'#'+this.id+'\').get(0).postEmbedJS()',100);
4949 }
5050 },
@@ -79,8 +79,6 @@
8080 this.setSliderValue(this.currentTime/this.duration );
8181 this.setStatus( seconds2ntp(this.currentTime) + '/'+ seconds2ntp(this.duration ));
8282 }
83 - }else{
84 - this.setStatus('seek to: ' + seconds2ntp(Math.round( (this.sliderVal*this.duration)) ));
8583 }
8684 }
8785 //update load progress if nessisary f
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_oggplayEmbed.js
@@ -35,8 +35,7 @@
3636 },
3737 postEmbedJS:function(){
3838 this.getOggElement();
39 - if(this.controls){
40 - this.activateSlider();
 39+ if(this.controls){
4140 setTimeout('document.getElementById(\''+this.id+'\').monitor()',250);
4241 }
4342 //check if in playlist mode:
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -472,10 +472,10 @@
473473 expiryDate.setTime( expiryDate.getTime() + expiry );
474474 }
475475 document.cookie = name + "=" + escape(value) +
476 - (expiryDate ? ("; expires=" + expiryDate.toGMTString()) : "") +
477 - (path ? ("; path=" + path) : "") +
478 - (domain ? ("; domain=" + domain) : "") +
479 - (secure ? "; secure" : "");
 476+ (expiryDate ? ("; expires=" + expiryDate.toGMTString()) : "") +
 477+ (path ? ("; path=" + path) : "") +
 478+ (domain ? ("; domain=" + domain) : "") +
 479+ (secure ? "; secure" : "");
480480 }
481481
482482 /*
@@ -532,8 +532,8 @@
533533 _this.start_time_sec = (_this.instanceOf == 'mvPlayList')?0:
534534 _this.start_time_sec = ntp2seconds(_this.getTimeReq().split('/')[0]);
535535
536 - js_log('looking for: #mv_seeker_slider_'+_this.id + "\n " +
537 - 'start sec: '+_this.start_time_sec + ' base offset: '+_this.base_seeker_slider_offset);
 536+ //js_log('looking for: #mv_seeker_slider_'+_this.id + "\n " +
 537+ // 'start sec: '+_this.start_time_sec + ' base offset: '+_this.base_seeker_slider_offset);
538538
539539 //buid dragable hook here:
540540 $j('#mv_seeker_slider_'+_this.id).draggable({
@@ -566,7 +566,7 @@
567567 _this.seek_time_sec=ntp2seconds(_this.jump_time);
568568 _this.stop();
569569 //do play in 300ms (give things time to "cool down")
570 - setTimeout('$j(\'#'+_this.id+'\').get(0).play()',300);
 570+ setTimeout('$j(\'#'+_this.id+'\').get(0).play()',300);
571571 }
572572 });
573573 },
@@ -624,7 +624,7 @@
625625 'volume_control':{
626626 'w':22,
627627 'o':function(){
628 - return '<div id="volume_icon_'+ctrlBuilder.id+'" class="volume_icon"><a href="javascript:$j(\'#'+ctrlBuilder.id+'\').get(0).toggleMute();"></a></div>'
 628+ return '<div id="volume_icon_'+ctrlBuilder.id+'" class="volume_icon volume_on"><a href="javascript:$j(\'#'+ctrlBuilder.id+'\').get(0).toggleMute();"></a></div>'
629629 }
630630 },
631631 'time_display':{
@@ -2202,35 +2202,41 @@
22032203 var clip = this.anno_data_cache[clip_id];
22042204 //js_log('on clip:'+ clip_id);
22052205 //set prev_link (if cur_link is still empty)
2206 - if(s_sec < clip.start_time_sec && link.current=='')
 2206+ if( s_sec < clip.start_time_sec && e_sec < clip.start_time_sec && link.prev=='')
22072207 link.prev = clip_id;
22082208
2209 - //clip is encapsulated by the current clip add current link:
2210 - if(s_sec > clip.start_time_sec && e_sec < clip.end_time_sec )
 2209+ //clip is not done e_sec < clip
 2210+ if( s_sec > clip.start_time_sec && e_sec < clip.end_time_sec )
22112211 link.current = clip_id;
22122212
2213 - if(e_sec < clip.start_time_sec && link.next=='')
 2213+ if( e_sec > clip.start_time_sec && link.next=='')
22142214 link.next = clip_id;
22152215 }
22162216 var html='';
22172217 for(var link_type in link){
22182218 var link_id = link[link_type];
22192219 if(link_id!=''){
2220 - var clip = this.anno_data_cache[link_id];
2221 -
 2220+ var clip = this.anno_data_cache[link_id];
22222221 var title_msg='';
22232222 for(var j in clip['meta']){
22242223 title_msg+=j.replace(/_/g,' ') +': ' +clip['meta'][j].replace(/_/g,' ') +" \n";
22252224 }
2226 - var time_req = clip.time_req;
 2225+ var time_req = clip.time_req;
22272226 if(link_type=='current') //if current start from end of current clip play to end of current meta:
2228 - time_req = curTime[1]+ '/' + seconds2ntp(clip.end_time_sec);
 2227+ time_req = curTime[1]+ '/' + seconds2ntp( clip.end_time_sec );
22292228
2230 - html+='<p><a href="#" title="' +title_msg + '" '+
2231 - 'onClick="$j(\'#'+this.id+'\').get(0).playByTimeReq(\''+
2232 - time_req + '\'); return false; ">' +
 2229+ //do special linkbacks for metavid content:
 2230+ var regTimeCheck = new RegExp(/[0-9]+:[0-9]+:[0-9]+\/[0-9]+:[0-9]+:[0-9]+/);
 2231+ html+='<p><a ';
 2232+ if( regTimeCheck.test( this.media_element.linkback ) ){
 2233+ html+=' href="'+ this.media_element.linkback.replace(regTimeCheck,time_req) +'" ';
 2234+ }else{
 2235+ html+=' href="#" onClick="$j(\'#'+this.id+'\').get(0).playByTimeReq(\''+
 2236+ time_req + '\'); return false; "';
 2237+ }
 2238+ html+=' title="' + title_msg + '">' +
22332239 getMsg(link_type+'_clip_msg') +
2234 - '</a></p>';
 2240+ '</a><br><span style="font-size:small">'+ title_msg +'<span></p>';
22352241 }
22362242 }
22372243 //js_log("should set html:"+ html);
@@ -2244,19 +2250,14 @@
22452251 },
22462252 doThumbnailHTML:function()
22472253 {
2248 - js_log('f:doThumbnailHTML');
2249 - js_log('thum disp:'+this.thumbnail_disp);
 2254+ js_log('f:doThumbnailHTML'+ this.thumbnail_disp);
22502255 this.closeDisplayedHTML();
22512256 this.thumbnail_disp = true;
2252 - var embed_code = this.getThumbnailHTML();
2253 -
2254 - //js_log("embed code: " + embed_code);
2255 - if($j('#mv_embedded_player_'+this.id).length==0)
2256 - js_log("can't find mv_embedded_player_"+this.id);
2257 -
2258 - $j('#mv_embedded_player_'+this.id).html(embed_code);
 2257+
 2258+ $j('#mv_embedded_player_'+this.id).html( this.getThumbnailHTML() );
22592259 this.paused = true;
2260 - $j("#mv_play_pause_button_"+this.id).attr('class', 'play_button');
 2260+ if(!this.pc) //if not in playlist mode update the play_pause button:
 2261+ $j("#mv_play_pause_button_"+this.id).attr('class', 'play_button');
22612262 },
22622263 refreshControlsHTML:function(){
22632264 js_log('refreshing controls HTML');
@@ -2407,16 +2408,17 @@
24082409 //if(this.class)class_atr = ' class="'+this.class+'"';
24092410 //if(this.style)style_atr = ' style="'+this.style+'"';
24102411 // else style_atr = 'overflow:hidden;height:'+this.height+'px;width:'+this.width+'px;';
2411 - var thumbnail = this.media_element.getThumbnailURL();
 2412+ var thumbnail_src = this.media_element.getThumbnailURL();
24122413
24132414 //put it all in the div container dc_id
24142415 thumb_html+= '<div id="dc_'+this.id+'" style="position:relative;'+
24152416 ' overflow:hidden; top:0px; left:0px; width:'+this.playerPixelWidth()+'px; height:'+this.playerPixelHeight()+'px; z-index:0;">'+
24162417 '<img width="'+this.playerPixelWidth()+'" height="'+this.playerPixelHeight()+'" style="position:relative;width:'+this.playerPixelWidth()+';height:'+this.playerPixelHeight()+'"' +
2417 - ' id="img_thumb_'+this.id+'" src="' + thumbnail + '">';
 2418+ ' id="img_thumb_'+this.id+'" src="' + thumbnail_src + '">';
24182419
24192420 if(this.play_button==true)
24202421 thumb_html+=this.getPlayButton();
 2422+
24212423 thumb_html+='</div>';
24222424 return thumb_html;
24232425 },
@@ -2690,7 +2692,8 @@
26912693 * base embed controls
26922694 * the play button calls
26932695 */
2694 - play : function(){
 2696+ play: function(){
 2697+ var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
26952698 js_log("mv_embed play:"+this.id);
26962699 js_log('thum disp:'+this.thumbnail_disp);
26972700 //check if thumbnail is being displayed and embed html
@@ -2702,20 +2705,25 @@
27032706 $j('#'+this.id).html(this.getPluginMissingHTML());
27042707 }else{
27052708 this.doEmbedHTML();
2706 - this.onClipDone_disp=false;
 2709+ this.onClipDone_disp=false;
 2710+ this.paused=false;
27072711 }
27082712 }else{
27092713 //the plugin is already being displayed
2710 - js_log("we are already playing" );
 2714+ js_log("we are already playing..." );
27112715 }
 2716+ //update "paused state"
 2717+ $j("#mv_play_pause_button_"+this_id).attr('class', 'pause_button');
27122718 },
2713 - toggleMute:function(){
 2719+ toggleMute:function(){
 2720+ var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
 2721+ js_log('f:toggleMute');
27142722 if(this.muted){
27152723 this.muted=false;
2716 - $j('#volume_icon_'+this.id).removeClass('volume_off').addClass('volume_on');
 2724+ $j('#volume_icon_'+this_id).removeClass('volume_off').addClass('volume_on');
27172725 }else{
27182726 this.muted=true;
2719 - $j('#volume_icon_'+this.id).removeClass('volume_on').addClass('volume_off');
 2727+ $j('#volume_icon_'+this_id).removeClass('volume_on').addClass('volume_off');
27202728 }
27212729 },
27222730 play_or_pause : function(){
@@ -2724,17 +2732,18 @@
27252733
27262734 //check state and set play or pause
27272735 if(this.paused){
2728 - js_log('do play');
2729 - js_log('set : #mv_play_pause_button_'+this_id + ' to pause_button');
2730 - $j("#mv_play_pause_button_"+this_id).attr('class', 'pause_button');
 2736+ //js_log('do play');
27312737 //(paused) do play
27322738 this.play();
27332739 this.paused=false;
 2740+ //update "paused state" onPlay
 2741+ $j("#mv_play_pause_button_"+this_id).attr('class', 'pause_button');
27342742 }else{
27352743 js_log('do pause');
27362744 //(playing) do pause
27372745 this.pause();
2738 - this.paused=true;
 2746+ this.paused=true;
 2747+ //update "paused state"
27392748 $j("#mv_play_pause_button_"+this_id).attr('class', 'play_button');
27402749 }
27412750 },
@@ -2834,41 +2843,17 @@
28352844 return document.embeds[this.pid];
28362845 }
28372846 return null;
2838 - },
2839 - /*activateSlider : function(slider_id){
2840 - var id = (this.pc)?this.pc.pp.id:this.id;
2841 - var thisVid = this;
2842 - this.sliderVal=0;
2843 - //js_log('parent id: '+ parent_id + ' id: ' + this.id);
2844 - $j('#slider_'+id).slider({
2845 - handle:'#playhead_'+id,
2846 - slide:function(e, ui) {
2847 - thisVid.userSlide=true;
2848 - thisVid.sliderVal=( ui.pixel/ ( $j('#slider_'+id).width()-
2849 - $j('#playhead_'+id).width() ));
2850 - //js_log('user slide: ' +thisVid.sliderVal );
2851 - },
2852 - change: function(slider){
2853 - //js_log("change: " + thisVid.sliderVal);
2854 - thisVid.doSeek(thisVid.sliderVal);
2855 - thisVid.userSlide=false;
2856 - }
2857 - });
2858 - //if(!slider_id)slider_id=this.id;
2859 - //get a pointer to this id (as this in onSlide context is not "this")
2860 - /*var parent_id = this.id;
2861 - },*/
 2847+ },
28622848 setSliderValue: function(perc){
2863 - var id = (this.pc)?this.pc.pp.id:this.id;
 2849+ //js_log('setSliderValue:'+perc+' ct:'+ this.currentTime);
 2850+ var this_id = (this.pc)?this.pc.pp.id:this.id;
28642851 //alinment offset:
28652852 if(!this.mv_seeker_width)
2866 - this.mv_seeker_width = $j('#mv_seeker_slider_'+id).width();
 2853+ this.mv_seeker_width = $j('#mv_seeker_slider_'+this_id).width();
28672854
2868 - //js_log('currentTime:'+ this.currentTime);
2869 -
2870 - var val = Math.round( perc * $j('#mv_seeker_'+id).width() - (this.mv_seeker_width*perc));
2871 - $j('#mv_seeker_slider_'+id).css('left', (val)+'px' );
2872 - //js_log('perc in: ' + perc + ' * ' + $j('#mv_seeker_'+id).width() + ' = set to: '+ val + ' - '+ Math.round(this.mv_seeker_width*perc) );
 2855+ var val = Math.round( perc * $j('#mv_seeker_'+this_id).width() - (this.mv_seeker_width*perc));
 2856+ $j('#mv_seeker_slider_'+this_id).css('left', (val)+'px' );
 2857+ //js_log('set#mv_seeker_slider_'+this_id + ' perc in: ' + perc + ' * ' + $j('#mv_seeker_'+this_id).width() + ' = set to: '+ val + ' - '+ Math.round(this.mv_seeker_width*perc) );
28732858 //js_log('op:' + offset_perc + ' *('+perc+' * ' + $j('#slider_'+id).width() + ')');
28742859 },
28752860 setStatus:function(value){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js
@@ -213,16 +213,13 @@
214214 doWhenClipLoadDone:function(){
215215 this.loading=false;
216216 this.getHTML();
217 - },
218 - /*
219 - * @@todo getDuration should replace getDuration
220 - */
 217+ },
221218 getDuration:function(regen){
222219 //js_log("GET PL DURRATION for : "+ this.tracks[this.default_track_id].clips.length + 'clips');
223220 if(!regen && this.pl_duration)
224221 return this.pl_duration;
225222
226 - durSum=0;
 223+ var durSum=0;
227224 $j.each(this.default_track.clips, function(i,clip){
228225 if(clip.embed){
229226 js_log('plDUR:add : '+ clip.getDuration());
@@ -236,11 +233,6 @@
237234 //js_log("return dur: " + this.pl_duration);
238235 return this.pl_duration;
239236 },
240 - getDurationNTP:function(){
241 - //get duration in ms and return in NTP
242 - return seconds2ntp(this.getDuration());
243 - //return 'wtf';
244 - },
245237 getDataSource:function(){
246238 js_log("f:getDataSource "+ this.src);
247239 //determine the type / first is it m3u or xml?
@@ -408,11 +400,12 @@
409401 updateTimeThumb:function(perc){
410402 //get float seconds:
411403 var float_sec = (this.getDuration()*perc)
412 - js_log('float sec:' + float_sec);
 404+ //js_log('float sec:' + float_sec);
413405
414406 //update display & cur_clip:
415407 var pl_sum_time =0;
416408 var clip_float_sec=0;
 409+ //js_log('seeking clip: ');
417410 for(var i in this.default_track.clips){
418411 var clip = this.default_track.clips[i];
419412 if( (clip.getDuration() + pl_sum_time) >= float_sec ){
@@ -425,12 +418,14 @@
426419 }
427420 pl_sum_time+=clip.getDuration();
428421 }
429 - //update start offset (@@todo should probably happen somewhere else like in getDuration() )
 422+ //js_log('found clip: '+ this.cur_clip.id + 'transIn:');
 423+
 424+ //updte start offset (@@todo should probably happen somewhere else like in getDuration() )
430425 if(!this.cur_clip.embed.start_offset)
431426 this.cur_clip.embed.start_offset=this.cur_clip.embed.media_element.selected_source.start_offset;
432427
433428 //render effects ontop:
434 - //issue thumbnail update request: (if plugin supports it will render out frame)
 429+ //issue thumbnail update request: (if plugin supports it will render out frame (if media )
435430 this.cur_clip.embed.updateTimeThumb(perc);
436431
437432 this.cur_clip.embed.currentTime = (float_sec -pl_sum_time)+this.cur_clip.embed.start_offset ;
@@ -440,18 +435,22 @@
441436
442437 },
443438 updateBaseStatus:function(){
444 - js_log('update title');
 439+ js_log('f:updateBaseStatus');
445440 $j('#ptitle_'+this.id).html(''+
446441 '<b>' + this.title + '</b> '+
447442 this.getClipCount()+' clips, <i>'+
448 - this.getDurationNTP() + '</i>' );
 443+ seconds2ntp( this.getDuration() ) + '</i>' );
449444 //update status:
450 - this.cur_clip.embed.setStatus('0:0:00/'+this.getDurationNTP());
 445+ this.setStatus('0:0:00/'+seconds2ntp( this.getDuration() ));
451446 },
452447 /*setStatus overide (could call the jquery directly) */
453448 setStatus:function(value){
454449 $j('#mv_time_'+this.id).html(value);
455450 },
 451+ setSliderValue:function(value){
 452+ //js_log('calling original embed slider with val: '+value);
 453+ this.cur_clip.embed.pe_setSliderValue(value);
 454+ },
456455 /*gets adds hidden desc to the #dc container*/
457456 getAllClipDesc : function(){
458457 //js_log("build all clip details pages");
@@ -533,21 +532,19 @@
534533 //where the plugin supports pre_loading future clips and manage that in javascript
535534 //stop current clip
536535 this.cur_clip.embed.stop();
537 - //do swap:
538 -
539 - //if it has a transOut let it tha transition hide when done
540 - $j('#clipDesc_'+this.cur_clip.id).hide();
541 - this.cur_clip=next_clip;
542 - //if not already vissable show
543 - if(!$j('#clipDesc_'+this.cur_clip.id).is(':visible'))
544 - $j('#clipDesc_'+this.cur_clip.id).show();
545 -
 536+ this.updateCurrentClip(next_clip);
546537 this.cur_clip.embed.play();
547538 }else{
548539 js_log('do next');
549540 this.switchPlayingClip(next_clip);
550541 }
551542 },
 543+ updateCurrentClip:function(new_clip){
 544+ //do swap:
 545+ $j('#clipDesc_'+this.cur_clip.id).hide();
 546+ this.cur_clip=new_clip;
 547+ $j('#clipDesc_'+this.cur_clip.id).show();
 548+ },
552549 prev: function(){
553550 //advance the playhead to the previous clip
554551 var prev_clip = this.getClip(-1);
@@ -559,10 +556,7 @@
560557 //pause current clip
561558 this.cur_clip.embed.pause;
562559 //do swap:
563 - $j('#clipDesc_'+this.cur_clip.id).hide();
564 - this.cur_clip=prev_clip;
565 - $j('#clipDesc_'+this.cur_clip.id).show();
566 -
 560+ this.updateCurrentClip(prev_clip);
567561 this.cur_clip.embed.play();
568562 }else{
569563 js_log('do prev hard embed swap');
@@ -613,9 +607,13 @@
614608 this.cur_clip.embed.play();
615609 }
616610 },
 611+ toggleMute:function(){
 612+ this.cur_clip.embed.toggleMute();
 613+ },
617614 //wrappers for call to pl object to current embed obj
618 - play_or_pause:function(){
619 - this.cur_clip.embed.play_or_pause();
 615+ play_or_pause:function(){
 616+ js_log('pl:play_or_pause');
 617+ this.cur_clip.embed.play_or_pause();
620618 },
621619 fullscreen:function(){
622620 this.cur_clip.embed.fullscreen();
@@ -1236,23 +1234,10 @@
12371235 return this.pe_getPlayButton(this.pc.pp.id);
12381236 },
12391237 setStatus:function(value){
1240 - var plObj = this.pc.pp;
1241 - //only update status if playlist driver otherwise ignore and let master playlist update
1242 - if(this.supports['playlist_driver']){
1243 - //js_log('set status:'+ value);
1244 - var pl_value='On clip ' + (plObj.cur_clip.order+1) + ' of ' + plObj.getClipCount() + '<br>';
1245 - this.pe_setStatus(value);
1246 - }else{
1247 - //js_log("set time via base offset:"+base_dur + ' curTime:'+plObj.cur_clip.embed.currentTime)
1248 - this.pe_setStatus(seconds2ntp(plObj.cur_clip.dur_offset + plObj.cur_clip.embed.currentTime) + '/'+ plObj.getDurationNTP());
1249 - }
 1238+ //status updates hanndled by playlist obj
12501239 },
12511240 setSliderValue:function(value){
1252 - if(!this.userSlide){
1253 - var sliderVal = this.pc.pp.getPlayHeadPos(value);
1254 - //js_log('set slider value:c:'+this.id+' v:'+ value + ' trueVa:'+ sliderVal);
1255 - this.pe_setSliderValue(sliderVal);
1256 - }
 1241+ //setSlider value hanndled by playlist obj
12571242 },
12581243 /*activateSlider:function(){
12591244 //map the slider to the parent playlist slider id:
@@ -1509,6 +1494,17 @@
15101495 var ct = new Date();
15111496 //js_log('mvPlayList:monitor trueTime: '+ ( (ct.getTime() - this.clockStartTime )/1000));
15121497
 1498+ //update the playlist current time:
 1499+ this.currentTime = this.cur_clip.dur_offset + this.cur_clip.embed.currentTime;
 1500+
 1501+ //update status
 1502+ this.setStatus(seconds2ntp(this.currentTime) + '/' + seconds2ntp(this.getDuration()) );
 1503+
 1504+ //update slider:
 1505+ if(!this.userSlide){
 1506+ this.setSliderValue(this.currentTime / this.getDuration());
 1507+ }
 1508+
15131509 //status updates are hanndled by children clips ... playlist just mannages smil actions
15141510 this.doSmilActions();
15151511
@@ -1521,50 +1517,50 @@
15221518 //handles the rendering of overlays loaind of future clips (if nessesary)
15231519 //@@todo could be lazy loaded if nessesary
15241520 mvPlayList.prototype.doSmilActions = function(){
1525 - //js_log('f:doSmilActions: ' + this.cur_clip.embed.currentTime);
 1521+ //js_log('f:doSmilActions: ' + this.cur_clip.id + ' tid: ' + this.cur_clip.transIn.pClip.id );
15261522 var offSetTime = 0; //offset time should let us start a transition later on if we have to.
1527 - _pClip = this.cur_clip;
 1523+ var _clip = this.cur_clip; //setup a local pointer to cur_clip
15281524
1529 -
1530 - //@@todo move some of this out of this loop (ie init should assure .dur
1531 - if(!_pClip.dur)
1532 - _pClip.dur = _pClip.embed.getDuration();
15331525
1534 - //check for duration actions / clip freze mode
1535 - if(_pClip.dur <= _pClip.embed.currentTime && _pClip.order != _pClip.pp.getClipCount()-1 ){
1536 - //force next clip
1537 - js_log('order:' +_pClip.order + ' != count:' + (_pClip.pp.getClipCount()-1) +
1538 - ' smil dur: '+_pClip.dur + ' <= curTime: ' + _pClip.embed.currentTime + ' go to next clip..');
1539 - _pClip.pp.next();
1540 - }
1541 -
1542 - if(_pClip.dur >= _pClip.embed.currentTime ){
1543 - //@@todo freeze-frame on onClipStop
1544 - }
1545 -
1546 - if(_pClip.begin){
1547 - //@@todo do freeze until begin time
1548 - }
 1526+ //do any smil time actions that may change the current clip
 1527+ if(this.userSlide){
 1528+ //current clip set via updateTimeThumb function
 1529+ }else{
 1530+ //assume playing and go to next:
 1531+ if( _clip.dur <= _clip.embed.currentTime
 1532+ && _clip.order != _clip.pp.getClipCount()-1 ){
 1533+ //force next clip
 1534+ js_log('order:' +_clip.order + ' != count:' + (_clip.pp.getClipCount()-1) +
 1535+ ' smil dur: '+_clip.dur + ' <= curTime: ' + _clip.embed.currentTime + ' go to next clip..');
 1536+ //do a _play next:
 1537+ _clip.pp.next();
 1538+ }
 1539+ }
15491540 //@@todo could maybe generalize transIn with trasOut into one "flow" with a few scattered if statements
15501541 //update/setup all transitions (will render current transition state)
15511542 var in_range=false;
1552 - for(trans_id in _pClip.trans){
1553 - js_log("ON TRANS: " + trans_id + _pClip.embed.currentTime);
1554 - tObj = _pClip.trans[trans_id];
1555 - //make sure we are in range:
1556 - if(trans_id=='transIn')
1557 - in_range = (_pClip.embed.currentTime <= _pClip.transIn.dur);
1558 - if(trans_id=='transOut')
1559 - in_range = (_pClip.embed.currentTime >= (_pClip.dur - tObj.dur));
 1543+ //pretty similar actions per transition types so group into a loop:
 1544+ var tran_types = {'transIn':true,'transOut':true};
 1545+ for(var tid in tran_types ){
 1546+ eval('var tObj = _clip.'+tid);
 1547+ if(!tObj)
 1548+ continue;
 1549+ //js_log('f:doSmilActions: ' + _clip.id + ' tid:'+tObj.id + ' tclip_id:'+ tObj.pClip.id);
 1550+ //make sue we are in range:
 1551+ if(tid=='transIn')
 1552+ in_range = (_clip.embed.currentTime <= tObj.dur)?true:false;
15601553
 1554+ if(tid=='transOut')
 1555+ in_range = (_clip.embed.currentTime >= (_clip.dur - tObj.dur))?true:false;
 1556+
15611557 if(in_range){
1562 - if(this.userSlide){
1563 - js_log('user slide update transition state:'+ _pClip.embed.currentTime );
1564 - if(trans_id=='transIn')
1565 - mvTransLib.doUpdate(tObj, (_pClip.embed.currentTime / tObj.dur) );
 1558+ if(this.userSlide){
 1559+ if(tid=='transIn')
 1560+ mvTransLib.doUpdate(tObj, (_clip.embed.currentTime / tObj.dur) );
15661561
1567 - if(trans_id=='transOut')
1568 - mvTransLib.doUpdate(tObj, (_pClip.embed.currentTime-(_pClip.dur - tObj.dur)) /tObj.dur);
 1562+ if(tid=='transOut')
 1563+ mvTransLib.doUpdate(tObj, (_clip.embed.currentTime-(_clip.dur - tObj.dur)) /tObj.dur);
 1564+
15691565 }else{
15701566 if(tObj.animation_state==0){
15711567 js_log('init/run_transition ');
@@ -1575,7 +1571,7 @@
15761572 //close up transition if done & still onDispaly
15771573 if( tObj.overlay_selector_id ){
15781574 js_log('close up transition :'+tObj.overlay_selector_id);
1579 - mvTransLib.doCloseTransition( tObj ) ;
 1575+ mvTransLib.doCloseTransition( tObj );
15801576 }
15811577 }
15821578 }
@@ -1610,10 +1606,9 @@
16111607
16121608 if(!this['type'][tObj.type][tObj.subtype])
16131609 return js_log('mvTransLib does not support subType: '+tObj.subtype);
1614 -
1615 - js_log('setup overlay_selector_id ');
 1610+
16161611 //setup overlay_selector_id
1617 - if(tObj.subtype=='crossfade'){
 1612+ if(tObj.subtype=='crossfade'){
16181613 if(tObj.transAttrType=='transIn')
16191614 var other_pClip = tObj.pClip.pp.getClip(-1);
16201615 if(tObj.transAttrType=='transOut')
@@ -1621,8 +1616,10 @@
16221617
16231618 if(typeof(other_pClip)=='undefined' || other_pClip.id == tObj.pClip.pp.cur_clip.id)
16241619 js_log('Error: crossfade without media asset');
1625 -
1626 - tObj.overlay_selector_id = 'clipDesc_'+other_pClip.id;
 1620+ //if not sliding start playback:
 1621+ if(!tObj.pClip.pp.userSlide)
 1622+ other_pClip.embed.play();
 1623+ tObj.overlay_selector_id = 'clipDesc_'+other_pClip.id;
16271624 }else{
16281625 tObj.overlay_selector_id =this.getOverlaySelector(tObj);
16291626 }
@@ -1634,7 +1631,7 @@
16351632 doCloseTransition:function(tObj){
16361633 if(tObj.subtype=='crossfade'){
16371634 //close up crossfade
1638 - js_log("close up crossfade");
 1635+ js_log("close up crossfade");
16391636 }else{
16401637 $j('#'+tObj.overlay_selector_id).remove();
16411638 }
@@ -1659,7 +1656,18 @@
16601657 //init the transition if nessesary:
16611658 if(!tObj.overlay_selector_id)
16621659 this.doInitTransition(tObj);
 1660+
 1661+ //@@todo we should ensure visability outside of doUpate loop
 1662+ if(!$j('#'+tObj.overlay_selector_id).is(':visible'))
 1663+ $j('#'+tObj.overlay_selector_id).show();
 1664+
16631665 //do update:
 1666+ /*js_log('doing update for: '+ tObj.pClip.id +
 1667+ ' type:' + tObj.transAttrType +
 1668+ ' t_type:'+ tObj.type +
 1669+ ' subypte:'+ tObj.subtype +
 1670+ ' percent:' + percent);*/
 1671+
16641672 this['type'][tObj.type][tObj.subtype].u(tObj,percent);
16651673 },
16661674 /*
@@ -1710,7 +1718,7 @@
17111719 }
17121720 }
17131721 }
1714 -//smile based extension of <video> tag:
 1722+//very limited smile feature set more details soon:
17151723 //region="video_region" transIn="fromGreen" begin="2s"
17161724 //http://www.w3.org/TR/2007/WD-SMIL3-20070713/smil-extended-media-object.html#edef-ref
17171725 var smilPlaylist ={
@@ -1788,7 +1796,6 @@
17891797 );
17901798 //all the overwritten and new methods for playlist extension of mv_embed
17911799 mvSMILClip.prototype = {
1792 - trans:{},//transition object stores transIn and transOut
17931800 init:function(smil_clip_element, mvClipInit){
17941801 _this = this;
17951802
@@ -1816,21 +1823,21 @@
18171824 //lookup and assing copies of transitions
18181825 // (since transition needs to hold some per-instance state info)
18191826 if(this.transIn && this.pp.transitions[this.transIn]){
1820 - this.trans['transIn'] =this.pp.transitions[this.transIn].clone();
1821 - this.trans['transIn'].pClip = _this;
1822 - this.trans['transIn'].transAttrType='transIn';
 1827+ this.transIn = this.pp.transitions[this.transIn].clone();
 1828+ this.transIn.pClip = _this;
 1829+ this.transIn.transAttrType='transIn';
18231830 }
18241831
18251832 if(this.transOut && this.pp.transitions[this.transOut]){
1826 - this.trans['transOut'] = this.pp.transitions[ this.transOut ].clone();
1827 - this.trans['transOut'].pClip = _this;
1828 - this.trans['transOut'].transAttrType = 'transOut';
 1833+ this.transOut = this.pp.transitions[ this.transOut ].clone();
 1834+ this.transOut.pClip = _this;
 1835+ this.transOut.transAttrType = 'transOut';
18291836 }
18301837 //parse duration / begin times:
18311838 if(this.dur)
1832 - this.dur = smilParseTime(this.dur);
1833 -
1834 - //check if the transition is a valid id:
 1839+ this.dur = smilParseTime(this.dur);
 1840+
 1841+ //@@todo check if valid transition id
18351842 return this;
18361843 },
18371844 /*
@@ -1898,8 +1905,7 @@
18991906 * the main animation loop called every MV_ANIMATION_CB_RATE or 34ms ~around 30frames per second~
19001907 */
19011908 run_transition:function(){
1902 - //js_log('f:run_transition:' + this.interValCount);
1903 - //
 1909+ //js_log('f:run_transition:' + this.interValCount);
19041910 //read directly from plugin if avaliable (for native video)
19051911 if(typeof this.pClip.embed.vid !='undefined'){
19061912 this.interValCount=0;
@@ -1909,26 +1915,34 @@
19101916 if(this.prev_curtime!=this.pClip.embed.currentTime){
19111917 this.prev_curtime = this.pClip.embed.currentTime;
19121918 this.interValCount=0;
1913 - }
1914 - }
1915 -
 1919+ }
 1920+ }
19161921 //start_time =assinged by doSmilActions
19171922 //base_cur_time = pClip.embed.currentTime;
1918 - //dur = assinged by attribute
1919 -
 1923+ //dur = assinged by attribute
19201924 if(this.animation_state==0){
19211925 mvTransLib.doInitTransition(this);
19221926 this.animation_state=1;
19231927 }
19241928 //set percetage include difrence of currentTime to prev_curTime
19251929 // ie updated inbetween currentTime updates)
1926 - var percentage = ( (this.pClip.embed.currentTime + ( (this.interValCount*MV_ANIMATION_CB_RATE)/1000) ) ) / this.dur;
19271930
 1931+ if(this.transAttrType=='transIn')
 1932+ var percentage = ( this.pClip.embed.currentTime +
 1933+ ( (this.interValCount*MV_ANIMATION_CB_RATE)/1000 )
 1934+ ) / this.dur ;
 1935+
 1936+ if(this.transAttrType=='transOut')
 1937+ var percentage = (this.pClip.embed.currentTime +
 1938+ ( (this.interValCount*MV_ANIMATION_CB_RATE)/1000 )
 1939+ - (this.pClip.dur - this.dur)
 1940+ ) /this.dur ;
 1941+
19281942 /*js_log('percentage = ct:'+this.pClip.embed.currentTime + ' + ic:'+this.interValCount +' * cb:'+MV_ANIMATION_CB_RATE +
19291943 ' / ' + this.dur + ' = ' + percentage );
19301944 */
19311945
1932 - //js_log('cur percentage: '+percentage);
 1946+ //js_log('cur percentage of transition: '+percentage);
19331947 //update state based on curent time + cur_time_offset (for now just use pClip.embed.currentTime)
19341948 mvTransLib.doUpdate(this, percentage);
19351949