r37323 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r37322‎ | r37323 | r37324 >
Date:16:26, 8 July 2008
Author:stipe
Status:old
Tags:
Comment:
fixed download / plug-in selection / textInterface bugs
Modified paths:
  • /branches/MetavidWiki-exp/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)

Diff [purge]

Index: branches/MetavidWiki-exp/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -335,6 +335,7 @@
336336 // otherwise just return the first compatible player
337337 return mime_players[0];
338338 }
 339+ js_log('No default player found for ' + mime_type);
339340 return null;
340341 },
341342 userSelectPlayer : function(player_id, mime_type)
@@ -865,16 +866,8 @@
866867 this.pe=parentEmbed;
867868 //parse roe if not already done:
868869
869 - //if not "live" or under 5 min load all transcript in one request
870 - if(!this.pe.roe_xml){
871 - js_log("MISSING ROE DATA for text interface");
872 - var _this = this;
873 - this.pe.getParseROE( function(){
874 - _this.textInterface.getParseCMML();
875 - });
876 - }else{
877 - this.getParseCMML();
878 - }
 870+ this.getParseCMML();
 871+
879872 //start the autoscroll timer:
880873 this.setAutoScroll(true);
881874 },
@@ -887,20 +880,20 @@
888881
889882 //@@todo use user-language as key to select transcript layer.
890883 _this = this;
891 - $j.each(this.pe.roe_xml.getElementsByTagName('mediaSource'), function(inx, n){
892 - if(n.getAttribute('content-type')=='text/cmml'){
893 - _this.availableTracks[n.getAttribute('id')] = {
894 - src:n.getAttribute('src'),
895 - title:n.getAttribute('title'),
 884+ $j.each(this.pe.media_element.sources, function(inx, n){
 885+ if(n.mime_type=='text/cmml'){
 886+ _this.availableTracks[n.id] = {
 887+ src:n.uri,
 888+ title:n.title,
896889 loaded:false,
897890 display:false
898891 }
899892 //load or skip the track based on "default" attribute
900 - if(n.getAttribute('default')!='true'){
 893+ if(n.marked_default){
901894 return;
902895 }else{
903896 //load the track if its default track
904 - _this.load_track(n.getAttribute('id'));
 897+ _this.load_track(n.id);
905898 }
906899 }
907900 });
@@ -1148,6 +1141,8 @@
11491142 start_offset:null,
11501143 /** Duration of the requested segment (NaN if not known) */
11511144 duration:NaN,
 1145+
 1146+ id:null,
11521147
11531148 start_ntp:null,
11541149 end_ntp:null,
@@ -1168,6 +1163,8 @@
11691164 this.title = element.getAttribute("title");
11701165 else
11711166 this.title = this.uri;
 1167+ if (element.hasAttribute("id"))
 1168+ this.id = element.getAttribute("id");
11721169
11731170 if (element.hasAttribute('type'))
11741171 this.mime_type = element.getAttribute('type');
@@ -1619,7 +1616,7 @@
16201617 //add direct download link if option:
16211618 if(this.download_link){
16221619 //check for roe attribute (extened download options)
1623 - var dlLink = (this.roe)?'javascript:document.getElementById(\''+this.id+'\').showVideoDownload();':this.src;
 1620+ var dlLink = (this.media_element.sources.length>1)?'javascript:document.getElementById(\''+this.id+'\').showVideoDownload();':this.media_element.sources[0].uri;
16241621 thumb_html+='<div style="border:none;position:absolute;bottom:2px;left:2px;z-index:1">'+
16251622 '<a title="'+getMsg('download_clip')+'" href="'+dlLink+'">';
16261623 thumb_html+=getTransparentPng({id:'lb_'+this.id, width:"27", height:"27", border:"0",
@@ -1763,7 +1760,7 @@
17641761 var select_html='<div id="player_select_list_' + index + '" class="player_select_list"><ul>';
17651762 for(i in supporting_players){
17661763 //put colored plugin icon and no link for supported player:
1767 - if(this.selected_player.library==supporting_players[i].library ){
 1764+ if(embedTypes.players.defaultPlayer(mime_type).id==supporting_players[i].id ){
17681765 select_html+='<li>'+
17691766 '<img border="0" width="16" height="16" src="'+mv_embed_path+'images/plugin.png">'+
17701767 supporting_players[i].getName() +
@@ -1789,9 +1786,12 @@
17901787 var default_player = embedTypes.players.defaultPlayer(source.getMIMEType());
17911788 var source_select_code = 'document.getElementById(\''+_this.id+'\').closeDisplayedHTML(); document.getElementById(\''+_this.id+'\').media_element.selectSource(\''+index+'\');';
17921789 var player_code = _this.getPlayerSelectList(source.getMIMEType(), index, source_select_code);
1793 - return '<a href="#" onClick="' + source_select_code + 'embedTypes.players.userSelectPlayer(\''+default_player.id+'\',\''+source.getMIMEType()+'\'); return false;">'
 1790+ if (default_player)
 1791+ return '<a href="#" onClick="' + source_select_code + 'embedTypes.players.userSelectPlayer(\''+default_player.id+'\',\''+source.getMIMEType()+'\'); return false;">'
17941792 + source.getTitle()+' - ' + default_player.getName() + '</a> '
17951793 + '(<a href="#" onClick=\'$j("#player_select_list_'+index+'").fadeIn("slow");return false;\'>choose player</a>)' + player_code;
 1794+ else
 1795+ return source.getTitle() + ' - no player available';
17961796 });
17971797 this.displayHTML(select_code);
17981798 },

Status & tagging log