r43337 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r43336‎ | r43337 | r43338 >
Date:00:26, 10 November 2008
Author:dale
Status:old
Tags:
Comment:
updates (basic clip selection, timeline style updates)
Modified paths:
  • /trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_htmlEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_sequencer.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/mv_sequence.css (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_htmlEmbed.js
@@ -82,15 +82,16 @@
8383 var do_refresh = (typeof options['refresh'] != 'undefined')?true:false;
8484
8585 var thumb_render_id = this.id +'_thumb_render_'+ options.height;
86 - if( $j('#' + thumb_render_id ).length == 0 || do_refresh ){
 86+ if( $j('#' + thumb_render_id ).length == 0 || do_refresh ){
8787 //set the font scale down percentage: (kind of arbitrary)
8888 var scale_perc = options.width / this.pc.pp.width;
8989 //js_log('scale_perc:'+options.width + ' / '+ $j(this).width()+ ' = '+scale_perc );
9090 //min scale font percent of 70 (overflow is hidden)
9191 var font_perc = ( Math.round( scale_perc*100 ) < 80 )?80:Math.round( scale_perc*100 );
92 -
 92+ var thumb_class = (typeof options['thumb_class'] !='undefined')? options['thumb_class'] : '';
 93+
9394 $j('body').append( '<div id="' + thumb_render_id + '" style="display:none">'+
94 - '<div class="mv_tl_thumb" style="display:block;border:solid thin black;'+
 95+ '<div class="' + thumb_class + '" style="display:block;border:solid thin black;'+
9596 'width:'+options.width+'px;height:'+options.height+'px;overflow:hidden;" >'+
9697 this.getThumbnailHTML() +
9798 '</div>'+
@@ -124,7 +125,7 @@
125126 js_log('f:html:getEmbedHTML');
126127 //set up the css for our parent div:
127128 $j(this).css({'width':this.pc.pp.width, 'height':this.pc.pp.height, 'overflow':"hidden"});
128 - //@@todo support more smil annimation layout stuff:
 129+ //@@todo support more smil animation layout stuff:
129130
130131 //wrap output in videoPlayer_ div:
131132 $j(this).html('<div id="videoPlayer_'+ this.id+'">'+this.getThumbnailHTML()+'</div>');
@@ -152,12 +153,14 @@
153154 getDuration:function(){
154155 if(this.pc.dur)
155156 return this.pc.dur;
156 - //set duration (depreciated all .duration calls should get from getDuration)
157 - this.duration=pcHtmlEmbedDefaults.dur;
158 - //no dur use default:
 157+ //return default value:
159158 return pcHtmlEmbedDefaults.dur;
 159+ },
 160+ updateVideoTime:function(start_ntp, end_ntp){
 161+ //since we don't really have timeline for html elements just take the delta and set it as the duration
 162+ this.pc.dur = ntp2seconds(end_ntp) - ntp2seconds(start_ntp);
160163 },
161 - //gives a chance to make any neseary external requests
 164+ //gives a chance to make any nesseary external requests
162165 //@@todo we can "start loading images" if we want
163166 on_dom_swap:function(){
164167 this.loading_external_data=false
Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js
@@ -21,9 +21,12 @@
2222 currentTime:0,
2323 duration:0,
2424 userSlide:false,
 25+ pejs_count:0, //post embed js count
 26+
2527 getEmbedHTML : function(){
2628 //give VLC 150ms to initialize before we start playback
2729 //@@todo should be able to do this as an ready event
 30+ this.pejs_count=0;
2831 setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 150);
2932 return this.getEmbedObj();
3033 },
@@ -70,8 +73,13 @@
7174 }
7275 setTimeout('$j(\'#'+this.id+'\').get(0).monitor()',100);
7376 }else{
74 - js_log('vlc not ready');
75 - setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()',100);
 77+ js_log('postEmbedJS:vlc not ready');
 78+ this.pejs_count++;
 79+ if( this.pejs_count < 10 ){
 80+ setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()',100);
 81+ }else{
 82+ js_log('vlc never ready');
 83+ }
7684 }
7785 },
7886 doSeek : function(value){
Index: trunk/extensions/MetavidWiki/skins/mv_embed/skins/mvpcf/mv_sequence.css
@@ -66,14 +66,6 @@
6767 font-family:"verdana","helvetica","arial",sans-serif;
6868 font-size:12px;
6969 }
70 -.mv_time_clip{
71 - position:absolute;
72 - z-index:0;
73 - overflow:hidden;
74 - border:solid thin white;
75 - white-space: nowrap;
76 - height:69px;
77 -}
7870 .mv_clip_cnt{
7971 position:absolute;
8072 width:16px;
@@ -103,7 +95,27 @@
10496 .mv_clip_list_result{
10597 padding:10px;
10698 }
107 -.mv_tl_thumb{
 99+.mv_time_clip{
108100 position:absolute;
109 - top:7px;
 101+ z-index:0;
 102+ overflow:hidden;
 103+ border:solid thin white;
110104 }
 105+.mv_clip_thumb{
 106+ position:absolute;
 107+ top:7px;
 108+ border:solid thin #BBB;
 109+}
 110+.mv_tl_clip{
 111+ position:absolute;
 112+ z-index:0;
 113+ overflow:hidden;
 114+ border:solid thin white;
 115+ white-space: nowrap;
 116+}
 117+.mv_tl_thumb{
 118+ white-space: nowrap;
 119+}
 120+.mv_selected_clip{
 121+ border:solid thin #9F9;
 122+}
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -835,7 +835,8 @@
836836 libs:{},
837837 //to keep consistency across threads:
838838 ptime:0,
839 - ctime:0,
 839+ ctime:0,
 840+ load_error:false,//load error flag (false by default)
840841
841842 load_time:0,
842843 callbacks:new Array(),
@@ -886,6 +887,7 @@
887888 if(loading){
888889 if( this.load_time++ > 2000){ //time out after ~50seconds
889890 js_error( getMsg('error_load_lib') + cur_path);
 891+ this.load_error=true;
890892 }else{
891893 setTimeout('mvJsLoader.doLoad()',25);
892894 }
@@ -2455,7 +2457,8 @@
24562458 var time_ntp = seconds2ntp ( options.time + parseInt(this.start_offset) );
24572459 my_thumb_src = getUpdateTimeURL( my_thumb_src, time_ntp, options.size );
24582460 }
2459 - return '<img class="mv_tl_thumb" src="' + my_thumb_src +'" '+
 2461+ var thumb_class = (typeof options['thumb_class'] !='undefined')? options['thumb_class'] : '';
 2462+ return '<img class="' + thumb_class + '" src="' + my_thumb_src +'" '+
24602463 'style="height:' + options.height + 'px;' +
24612464 'width:' + options.width + 'px" >';
24622465 },
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_sequencer.js
@@ -67,6 +67,9 @@
6868
6969 track_clipThumb_height:80, // how large are the i-movie type clips
7070
 71+ base_adj_duration:.5, //default time to subtract or add when adjusting clips.
 72+
 73+
7174 //Msg are all the language specific values ...
7275 // (@@todo overwrite by msg values preloaded in the page)
7376 //tack/clips can be pushed via json or inline playlist format
@@ -326,7 +329,7 @@
327330 '<div id="container_track_'+i+'" style="top:'+top_pos+'px;height:'+(track_height+2)+'px;left:0px;right:0px;" class="container_track">' +
328331 '</div>'
329332 );
330 - top_pos+=track_height+10;
 333+ top_pos+=track_height+20;
331334 }
332335 }
333336 if( this.timeline_mode=='clip'){
@@ -339,7 +342,7 @@
340343 '<div id="container_track_'+i+'" style="position:absolute;top:'+top_pos+'px;height:'+(track_height+20)+'px;left:10px;right:0px;" class="container_track">' +
341344 '</div>'
342345 );
343 - top_pos+=track_height+10;
 346+ top_pos+=track_height+20;
344347 }
345348 }
346349 },
@@ -510,9 +513,9 @@
511514 '</div>'
512515 );
513516 rewrite_by_id('chop_clip_' + track_inx + '_' + clip_inx );
514 - //add in-out setters
 517+ //@@todo add in-out setters
515518
516 - //add start / end hooks
 519+ //@@todo add start / end hooks
517520
518521 },
519522 //save new clip segment
@@ -555,6 +558,10 @@
556559 //make the adjustments
557560 this.makeAdjustment( editObj );
558561 },
 562+ /*
 563+ * takes adjust ment object with options:
 564+ * track_inx, clip_inx, start, end delta
 565+ */
559566 makeAdjustment:function(e){
560567 switch(e.type){
561568 case 'resize_start':
@@ -565,8 +572,8 @@
566573 break;
567574 }
568575 js_log('re render: '+e.track_inx);
569 - //re-render the video track
570 - this.render_tracks(e.track_inx);
 576+ //refresh the playlist after adjustment
 577+ this.do_refresh_timeline();
571578 },
572579 //@@todo set up key bindings for undo
573580 undoEdit:function(){
@@ -650,9 +657,10 @@
651658 'border:none;'+
652659 'left:'+clip.left_px+'px;'+
653660 'height:' + (this.track_clipThumb_height+20) + 'px;' +
654 - 'width:'+(container_width)+'px;" >';
 661+ 'width:'+(container_width)+'px;" >';
655662 track_html+=clip.embed.renderTimelineThumbnail({
656663 'width':frame_width,
 664+ 'thumb_class':'mv_clip_thumb',
657665 'height':this.track_clipThumb_height,
658666 'time':0
659667 });
@@ -662,6 +670,12 @@
663671 //render out transition edit box
664672 track_html+='<div style="" id="tb_' + base_id + '" class="clip_trans_box"/>';
665673
 674+ //render out adjustment text
 675+ track_html+='<div id="' + base_id + '_adj' + '" style="font-size:small;color:#6F6;display:none;position:absolute;top:'+ (this.track_clipThumb_height+10 )+'px;>'+
 676+ '<span onClick="'+this.instance_name+'.adjClipDur(' + track_id + ',' + j + ',\'-\')" /> - </span>'+
 677+ clip.getDuration() +
 678+ '<span onClick="'+this.instance_name+'.adjClipDur(' + track_id + ',' + j + ',\'+\')" /> + </span>'+
 679+ '</div>';
666680 track_html+='</span>';
667681
668682 }
@@ -669,11 +683,16 @@
670684 if(this.timeline_mode == 'time'){
671685 clip.left_px = Math.round( cur_clip_time/this.timeline_scale);
672686 clip.width_px = Math.round( Math.round( clip.getDuration() )/this.timeline_scale);
673 - js_log('at time:' + cur_clip_time + ' left: ' +clip.left_px + ' clip dur: ' + Math.round( clip.getDuration() ) + ' clip wdith:' + clip.width_px);
 687+ js_log('at time:' + cur_clip_time + ' left: ' +clip.left_px + ' clip dur: ' + Math.round( clip.getDuration() ) + ' clip width:' + clip.width_px);
674688
675689 //for every clip_width pixle output image
676690 if(track.disp_mode=='timeline_thumb'){
677 - track_html+='<span id="track_'+track_id+'_clip_'+j+'" style="left:'+clip.left_px+'px;width:'+clip.width_px+'px;" class="mv_time_clip mv_clip_drag">';
 691+ track_html+='<span id="track_'+track_id+'_clip_'+j+'" '+
 692+ 'class="mv_tl_clip mv_clip_drag" '+
 693+ 'style="'+
 694+ 'left:' + clip.left_px + 'px;'+
 695+ 'width:'+ clip.width_px + 'px;'+
 696+ 'height:'+ clip.height_px + 'px" >';
678697 track_html+= this.render_clip_frames( clip );
679698 }else if(track.disp_mode=='text'){
680699 //'+left_px+
@@ -705,6 +724,20 @@
706725 $j(this).removeClass("clip_edit_over").addClass("clip_edit_base");
707726 });
708727
 728+ //apply onClick edit controls:
 729+ $j('.mv_clip_thumb').click(function(){
 730+ if( $j(this).hasClass("mv_selected_clip") ){
 731+ $j(this).removeClass("mv_selected_clip")
 732+ $j('#' + $j(this).parent().attr("id") + '_adj').fadeOut("fast");
 733+ }else{
 734+ $j(this).addClass('mv_selected_clip');
 735+ $j('#' + $j(this).parent().attr("id") + '_adj').fadeIn("fast");
 736+ }
 737+ });
 738+ //set up key binding "escape" and drag to deselect
 739+
 740+
 741+
709742 //add in control for time based display
710743 //debugger;
711744 if(this.timeline_mode == 'time'){
@@ -853,6 +886,7 @@
854887 js_log('rendering clip frames: p:' +p+' '+ (p*this.timeline_scale)+' ' + clip_time);
855888 clip_frames_html+=clip.embed.renderTimelineThumbnail({
856889 'width': frame_width,
 890+ 'thumb_class':'mv_tl_thumb',
857891 'height': this.track_thumb_height,
858892 'size' : "icon", //set size to "icon" preset
859893 'time': clip_time
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js
@@ -221,7 +221,8 @@
222222 this.doWhenClipLoadDone();
223223 }else{
224224 js_log("only "+ _this.clip_ready_count +" clips done, scheduling callback:");
225 - setTimeout('document.getElementById(\''+this.id+'\').doWhenParseDone()', 250);
 225+ if( !mvJsLoader.load_error ) //re-issue request if no load error:
 226+ setTimeout('document.getElementById(\''+this.id+'\').doWhenParseDone()', 250);
226227 }
227228 },
228229 doWhenClipLoadDone:function(){
@@ -787,8 +788,7 @@
788789 if(clipObj.order==0){
789790 if(!this.cur_clip)this.cur_clip=clipObj;
790791 }
791 - this.default_track.addClip(clipObj, pos);
792 -
 792+ this.default_track.addClip(clipObj, pos);
793793 },
794794 swapClipDesc: function(req_clipID, callback){
795795 //hide all but the requested
@@ -923,7 +923,7 @@
924924
925925 },
926926 doAdjust:function(side, delta){
927 - js_log("f:doAdjust: "+side+ ' , ' + delta);
 927+ js_log("f:doAdjust: " + side + ' , ' + delta);
928928 if(this.embed){
929929 if(side=='start'){
930930 var start_offset =parseInt(this.embed.start_offset)+parseInt(delta*-1);
@@ -932,6 +932,8 @@
933933 var end_offset = parseInt(this.embed.start_offset) + parseInt( this.embed.getDuration() ) + parseInt(delta);
934934 this.embed.updateVideoTime( seconds2ntp(this.embed.start_offset), seconds2ntp(end_offset) );
935935 }
 936+ //update everything:
 937+ this.pp.refresh
936938 /*var base_src = this.src.substr(0,this.src.indexOf('?'));
937939 js_log("delta:"+ delta);
938940 if(side=='start'){

Status & tagging log