Fix typo
[lhc/web/wiklou.git] / js2 / mwEmbed / libEmbedVideo / embedVideo.js
index 7b28872..8bdefe3 100644 (file)
@@ -3,9 +3,9 @@
 */
 
 loadGM({
-       "mwe-loading_plugin" : "loading plugin <blink>...<\/blink>",
+       "mwe-loading_plugin" : "loading plugin ...",
        "mwe-select_playback" : "Set playback preference",
-       "mwe-link_back" : "Link back",  
+       "mwe-link_back" : "Link back",
        "mwe-error_swap_vid" : "Error: mv_embed was unable to swap the video tag for the mv_embed interface",
        "mwe-add_to_end_of_sequence" : "Add to end of sequence",
        "mwe-missing_video_stream" : "The video file for this stream is missing",
@@ -13,28 +13,29 @@ loadGM({
        "mwe-pause_clip" : "Pause clip",
        "mwe-volume_control" : "Volume control",
        "mwe-player_options" : "Player options",
-       "mwe-closed_captions" : "Close captions",
+       "mwe-closed_captions" : "Closed captions",
        "mwe-player_fullscreen" : "Fullscreen",
        "mwe-next_clip_msg" : "Play next clip",
        "mwe-prev_clip_msg" : "Play previous clip",
        "mwe-current_clip_msg" : "Continue playing this clip",
-       "mwe-seek_to" : "Seek to",
+       "mwe-seek_to" : "Seek $1",
+       "mwe-paused" : "paused",
        "mwe-download_segment" : "Download selection:",
        "mwe-download_full" : "Download full video file:",
-       "mwe-download_right_click" : "To download, right click and select <i>Save target as...<\/i>",
+       "mwe-download_right_click" : "To download, right click and select <i>Save link as...<\/i>",
        "mwe-download_clip" : "Download video",
        "mwe-download_text" : "Download text (<a style=\"color:white\" title=\"cmml\" href=\"http:\/\/wiki.xiph.org\/index.php\/CMML\">CMML<\/a> xml):",
        "mwe-download" : "Download",
        "mwe-share" : "Share",
        "mwe-credits" : "Credits",
        "mwe-clip_linkback" : "Clip source page",
-       "mwe-chose_player" : "Choose Video Player",
+       "mwe-chose_player" : "Choose video player",
        "mwe-share_this_video" : "Share this video",
        "mwe-video_credits" : "Video credits",
        "mwe-menu_btn" : "Menu",
        "mwe-close_btn" : "Close",
        "mwe-ogg-player-vlc-mozilla" : "VLC plugin",
-       "mwe-ogg-player-videoElement" : "Native Ogg video support",
+       "mwe-ogg-player-videoElement" : "Native Ogg video",
        "mwe-ogg-player-vlc-activex" : "VLC ActiveX",
        "mwe-ogg-player-oggPlugin" : "Generic Ogg plugin",
        "mwe-ogg-player-quicktime-mozilla" : "QuickTime plugin",
@@ -47,9 +48,11 @@ loadGM({
        "mwe-for_best_experience" : "For a better video playback experience we recommend:<br \/><b><a href=\"http:\/\/www.mozilla.com\/en-US\/firefox\/upgrade.html?from=mwEmbed\">Firefox 3.5<\/a>.<\/b>",
        "mwe-do_not_warn_again" : "Dismiss for now.",
        "mwe-playerselect" : "Players",
-       "mwe-read_before_embed" : "Please read the <a href=\"http:\/\/mediawiki.org\/wiki\/Security_Notes_on_Remote_Embedding\" target=\"_new\">security notes on remote embedding<\/a> before acually embeding!",
-       "mwe-embed_site_or_blog" : "Embed on your site or blog",
-       "mwe_related_videos" : "Related videos"
+       "mwe-read_before_embed" : "<a href=\"http:\/\/mediawiki.org\/wiki\/Security_Notes_on_Remote_Embedding\" target=\"_new\">Read this<\/a> before embedding.",
+       "mwe-embed_site_or_blog" : "Embed on a page",
+       "mwe-related_videos" : "Related videos",
+       "mwe-seeking" : "seeking",
+       "mwe-copy-code" : "Copy code"
 });
 
 //set the globals:
@@ -95,8 +98,6 @@ var default_video_attributes = {
        "embed_link":true,
        "download_link":true,
        "type":null,     //the content type of the media 
-       
-       "skin_name":null //if you want to select a custom skin per video tag. 
 };
 /*
  * the base source attribute checks
@@ -104,6 +105,8 @@ var default_video_attributes = {
 var mv_default_source_attr= new Array(
        'id',
        'src',
+       'apisrc',
+       'titleKey',
        'title',
        'URLTimeEncoding', //boolean if we support temporal url requests on the source media
        'startOffset',
@@ -119,51 +122,52 @@ _global['dismissNativeWarn'] = false;
 * Converts all occurrences of <video> tag into video object
 */
 function mv_video_embed(swap_done_callback, force_id){
+       //check call stack
        mvEmbed.init( swap_done_callback, force_id );
 }
 mvEmbed = {    
        //flist stores the set of functions to run after the video has been swapped in. 
        flist:new Array(),
-       init:function( swap_done_callback, force_id ){
-               
+       init:function( swap_done_callback, force_id ){          
                if(swap_done_callback)
                        mvEmbed.flist.push( swap_done_callback );
                        
                //get mv_embed location if it has not been set
-               js_log('mv_embed ' + MV_EMBED_VERSION);                                         
+               js_log('mv_video_embed:: ' + $mw.version);                                              
                
                var loadPlaylistLib=false;                                              
                
                var eAction = function(this_elm){
                        js_log( "Do SWAP: " + $j(this_elm).attr("id") + ' tag: '+ this_elm.tagName.toLowerCase() );
-                                       
+                                                               
                        if( $j(this_elm).attr("id") == '' ){
-                               $j(this_elm).attr("id", 'v'+ global_player_list.length);
+                               $j(this_elm).attr("id", 'v'+ $mw.player_list.length);
                        }                       
                        //store a global reference to the id    
-                  global_player_list.push( $j(this_elm).attr("id") );
-                  //if video doSwap
-                  switch( this_elm.tagName.toLowerCase()){
-                          case 'video':
-                                   var videoInterface = new embedVideo(this_elm);       
+                       $mw.player_list.push( $j(this_elm).attr("id") );                        
+                       
+                       //if video doSwap
+                       switch( this_elm.tagName.toLowerCase()){
+                               case 'video':
+                                       var videoInterface = new embedVideo(this_elm);   
+                                       mvEmbed.swapEmbedVideoElement( this_elm, videoInterface );
+                               break;
+                               case 'audio':
+                                       var videoInterface = new embedVideo(this_elm);                                          
                                        mvEmbed.swapEmbedVideoElement( this_elm, videoInterface );
-                          break;
-                          case 'audio':
-                                  var videoInterface = new embedVideo(this_elm);        
-                                  videoInterface.type ='audio';
-                                  mvEmbed.swapEmbedVideoElement( this_elm, videoInterface );
-                          break;
-                          case 'playlist':
-                                  loadPlaylistLib=true;
-                          break;
+                               break;
+                               case 'playlist':
+                                       loadPlaylistLib=true;
+                               break;
                   }            
-               }
-               
+               }               
                if( force_id == null && force_id != '' ){
                        var j_selector = 'video,audio,playlist';                                
-               }else{
+               }else{          
                        var j_selector = '#' + force_id;
                }
+               
+               js_log('j_selector:: ' + j_selector);
                //process selected elements: 
                //ie8 does not play well with the jQuery video,audio,playlist selector use native: 
                if($j.browser.msie && $j.browser.version >= 8){
@@ -184,6 +188,7 @@ mvEmbed = {
                                '$j.ui',        //include dialog for pop-ing up thigns
                                '$j.ui.dialog'  
                        ], function(){
+                               //deal with each playlist instance
                                $j('playlist').each(function(){                                                                                                                                                                                                                                                                 
                                        //create new playlist interface:
                                        var plObj = new mvPlayList( this );
@@ -207,8 +212,8 @@ mvEmbed = {
                //make sure our div has a hight/width set:
                        
                $j(embed_video).css({
-                       'width':videoInterface.width,
-                       'height':videoInterface.height
+                       'width' : videoInterface.width,
+                       'height' : videoInterface.height
                }).html( mv_get_loading_img() );                
                //inherit the video interface
                for(var method in videoInterface){ //for in loop oky in Element context 
@@ -242,16 +247,16 @@ mvEmbed = {
                        $j('#'+embed_video.id).get(0).init_with_sources_loaded();
                }
                
-               js_log('done with child: ' + embed_video.id + ' len:' + global_player_list.length);
+               js_log('done with child: ' + embed_video.id + ' len:' + $mw.player_list.length);
                return true;
        },
        //this should not be needed.
        checkClipsReady : function(){
                //js_log('checkClipsReady');
                var is_ready=true;        
-                 for(var i=0; i < global_player_list.length; i++){
-                         if( $j('#'+global_player_list[i]).length !=0){
-                                 var cur_vid =  $j('#'+global_player_list[i]).get(0);            
+                 for(var i=0; i < $mw.player_list.length; i++){
+                         if( $j('#'+$mw.player_list[i]).length !=0){
+                                 var cur_vid =  $j('#'+$mw.player_list[i]).get(0);               
                                is_ready = ( cur_vid.ready_to_play ) ? is_ready : false;
                                if( !is_ready && cur_vid.load_error ){ 
                                        is_ready=true;
@@ -332,7 +337,7 @@ mediaSource.prototype =
                        }
                }                               
                //update duration from hit if present: 
-               if(this.durationHint)
+               if( this.durationHint )
                        this.duration = this.durationHint;              
                                        
                        
@@ -516,7 +521,7 @@ mediaElement.prototype =
                        this.thumbnail = $j(video_element).attr('poster');
                
                if($j(video_element).attr('wikiTitleKey'))
-                       this.wikiTitleKey=$j(video_element).attr('wikiTitleKey');
+                       this.wikiTitleKey = $j(video_element).attr('wikiTitleKey');
                        
                // Process all inner <source> elements  
                //js_log("inner source count: " + video_element.getElementsByTagName('source').length );
@@ -676,28 +681,25 @@ mediaElement.prototype =
        },
        /** Adds a single mediaSource using the provided element if
                the element has a 'src' attribute.              
-               @param element {element} <video>, <source> or <mediaSource> element.
+               @param element {element} <video>, <source> or <mediaSource> <text> element.
        */
        tryAddSource:function(element)
        {
-               js_log('f:tryAddSource:'+ $j(element).attr("src"));             
-               if (! $j(element).attr("src")){
-                       //js_log("element has no src");
-                       return false;
-               }
-               var new_src = $j(element).attr('src');
-               //make sure an existing element with the same src does not already exist:                
-               for( var i=0; i < this.sources.length; i++ ){                           
-                       if(this.sources[i].src == new_src){
-                               //js_log('checking existing: '+this.sources[i].getURI() + ' != '+ new_src);      
-                               //can't add it all but try to update any additional attr: 
-                               this.sources[i].updateSource(element);
-                               return false;
+               js_log('f:tryAddSource:'+ $j(element).attr("src"));                             
+               if ( $j(element).attr("src") ){
+                       var new_src = $j(element).attr('src');
+                       //make sure an existing element with the same src does not already exist:                
+                       for( var i=0; i < this.sources.length; i++ ){                           
+                               if(this.sources[i].src == new_src){
+                                       //js_log('checking existing: '+this.sources[i].getURI() + ' != '+ new_src);      
+                                       //can't add it all but try to update any additional attr: 
+                                       this.sources[i].updateSource(element);
+                               }
                        }
-               }
+               }                               
                var source = new mediaSource( element );                
                this.sources.push(source);              
-               //alert('pushed source to stack'+ source + 'sl:'+this.sources.length);
+               js_log('pushed source to stack'+ source + 'sl:'+this.sources.length);
        },
        getPlayableSources: function(){          
                 var playable_sources= new Array();
@@ -776,7 +778,7 @@ embedVideo.prototype = {
        //for seek thumb updates:
        cur_thumb_seek_time:0,
        thumb_seek_interval:null,
-       
+       //set the default tag type to video:    
        seeking:false,
        //set the buffered percent:     
        bufferedPercent:0,      
@@ -808,23 +810,29 @@ embedVideo.prototype = {
                else
                        return parseInt(this.height);
        },
-       init: function(element){                
-               //this.element_pointer = element;
-               
-               //set the skin name from the config
-               //@@todo support skin as an attribute option
-               this.skin_name = mwConfig['skin_name'];
-               
-               //inherit all the default video_attributes
+       init: function(element){                                                        
+               //inherit all the default video_attributes              
                for(var attr in default_video_attributes){ //for in loop oky on user object
                        if(element.getAttribute(attr)){
-                               this[attr]=element.getAttribute(attr);
-                               //js_log('attr:' + attr + ' val: ' + element.getAttribute(attr) +'(set by elm)');
+                               this[ attr ]=element.getAttribute(attr);
                        }else{
                                this[attr]=default_video_attributes[attr];
-                               //js_log('attr:' + attr + ' val: ' + video_attributes[attr] +" "+ 'elm_val:' + element.getAttribute(attr) + "\n (set by attr)");
                        }
                }
+               
+               //set the skin name from the class  
+               var     sn = element.getAttribute('class');
+               if( sn && sn != ''){
+                       for(var n=0;n< $mw.valid_skins.length;n++){ 
+                               if( sn.indexOf($mw.valid_skins[n]) !== -1){
+                                       this.skin_name = $mw.valid_skins[n];
+                               }
+                       }
+               }
+               //set the default if unset: 
+               if(!this.skin_name)
+                       this.skin_name = $mw.conf.skin_name;
+               
                //make sure startOffset is cast as an int                  
                if( this.startOffset && this.startOffset.split(':').length >= 2)
                        this.startOffset = npt2seconds(this.startOffset);
@@ -836,10 +844,16 @@ embedVideo.prototype = {
                   //make sure duration is in float:  
                this.duration = parseFloat(this.duration);  
                js_log("duration is: " +  this.duration);
-               //if style is set override width and height
-               var dwh = mwConfig['video_size'].split('x');
-               this.width = element.style.width ? element.style.width : dwh[0];
-               this.height = element.style.height ? element.style.height : dwh[1];
+               
+               //get defaults          
+               var dwh = $mw.conf['video_size'].split('x');
+               this.width = element.style.width ? element.style.width : dwh[0];                
+               if( element.tagName == 'AUDIO' ){
+                       this.height = element.style.height ? element.style.height : 0;
+               }else{
+                       this.height = element.style.height ? element.style.height : dwh[1];
+               }                               
+               
                //set the plugin id
                this.pid = 'pid_' + this.id;
 
@@ -855,8 +869,12 @@ embedVideo.prototype = {
                //if we are displaying controls setup the ctrlBuilder  
                if( this.controls ){
                        //set-up the local ctrlBuilder instance: 
-                       this.ctrlBuilder = new ctrlBuilder( this );             
-               }                        
+                       this.ctrlBuilder = new ctrlBuilder( this );
+                       //load the css for the current player
+                                       
+               }                       
+               //load skin:
+               loadExternalCss(  mv_embed_path +  'skins/' + this.skin_name + '/playerSkin.css');
        },
        on_dom_swap: function(){
                js_log('f:on_dom_swap');                                
@@ -999,14 +1017,16 @@ embedVideo.prototype = {
                return true;    
        },
        getTimeReq:function(){
-               var default_time_req = '0:00:00/' + seconds2npt(this.getDuration());
+               var et = (this.ctrlBuilder.long_time_disp)? '/' + seconds2npt( this.getDuration() ) : '';
+               var default_time_req = '0:00:00' + et;
                if(!this.media_element)
                        return default_time_req;
                if(!this.media_element.selected_source)
                        return default_time_req;                
                if(!this.media_element.selected_source.end_ntp)
                        return default_time_req;                
-               return this.media_element.selected_source.start_ntp+'/'+this.media_element.selected_source.end_ntp;
+               var et = (this.ctrlBuilder.long_time_disp) ?'/'+this.media_element.selected_source.end_ntp : '';
+               return this.media_element.selected_source.start_ntp + et;
        },      
        getDuration:function(){                                                 
                //update some local pointers for the selected source:   
@@ -1042,7 +1062,7 @@ embedVideo.prototype = {
                return 'function getEmbedHTML should be overitten by embedLib ';
        },
        //do seek function (should be overwritten by implementing embedLibs)
-       // first check if seek can be done on locally downloaded content. 
+       // to check if seek can be done on locally downloaded content. 
        doSeek : function( perc ){              
                if( this.supportsURLTimeEncoding() ){                   
                        //make sure this.seek_time_sec is up-to-date:
@@ -1061,7 +1081,7 @@ embedVideo.prototype = {
         * (should be overwitten by client that supports frame serving)
         */     
        setCurrentTime:function( time, callback){
-               js_log('error: base embed setCurrentTime can not frame serve (overide via plugin)');
+               js_log('error: base embed setCurrentTime can not frame serve (override via plugin)');
        },
        addPresTimeOffset:function(){
           //add in the offset:         
@@ -1104,7 +1124,7 @@ embedVideo.prototype = {
                    'generator' :       'categories'
                };                              
                var req_categories= new Array();                                                
-           do_api_req( {
+           do_api_req({
                        'data'  : reqObj, 
                        'url'   : commons_api_url
            },  function(data){ 
@@ -1113,9 +1133,11 @@ embedVideo.prototype = {
                                for(var pageid in  data.query.pages){
                                        if(data.query.pages[pageid].title)
                                                req_categories.push(data.query.pages[pageid].title);
-                               }                                               
+                               }
+                               _this.getRelatedFromCat( req_categories );                                              
+                       }else{
+                               _this.doThumbnailHTML();                        
                        }
-                       _this.getRelatedFromCat( req_categories );
                });             
        },
        getRelatedFromCat:function(catAry){
@@ -1162,8 +1184,7 @@ embedVideo.prototype = {
                                                                $j('#dc_'+ _this.id + ' .related_vids ul').append(liout) ;                                                              
                                                        }
                                                 }
-                                       };
-                                       //js_log( 'content: ' + $j('#dc_'+ _this.id + ' .related_vids ul').html() );
+                                       };                                      
                                }); //end do_api_req
                };
        },
@@ -1198,49 +1219,52 @@ embedVideo.prototype = {
                if( this.wikiTitleKey){
                        $j('#dc_'+this.id).append(
                        '<div class="related_vids" >' +
-                          '<h1>' + gM('mwe_related_videos') + '</h1>'+
+                          '<h1>' + gM('mwe-related_videos') + '</h1>'+
                                '<ul>' +
                                '</ul>' +
                        '</div>');      
                        $j('#img_thumb_' + this.id).fadeOut("fast");
                        $j('#dc_'+ _this.id + ' .related_vids ul').html( gM('mwe-loading_txt') );
                        this.mvVideoAudioSearch();
-               }else{
-                       //add the liks_info_div black back 
-                       $j('#dc_'+this.id).append('<div id="liks_info_'+this.id+'" ' +
-                                       'style="width:' +parseInt(parseInt(this.width)/2)+'px;'+                
-                                       'height:'+ parseInt(parseInt(this.height)) +'px;'+
-                                       'position:absolute;top:10px;overflow:auto'+                             
-                                       'width: '+parseInt( ((parseInt(this.width)/2)-15) ) + 'px;'+
-                                       'left:'+ parseInt( ((parseInt(this.width)/2)+15) ) +'px;">'+                                    
-                               '</div>'                                                                        
-                  );
-                  //start animation (make thumb small in upper left add in div for "loading"                   
-                       $j('#img_thumb_'+this.id).animate({                             
-                                       width:parseInt(parseInt(_this.width)/2),
-                                       height:parseInt(parseInt(_this.height)/2),
-                                       top:20,
-                                       left:10
-                               },
-                               1000, 
-                               function(){
-                                       //animation done.. add "loading" to div if empty                
-                                       if($j('#liks_info_'+_this.id).html()==''){
-                                               $j('#liks_info_'+_this.id).html(gM('mwe-loading_txt'));
-                                       }               
-                               }
-                       )                                  
-                       //now load roe if run the showNextPrevLinks
-                       if(this.roe && this.media_element.addedROEData==false){
-                               do_request(this.roe, function(data)
-                               {                                                                                                                          
-                                       _this.media_element.addROE(data);
-                                       _this.getNextPrevLinks();
-                               });     
-                       }else{
-                               this.getNextPrevLinks();
+               }else{          
+                       this.onClipDoneDisp();
+               }                                       
+       },
+       onClipDoneDisp:function(){
+               //add the liks_info_div black back 
+               $j('#dc_'+this.id).append('<div id="liks_info_'+this.id+'" ' +
+                               'style="width:' +parseInt(parseInt(this.width)/2)+'px;'+                
+                               'height:'+ parseInt(parseInt(this.height)) +'px;'+
+                               'position:absolute;top:10px;overflow:auto'+                             
+                               'width: '+parseInt( ((parseInt(this.width)/2)-15) ) + 'px;'+
+                               'left:'+ parseInt( ((parseInt(this.width)/2)+15) ) +'px;">'+                                    
+                       '</div>'                                                                        
+          );
+          //start animation (make thumb small in upper left add in div for "loading"                   
+               $j('#img_thumb_'+this.id).animate({                             
+                               width:parseInt(parseInt(_this.width)/2),
+                               height:parseInt(parseInt(_this.height)/2),
+                               top:20,
+                               left:10
+                       },
+                       1000, 
+                       function(){
+                               //animation done.. add "loading" to div if empty                
+                               if($j('#liks_info_'+_this.id).html()==''){
+                                       $j('#liks_info_'+_this.id).html(gM('mwe-loading_txt'));
+                               }               
                        }
-               }                               
+               )                                  
+               //now load roe if run the showNextPrevLinks
+               if(this.roe && this.media_element.addedROEData==false){
+                       do_request(this.roe, function(data)
+                       {                                                                                                                          
+                               _this.media_element.addROE(data);
+                               _this.getNextPrevLinks();
+                       });     
+               }else{
+                       this.getNextPrevLinks();
+               }               
        },
        //@@todo we should merge getNextPrevLinks with textInterface .. there is repeated code between them. 
        getNextPrevLinks:function(){
@@ -1312,7 +1336,8 @@ embedVideo.prototype = {
                        }
                }else{
                        js_log('no annotative track found');
-                       $j('#liks_info_'+this.id).html('no metadata found for related links');
+                       //$j('#liks_info_'+this.id).html('no metadata found for related links');
+                       _this.doThumbnailHTML();
                }
                //query current request time +|- 60s to get prev next speech links. 
        },
@@ -1402,16 +1427,18 @@ embedVideo.prototype = {
                $j( '#mv_embedded_player_' + this.id ).html( this.getThumbnailHTML() );
                this.paused = true;             
                this.thumbnail_disp = true;
+               //make sure the ctrlBuilder remain active: 
+               this.ctrlBuilder.addControlHooks();     
        },
        refreshControlsHTML:function(){
-               js_log('refreshing controls HTML');
-               if($j('#mv_embedded_controls_'+this.id).length==0)
+               js_log('refreshControlsHTML::');
+               if($j('#' + this.id + ' .control-bar').length == 0)
                {
-                       js_log('#mv_embedded_controls_'+this.id + ' not present, returning');
-                       return;
+                       js_log('control-bar not present, returning');
+                       return ;
                }else{
-                       $j('#mv_embedded_controls_'+this.id).html( this.getControlsHTML() );
-                       this.ctrlBuilder.addControlHooks(this);                                         
+                       $j('#' + this.id + ' .control-bar').html( this.getControlsHTML() );
+                       this.ctrlBuilder.addControlHooks();                                             
                }               
        },   
        getControlsHTML:function()
@@ -1420,34 +1447,34 @@ embedVideo.prototype = {
        },      
        getHTML : function (){          
                //@@todo check if we have sources available     
-               js_log('embedVideo:getHTML : ' + this.id  + ' resource type: ' + this.type);                    
+               js_log('embedVideo:getHTML : ' + this.id  + ' resource type: ' + this.type);
+               
+               //set-up the local ctrlBuilder instance: 
+               this.ctrlBuilder = new ctrlBuilder( this );
+                                               
                var _this = this;                                
                var html_code = '';             
                html_code = '<div id="videoPlayer_' + this.id + '" style="width:' + this.width + 'px;position:relative;"'+ 
                                                'class="' + this.ctrlBuilder.pClass + '">';             
                html_code += '<div style="width:'+parseInt(this.width)+'px;height:'+parseInt(this.height)+'px;"  id="mv_embedded_player_'+this.id+'">' +
                                                this.getThumbnailHTML() + 
-                                       '</div>';                                                                                       
+                                       '</div>';                                                                       
                //js_log("mvEmbed:controls "+ typeof this.controls);                                                                    
                if( this.controls )
-               {
-                       //set-up the local ctrlBuilder instance: 
-                       this.ctrlBuilder = new ctrlBuilder( this );
-                       
+               {               
                        js_log("f:getHTML:AddControls");
-                       html_code +='<div id="mv_embedded_controls_' + this.id + '" class="ui-widget ui-corner-bottom ui-state-default controls" >';
+                       html_code +='<div class="ui-state-default ui-widget-header ui-helper-clearfix control-bar" >';
                        html_code += this.getControlsHTML();       
                        html_code +='</div>';                           
                        //block out some space by encapulating the top level div 
                        $j(this).wrap('<div style="width:'+parseInt(this.width)+'px;height:'
-                                       +( parseInt(this.height) + this.ctrlBuilder.height )+'px"></div>');
-                                                               
+                                       +( parseInt(this.height) + this.ctrlBuilder.height )+'px"></div>');                                                             
                }
                html_code += '</div>'; //videoPlayer div close          
                //js_log('should set: '+this.id);
                $j(this).html( html_code );                                     
                //add hooks once Controls are in DOM
-               this.ctrlBuilder.addControlHooks(this);         
+               this.ctrlBuilder.addControlHooks();             
                                                  
                //js_log('set this to: ' + $j(this).html() );   
                //alert('stop');
@@ -1633,7 +1660,7 @@ embedVideo.prototype = {
        doOptionsHTML:function()
        {
                var sel_id = (this.pc!=null)?this.pc.pp.id:this.id;
-               var pos = $j('#options_button_'+sel_id).offset();
+               var pos = $j('#'+sel_id + ' .options-btn').offset();
                pos['top']=pos['top']+24;
                pos['left']=pos['left']-124;
                //js_log('pos of options button: t:'+pos['top']+' l:'+ pos['left']);
@@ -1643,48 +1670,55 @@ embedVideo.prototype = {
        doLinkBack:function(){
                if(this.roe && this.media_element.addedROEData==false){
                        var _this = this;
-                       this.displayHTML(gM('mwe-loading_txt'));
+                       this.displayHTML( gM('mwe-loading_txt') );
                        do_request(this.roe, function(data)
                           {
                                  _this.media_element.addROE(data);                                                      
                                  _this.doLinkBack();
                           });                     
                }else{
-                       if(this.media_element.linkback){                        
+                       if( this.linkback){
+                               window.location = this.linkback;
+                       }else if(this.media_element.linkback){                  
                                window.location = this.media_element.linkback;
                        }else{
-                               this.displayHTML(gM('mwe-could_not_find_linkback'));
+                               this.displayHTML( gM('mwe-could_not_find_linkback') );
                        }
                }          
        },
-       //display the code to remotely embed this video:
-       showEmbedCode : function(embed_code){
-               if(!embed_code)
-                       embed_code = this.getEmbeddingHTML();
-               var o='';
-               if(this.linkback){
-                       o+='<a class="email" href="'+this.linkback+'">Share Clip via Link</a> '+
-                       '<p>or</p> ';
-               }
-               o+='<div>' +
-                               '<span style="color:#FFF;font-size:14px;">Embed Clip in Blog or Site</span><br>'+
-                               '<span style="color:#FFF;font-size:12px;"><a style="color:red" href="http://metavid.org/wiki/Security_Notes_on_Remote_Embedding">'+
-                                       'Read This</a> before embeding.</span>'+
-                               '<div class="embed_code"> '+
-                                       '<textarea onClick="this.select();" id="embedding_user_html_'+this.id+'" name="embed">' +
-                                               embed_code+
-                                       '</textarea> '+
-                                       '<button onClick="$j(\'#'+this.id+'\').get(0).copyText(); return false;" class="copy_to_clipboard">Copy to Clipboard</button> '+
-                               '</div> '+
-                       '</div>';
-               this.displayHTML(o);
-       },
-       copyText:function(){
-         $j('#embedding_user_html_'+this.id).focus().select();                 
-         if(document.selection){         
-                 CopiedTxt = document.selection.createRange(); 
-                 CopiedTxt.execCommand("Copy");
-         }
+       showShare:function($target){    
+               var     embed_code = this.getEmbeddingHTML();
+               var o = '';
+               var _this = this;
+        //@todo: hook events to two a's for swapping in and out code for link vs. embed;
+        //       hook events for changing active class of li based on a.
+               o+= '<h2>' + gM('mwe-share_this_video') + '</h2>\n' +
+                       ' <ul>\n' +
+                       '  <li><a href="#" class="active">'+gM('mwe-embed_site_or_blog')+'</a></li>\n';
+               if(this.linkback) {
+                       o+=   '  <li><a href="#" id="k-share-link">' + this.linkback + '</a></li>\n';
+        }
+               o+=     '</ul>' +
+                       '<div class="source_wrap"><textarea>' + embed_code + '</textarea></div>' +
+                               '<button class="ui-state-default ui-corner-all copycode">' + gM('mwe-copy-code') + '</button>' +
+                               '<div class="ui-state-highlight ui-corner-all">' + gM('mwe-read_before_embed') + '</div>' +
+                       '</div>'
+               $target.html(o); 
+               $cpBtn = $j( '#' + this.id + ' .copycode');
+               $cpTxt = $j( '#' + this.id + ' .source_wrap textarea');
+               
+               $cpTxt.click(function(){
+                       $j(this).get(0).select();
+               });
+               
+               //add copy binding: 
+               $cpBtn.click(function(){                                                
+                       $cpTxt.focus().get(0).select();                 
+                       if(document.selection){   
+                               CopiedTxt = document.selection.createRange();   
+                               CopiedTxt.execCommand("Copy");
+                       }
+               });
        },
        showTextInterface:function(){   
                var _this = this;
@@ -1692,13 +1726,14 @@ embedVideo.prototype = {
                //@@todo support position config
                var loc = $j(this).position();                  
                if($j('#metaBox_'+this.id).length==0){
+                       var theight =  (parseInt( this.height ) < 200) ? 200 : parseInt( this.height );
                        $j(this).after('<div class="ui-widget ui-widget-content ui-corner-all" style="position:absolute;z-index:10;'+
                                                'top:' + (loc.top) + 'px;' +
-                                               'left:' + (parseInt( loc.left ) + parseInt(this.width) + 10 )+'px;' +
-                                               'height:'+ parseInt( this.height )+'px;width:400px;' +                                          
+                                               'left:' + (parseInt( loc.left ) + parseInt(this.width) + 10 ) + 'px;' +
+                                               'height:' + theight + 'px;width:400px;' +                                               
                                                'display:none;" ' +
                                                'id="metaBox_' + this.id + '">'+
-                                                       gM('mwe-loading_txt') +
+                                                       mv_get_loading_img() +
                                                '</div>');                                      
                }
                //fade in the text display
@@ -1712,11 +1747,7 @@ embedVideo.prototype = {
                                ], function(){                                  
                                        _this.textInterface = new mvTextInterface( _this );                                                     
                                        //show interface
-                                       _this.textInterface.show();
-                                       js_log("NEW TEXT INTERFACE");
-                                       for(var i in _this.textInterface.availableTracks){
-                                               js_log("tracks in new interface: "+_this.id+ ' tid:' + i);                                              
-                                       }
+                                       _this.textInterface.show();                                     
                                }
                        );
                }else{
@@ -1787,134 +1818,115 @@ embedVideo.prototype = {
                 });
                 return false; //onclick action return false
        },
-       selectPlaybackMethod:function(){                
+       showPlayerselect:function( $target ){
                //get id (in case where we have a parent container)
                var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
-               
-               var _this=this;                    
-               var out= '<span style="color:#FFF;background-color:black;"><blockquote style="background-color:black;">';
+               var _this=this;
+               var o= '';
+               o+='<h2>' + gM('mwe-chose_player') + '</h2>';
                var _this=this;
                //js_log('selected src'+ _this.media_element.selected_source.url);
-               $j.each( this.media_element.getPlayableSources(), function(source_id, source){                   
-                       var default_player = embedTypes.players.defaultPlayer( source.getMIMEType() );                                                             
-                       
+               $j.each( this.media_element.getPlayableSources(), function(source_id, source){
+                       var default_player = embedTypes.players.defaultPlayer( source.getMIMEType() );
+
                        var is_selected = (source == _this.media_element.selected_source);
                        var image_src =  mv_skin_img_path ;
-                       
-                       //set the Playable source type: 
-                       if( source.mime_type == 'video/x-flv' ){
-                               image_src += 'flash_icon_';
-                       }else if( source.mime_type == 'video/h264'){
-                               //for now all mp4 content is pulled from archive.org (so use archive.org icon) 
-                               image_src += 'archive_org_';
-                       }else{
-                               image_src += 'fish_xiph_org_';
-                       }
-                       image_src += is_selected ? 'color':'bw';
-                       image_src += '.png';                                       
-                       
-                       if (default_player)
-                       {
-                               out += '<img src="'+image_src+'"/>';
-                               if( ! is_selected )
-                                       out+='<a href="#" class="sel_source" id="sc_' + source_id + '_' + default_player.id +'">';
-                               out += source.getTitle()+ (is_selected?'</a>':'') + ' ';
-                               
-                               //output the player select code: 
-                               var supporting_players = embedTypes.players.getMIMETypePlayers( source.getMIMEType() );         
-                               out+='<div id="player_select_list_' + source_id + '" class="player_select_list"><ul>';
-                               for(var i=0; i < supporting_players.length ; i++){                              
+
+                       if (default_player){
+                               o+='<ul>';
+                               //output the player select code:
+                               var supporting_players = embedTypes.players.getMIMETypePlayers( source.getMIMEType() );
+
+                               for(var i=0; i < supporting_players.length ; i++){
                                        if( _this.selected_player.id == supporting_players[i].id && is_selected ){
-                                               out+='<li style="border-style:dashed;margin-left:20px;">'+
-                                                                       '<img border="0" width="16" height="16" src="' + mv_skin_img_path + 'plugin.png">' +
-                                                                       supporting_players[i].getName() +
-                                                       '</li>';
-                                       }else{
-                                               //else gray plugin and the plugin with link to select
-                                               out+='<li style="margin-left:20px;">'+
-                                                               '<a href="#" class="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id +'">'+
-                                                                       '<img border="0" width="16" height="16" src="' + mv_skin_img_path + 'plugin_disabled.png">'+
-                                                                       supporting_players[i].getName() +
-                                                               '</a>'+
+                                               o+='<li>' +
+                                                       '<a href="#" class="active" rel="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id +'">' +
+                                                               supporting_players[i].getName() +
                                                        '</li>';
+                                       }else{                                  
+                                       o+='<li>' +
+                                                '<a href="#" rel="sel_source" id="sc_' + source_id + '_' + supporting_players[i].id +'">' +
+                                               supporting_players[i].getName() + '</a>' +
+                                               '</li>';
                                        }
                                 }
-                                out+='</ul></div>';               
-                       }else
-                               out+= source.getTitle() + ' - no player available';
+                                o+='</ul>';
+                       }else{
+                               o+= source.getTitle() + ' - no player available';
+                       }
                });
-               out+='</blockquote></span>';
-               this.displayHTML(out);
-               
+               $target.html(o);
+
                //set up the click bindings:
-               $j('.sel_source').each(function(){
+               $target.find("[rel='sel_source']").each(function(){
                        $j(this).click(function(){
                                var iparts = $j(this).attr( 'id' ).replace(/sc_/,'').split('_');
                                var source_id = iparts[0];
                                var default_player_id = iparts[1];
-                               js_log('source id: ' +  source_id + ' player id: ' + default_player_id);                                
-                                
-                               $j('#' + this_id  ).get(0).closeDisplayedHTML();                                
+                               js_log('source id: ' +  source_id + ' player id: ' + default_player_id);
+
+                               $j('#' + this_id  ).get(0).closeDisplayedHTML();
                                $j('#' + _this.id ).get(0).media_element.selectSource( source_id );
-                               
+
                                embedTypes.players.userSelectPlayer( default_player_id,
                                         _this.media_element.sources[ source_id ].getMIMEType() );
-                                        
+
                                //be sure to issue a stop
                                $j('#' + this_id  ).get(0).stop();
-                               
+
                                //don't follow the empty # link:
                                return false;
                        });
                });
        },      
-       showVideoDownload:function(){           
+       showDownload:function( $target ){
+               var _this = this;
                //load the roe if available (to populate out download options:
-               //js_log('f:showVideoDownload '+ this.roe + ' ' + this.media_element.addedROEData);
+               function getShowVideoDownload(){
+                               var out='<div style="color:white">';                                    
+                       var dl_list='';
+                       var dl_txt_list='';             
+                       $j.each(_this.media_element.getSources(), function(index, source){
+                               var dl_line = '<li>' + '<a style="color:white" href="' + source.getURI() +'"> '
+                                       + source.getTitle()+'</a> '+ '</li>'+"\n";                      
+                               if(      source.getURI().indexOf('?t=')!==-1){
+                                       out+=dl_line;
+                               }else if( this.getMIMEType()=="text/cmml" || this.getMIMEType()=="text/x-srt" ){
+                                       dl_txt_list+=dl_line;
+                               }else{
+                                       dl_list+=dl_line;
+                               }
+                       });             
+                       
+                       if(dl_list!='')
+                               out+=gM('mwe-download_full') + '<blockquote style="background:#000">' + dl_list + '</blockquote>';
+                       if(dl_txt_list!='')
+                               out+=gM('mwe-download_text') + '<blockquote style="background:#000">' + dl_txt_list +'</blockquote>';
+                       out+='</div>';
+                       return out;
+               }
+               //js_log('f:showDownload '+ this.roe + ' ' + this.media_element.addedROEData);
                if(this.roe && this.media_element.addedROEData == false){
                        var _this = this;
-                       this.displayHTML(gM('mwe-loading_txt'));
+                       $target.html( gM('loading_txt') );
                        do_request(this.roe, function(data)
                        {
-                          _this.media_element.addROE(data);                                                     
-                          $j('#mv_disp_inner_'+_this.id).html( _this.getShowVideoDownload() );
-                       });                        
+                          _this.media_element.addROE(data);
+                          $target.html( getShowVideoDownload() );
+                       });
                }else{
-                       this.displayHTML( this.getShowVideoDownload() );
-               }          
-       },
-       getShowVideoDownload:function(){ 
-               var out='<div style="color:white">' +
-                               '<b style="color:white;">'+gM('mwe-download_segment')+'</b><br>';
-               out+='<blockquote style="background:#000">'+
-                               gM('mwe-download_right_click') + '</blockquote><br>';
-               var dl_list='';
-               var dl_txt_list='';             
-               $j.each(this.media_element.getSources(), function(index, source){
-                       var dl_line = '<li>' + '<a style="color:white" href="' + source.getURI() +'"> '
-                               + source.getTitle()+'</a> '+ '</li>'+"\n";                      
-                       if(      source.getURI().indexOf('?t=')!==-1){
-                               out+=dl_line;
-                       }else if( this.getMIMEType()=="text/cmml" || this.getMIMEType()=="text/x-srt" ){
-                               dl_txt_list+=dl_line;
-                       }else{
-                               dl_list+=dl_line;
-                       }
-               });             
-               
-               if(dl_list!='')
-                       out+=gM('mwe-download_full') + '<blockquote style="background:#000">' + dl_list + '</blockquote>';
-               if(dl_txt_list!='')
-                       out+=gM('mwe-download_text')+'<blockquote style="background:#000">' + dl_txt_list +'</blockquote>';
-               out+='</div>';
-               return out;
+                       $target.html( getShowVideoDownload() );
+               }
+       },      
+       showCredits:function( $target ){
+               $target.html('<h2>' + gM('mwe-credits') + '</h2>');
        },
        /*
        *  base embed controls
        *       the play button calls
        */
        play:function(){
-               var this_id = (this.pc!=null)?this.pc.pp.id:this.id;
+               var eid = (this.pc!=null)?this.pc.pp.id:this.id;
                                
                //js_log( "mv_embed play:" + this.id);          
                //js_log('thum disp:'+this.thumbnail_disp);
@@ -1937,14 +1949,14 @@ embedVideo.prototype = {
                        this.seeking=false;
                }                               
                
-                $j("#mv_play_pause_button_" + this_id + ' span').removeClass('ui-icon-play').addClass('ui-icon-pause');                           
-                $j("#mv_play_pause_button_" + this_id).unbind().btnBind().click(function(){                                    
-                       $j('#' + this_id ).get(0).pause();
+                $j('#' + eid + ' .play-btn span').removeClass('ui-icon-play').addClass('ui-icon-pause');                          
+                $j('#' + eid + ' .play-btn').unbind().btnBind().click(function(){                                      
+                       $j('#' + eid ).get(0).pause();
                 }).attr('title', gM('mwe-pause_clip'));
                   
        },
        load:function(){
-               //should be done by child (no base way to load assets)
+               //should be done by child (no base way to pre-buffer video)
                js_log('baseEmbed:load call');
        },
        getSrc:function(){
@@ -1956,14 +1968,14 @@ embedVideo.prototype = {
         *  must be overwritten by embed object to support this functionality.
         */
        pause: function(){
-               var this_id = (this.pc!=null)?this.pc.pp.id:this.id;                                                      
+               var eid = (this.pc!=null)?this.pc.pp.id:this.id;                                                          
                //js_log('mv_embed:do pause');          
                //(playing) do pause            
                this.paused = true; 
                //update the ctrl "paused state"                                
-               $j("#mv_play_pause_button_" + this_id + ' span').removeClass('ui-icon-pause').addClass('ui-icon-play');
-               $j("#mv_play_pause_button_" + this_id).unbind().btnBind().click(function(){                                                      
-                               $j('#'+this_id).get(0).play();
+               $j('#' + eid + ' .play-btn span').removeClass('ui-icon-pause').addClass('ui-icon-play');
+                $j('#' + eid + ' .play-btn').unbind().btnBind().click(function(){                                                       
+                               $j('#'+eid).get(0).play();
                }).attr('title', gM('mwe-play_clip'));
        },      
        /*
@@ -2008,17 +2020,15 @@ embedVideo.prototype = {
                        this.update_interval = null;
                }
        },
-       toggleMute:function(){
-               var this_id = (this.pc!=null)?this.pc.pp.id:this.id;    
-               if(this.muted){
-                       this.muted=false;
-                       $j('#volume_control_'+this_id + ' span').removeClass('ui-icon-volume-off').addClass('ui-icon-volume-on');
-                       $j('#volume_bar_'+this_id).slider('value', 100); 
+       toggleMute:function(){  
+               var eid = (this.pc!=null)?this.pc.pp.id:this.id;        
+               if( this.muted ){
+                       this.muted=false;                       
+                       $j('#' + eid + ' .volume-slider').slider('value', 100);
                        this.updateVolumen(1);
                }else{
-                       this.muted=true;
-                       $j('#volume_control_'+this_id + ' span').removeClass('ui-icon-volume-on').addClass('ui-icon-volume-off');
-                       $j('#volume_bar_'+this_id).slider('value', 0);
+                       this.muted=true;                        
+                       $j('#' + eid + ' .volume-slider').slider('value', 0);
                        this.updateVolumen(0); 
                }
                js_log('f:toggleMute::' + this.muted);          
@@ -2057,24 +2067,33 @@ embedVideo.prototype = {
        },
        //do common monitor code like update the playhead and play status 
        //plugin objects are responsible for updating currentTime
-       monitor:function(){             
+       monitor:function(){              
+               //js_log(' ct: ' + this.currentTime + ' dur: ' + ( parseInt( this.duration ) + 1 )  + ' is seek: ' + this.seeking );
                if( this.currentTime && this.currentTime > 0 && this.duration){
-                       if( !this.userSlide ){
+                       if( !this.userSlide && !this.seeking ){
                                if( this.start_offset  ){ 
                                        //if start offset include that calculation 
-                                       this.setSliderValue( ( this.currentTime - this.start_offset ) / this.duration );                        
-                                       this.setStatus( seconds2npt(this.currentTime) + '/'+ seconds2npt(parseFloat(this.start_offset)+parseFloat(this.duration) ));            
+                                       this.setSliderValue( ( this.currentTime - this.start_offset ) / this.duration );
+                                       var et = (this.ctrlBuilder.long_time_disp)? '/'+ seconds2npt(parseFloat(this.start_offset)+parseFloat(this.duration) ) : '';                    
+                                       this.setStatus( seconds2npt(this.currentTime) + et);
                                }else{
                                        this.setSliderValue( this.currentTime / this.duration );
-                                       this.setStatus( seconds2npt(this.currentTime) + '/' + seconds2npt(this.duration ));
+                                       var et = (this.ctrlBuilder.long_time_disp)? '/' + seconds2npt( this.duration ):'';
+                                       this.setStatus( seconds2npt( this.currentTime ) + et);                                  
                                }                               
                        }
+                       //check if we are "done"
+                       if( this.currentTime > ( parseInt(this.duration) + 1 ) ){
+                               js_log("should run clip done");
+                               this.onClipDone();
+                       }                               
                }else{
+                       //media lacks duration just show end time
                        //js_log(' ct:' + this.currentTime + ' dur: ' + this.duration);
                        if( this.isStoped() ){
                                this.setStatus( this.getTimeReq() );
                        }else if( this.isPaused() ){
-                               this.setStatus( "paused" );
+                               this.setStatus( gM('mwe-paused') );                     
                        }else if( this.isPlaying() ){
                                if( this.currentTime && ! this.duration ) 
                                        this.setStatus( seconds2npt( this.currentTime ) + ' /' );
@@ -2084,19 +2103,20 @@ embedVideo.prototype = {
                                this.setStatus( this.getTimeReq() );
                        }                       
                }
+               //could check if time > duration here and stop playback
+               
                //update buffer information 
                this.updateBufferStatus();
-               
-               //check if we passed duration
-               if( this.duration && (this.currentTime > this.duration) ){
-                       this.onClipDone();
-               }
-               
+               var _this = this;
                //update monitorTimerId to call child monitor
                if( ! this.monitorTimerId ){
                        //make sure an instance of this.id exists: 
                        if( document.getElementById(this.id) ){
-                               this.monitorTimerId = setInterval('$j(\'#'+this.id+'\').get(0).monitor()', 250);
+                               this.monitorTimerId = setInterval(function(){
+                                       if(_this.id && $j( '#'+_this.id ).length != 0){
+                                               $j( '#'+_this.id ).get(0).monitor();
+                                       }
+                               }, 250);
                        }
                }
        },              
@@ -2112,7 +2132,7 @@ embedVideo.prototype = {
                //build the buffer targeet based for playlist vs clip 
                var buffer_select = (this.pc) ? 
                        '#cl_status_' + this.id + ' .mv_buffer': 
-                       '#mv_play_head_' + this.id + ' .mv_buffer';
+                       '#' + this.id + ' .play_head .mv_buffer';
                        
                //update the buffer progress bar (if available )
                if( this.bufferedPercent != 0 ){
@@ -2157,17 +2177,17 @@ embedVideo.prototype = {
                return this.media_element.selected_source.URLTimeEncoding;
        },
        setSliderValue: function(perc, hide_progress){  
-               var this_id = (this.pc)?this.pc.pp.id:this.id;
-               if(this.controls && $j( '#mv_play_head_' + this_id).length != 0){                                       
+               var eid = (this.pc)?this.pc.pp.id:this.id;
+               if(this.controls && $j('#' + eid + ' .play_head').length != 0){                                 
                        var val = parseInt( perc*1000 ); 
-                       $j('#mv_play_head_'+this_id).slider('value', val);                              
+                       $j('#' + eid + ' .play_head').slider('value', val);                             
                }
-               //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) );
+               //js_log('set#mv_seeker_slider_'+eid + ' perc in: ' + perc + ' * ' + $j('#mv_seeker_'+eid).width() + ' = set to: '+ val + ' - '+ Math.round(this.mv_seeker_width*perc) );
                //js_log('op:' + offset_perc + ' *('+perc+' * ' + $j('#slider_'+id).width() + ')');
        },
        highlightPlaySection:function(options){
                js_log('highlightPlaySection');
-               var this_id = (this.pc)?this.pc.pp.id:this.id;
+               var eid = (this.pc)?this.pc.pp.id:this.id;
                var dur = this.getDuration();
                var hide_progress = true;               
                //set the left percet and update the slider: 
@@ -2186,6 +2206,7 @@ embedVideo.prototype = {
                        left_perc = parseInt( (rel_start_sec / dur)*100 ) ;             
                        slider_perc = (left_perc / 100);
                }               
+               
                js_log("slider perc:" + slider_perc);   
                if( ! this.isPlaying() ){
                        this.setSliderValue( slider_perc , hide_progress);              
@@ -2196,28 +2217,28 @@ embedVideo.prototype = {
                        width_perc = 100 - left_perc; 
                }               
                //js_log('should hl: '+rel_start_sec+ '/' + dur + ' re:' + rel_end_sec+' lp:'  + left_perc + ' width: ' + width_perc);  
-               $j('#mv_seeker_' + this_id + ' .mv_highlight').css({
-                       'left':left_perc+'%',
-                       'width':width_perc+'%'                  
-               }).show();                              
+               $j('#mv_seeker_' + eid + ' .mv_highlight').css({
+                       'left' : left_perc+'%',
+                       'width' : width_perc+'%'                        
+               }).show();
                
                this.jump_time =  options['start'];
                this.seek_time_sec = npt2seconds( options['start']);
                //trim output to 
-               this.setStatus( gM('mwe-seek_to')+' '+ seconds2npt( this.seek_time_sec ) );
+               this.setStatus( gM('mwe-seek_to', seconds2npt( this.seek_time_sec ) ) );
                js_log('DO update: ' +  this.jump_time);
                this.updateThumbTime( rel_start_sec );  
        },
        hideHighlight:function(){
-               var this_id = (this.pc)?this.pc.pp.id:this.id;
-               $j('#mv_seeker_' + this_id + ' .mv_highlight').hide();
+               var eid = (this.pc)?this.pc.pp.id:this.id;
+               $j('#mv_seeker_' + eid + ' .mv_highlight').hide();
                this.setStatus( this.getTimeReq() );
                this.setSliderValue( 0 );
        },
        setStatus:function(value){
-               var id = (this.pc)?this.pc.pp.id:this.id;
+               var eid = (this.pc)?this.pc.pp.id:this.id;
                //update status:
-               $j('#mv_time_'+id).html(value);
+               $j('#' + eid + ' .time-disp').html(value);
        }       
 }
 
@@ -2325,12 +2346,9 @@ mediaPlayers.prototype =
        },
        addPlayer : function(player, mime_type)
        {               
-               //js_log('Adding ' + player.id + ' with mime_type ' + mime_type);
                for (var i =0; i < this.players.length; i++){
-                       if (this.players[i].id == player.id)
-                       {
-                               if(mime_type!=null)
-                               {
+                       if (this.players[i].id == player.id){
+                               if(mime_type!=null){
                                        //make sure the mime_type is not already there:
                                        var add_mime = true; 
                                        for(var j=0; j < this.players[i].supported_types.length; j++ ){
@@ -2338,15 +2356,16 @@ mediaPlayers.prototype =
                                                        add_mime=false;
                                        }                                       
                                        if(add_mime)
-                                               this.players[i].supported_types.push(mime_type);
+                                               this.players[i].supported_types.push( mime_type );
                                }
-                               return;
+                               return ;
                        }
                }
                //player not found: 
-               if(mime_type!=null)
-                       player.supported_types.push(mime_type);   
-                                
+               if( mime_type != null )
+                       player.supported_types.push(mime_type);
+                                 
+               js_log('Adding ' + player.id + ' with mime_type ' + mime_type);  
                this.players.push( player );
        },
        getMIMETypePlayers : function(mime_type)
@@ -2404,9 +2423,9 @@ mediaPlayers.prototype =
                }
                if( selected_player )
                {
-                       for(var i=0; i < global_player_list.length; i++)
+                       for(var i=0; i < $mw.player_list.length; i++)
                        {
-                               var embed = $j('#'+global_player_list[i]).get(0);
+                               var embed = $j('#'+$mw.player_list[i]).get(0);
                                if(embed.media_element.selected_source && (embed.media_element.selected_source.mime_type == mime_type))
                                {
                                        embed.selectPlayer(selected_player);
@@ -2474,22 +2493,20 @@ var embedTypes = {
                this.players.addPlayer( htmlPlayer );                   
                 // In Mozilla, navigator.javaEnabled() only tells us about preferences, we need to
                 // search navigator.mimeTypes to see if it's installed
-                var javaEnabled = navigator.javaEnabled();
-                // In Opera, navigator.javaEnabled() is all there is
-                var invisibleJava = $j.browser.opera;
+                var javaEnabled = navigator.javaEnabled();                              
                 // Some browsers filter out duplicate mime types, hiding some plugins
-                var uniqueMimesOnly = $j.browser.opera || $j.browser.safari;
+                var uniqueMimesOnly = $j.browser.opera || $j.browser.safari;            
                 // Opera will switch off javaEnabled in preferences if java can't be found.
                 // And it doesn't register an application/x-java-applet mime type like Mozilla does.
-                if ( invisibleJava && javaEnabled )
-                        this.players.addPlayer( cortadoPlayer );
+                if ( javaEnabled )
+                        this.players.addPlayer( cortadoPlayer );                               
                
                 // ActiveX plugins
                 if($j.browser.msie){
-                         // check for flash             
-                          if ( this.testActiveX( 'ShockwaveFlash.ShockwaveFlash')){                               
-                                  //try to get the flash version for omtk include: 
-                                  try {
+                       // check for flash               
+                       if ( this.testActiveX( 'ShockwaveFlash.ShockwaveFlash')){                                  
+                               //try to get the flash version for omtk include: 
+                               try {
                                        a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7");
                                        d = a.GetVariable("$version");  // Will crash fp6.0.21/23/29
                                        if (d) {
@@ -2497,22 +2514,23 @@ var embedTypes = {
                                                //we need flash version 10 or greater:
                                                if(parseInt( d[0]) >=10){
                                                        this.players.addPlayer( omtkPlayer );
-                                               }
-                                               
+                                               }                                       
                                        }                                       
-                               }catch(e) {}                            
-                               
-                                  //flowplayer has pretty good compatiablity 
-                                  // (but if we wanted to be fancy we would check for version of flash and update the mp4/h.264 support
-                                  this.players.addPlayer( flowPlayer );                                   
-                          }
+                               }catch(e) {
+                                       //failed to check for flash
+                               }                               
+                               //flowplayer has pretty good compatiablity 
+                               // (but if we wanted to be fancy we would check for version of flash and update the mp4/h.264 support
+                               this.players.addPlayer( flowPlayer );                              
+                       }
                         // VLC
                         if ( this.testActiveX( 'VideoLAN.VLCPlugin.2' ) )
                                 this.players.addPlayer(vlcActiveXPlayer);
-                        // Java
-                        if ( javaEnabled && this.testActiveX( 'JavaWebStart.isInstalled' ) )
-                                this.players.addPlayer(cortadoPlayer);
-                        // quicktime
+                                
+                        // Java ActiveX
+                        if ( this.testActiveX( 'JavaWebStart.isInstalled' ) )
+                                this.players.addPlayer( cortadoPlayer );
+                        // quicktime (currently off) 
                         //if ( this.testActiveX( 'QuickTimeCheckObject.QuickTimeCheck.1' ) )
                         //     this.players.addPlayer(quicktimeActiveXPlayer);                  
                 }                               
@@ -2542,7 +2560,7 @@ var embedTypes = {
                        }
                }                
                
-                // Mozilla plugins
+                // "navigator" plugins
                if( navigator.mimeTypes && navigator.mimeTypes.length > 0) {
                        for ( var i = 0; i < navigator.mimeTypes.length; i++ ) {
                                var type = navigator.mimeTypes[i].type;
@@ -2561,8 +2579,8 @@ var embedTypes = {
                                        continue;
                                }
                
-                               if ( javaEnabled && type == 'application/x-java-applet' ) {
-                                       this.players.addPlayer(cortadoPlayer);
+                               if ( type == 'application/x-java-applet' ) {
+                                       this.players.addPlayer( cortadoPlayer );
                                        continue;
                                }