r40692 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r40691‎ | r40692 | r40693 >
Date:06:06, 10 September 2008
Author:dale
Status:old
Tags:
Comment:
embed updates for improved player prefrence
Modified paths:
  • /trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.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)

Diff [purge]

Index: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js
@@ -402,6 +402,14 @@
403403 getFLA : function (){
404404 this.fla = this.getPluginEmbed();
405405 },
 406+ stop : function(){
 407+ if (this.monitorTimerId != 0 )
 408+ {
 409+ clearInterval(this.monitorTimerId);
 410+ this.monitorTimerId = 0;
 411+ }
 412+ this.parent_stop();
 413+ },
406414 onStop: function(){
407415 //stop updates:
408416 if( this.monitorTimerId != 0 )
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -184,27 +184,7 @@
185185 mvEmbed.init();
186186 });
187187 });
188 - },
189 - userSetPlayerType:function(player){
190 - //callback to the embedType obj to set the cookie/pref:
191 - embedTypes.userSetPlayerType(player);
192 - //fade out all pref windows and remove:
193 - $j('.set_ogg_player_pref').fadeOut('slow',function(){
194 - $j(this).remove();
195 - });
196 - //@@todo temporarily disable playback or set all to loading...
197 - //request the new player library:
198 -/* var plugins={};
199 - plugins[embedTypes.getPlayerLib()+'Embed']='mv_'+embedTypes.getPlayerLib()+'Embed.js';
200 - mvJsLoader.doLoad(plugins, function(){
201 - js_log("done loading: " + embedTypes.getPlayerLib());
202 - //re-rewrite all the video objects on the page:
203 - for(i in global_ogg_list){
204 - js_log('selector: '+'#'+global_ogg_list[i]);
205 - $j('#'+global_ogg_list[i]).get(0).inheritEmbedObj();
206 - }
207 - })*/
208 - },
 188+ },
209189 addLoadEvent:function(fn){
210190 this.flist.push(fn);
211191 },
@@ -376,8 +356,7 @@
377357 },
378358 getMIMETypePlayers : function(mime_type)
379359 {
380 - var mime_players = new Array();
381 - // @@TODO: optimize this loop
 360+ var mime_players = new Array();
382361 if(this.default_players[mime_type])
383362 for (var d in this.default_players[mime_type])
384363 {
@@ -404,6 +383,10 @@
405384 js_log('No default player found for ' + mime_type);
406385 return null;
407386 },
 387+ userSelectFormat : function (mime_format){
 388+ this.preference['format_prefrence'] = mime_format;
 389+ this.savePreferences();
 390+ },
408391 userSelectPlayer : function(player_id, mime_type)
409392 {
410393 var selected_player=null;
@@ -1418,7 +1401,7 @@
14191402 * @param {String} start_time in NTP format
14201403 * @param {String} end_time in NTP format
14211404 */
1422 - updateSrcTime:function(start_ntp, end_ntp){
 1405+ updateSrcTime:function (start_ntp, end_ntp){
14231406 js_log("f:updateSrcTime: "+ start_ntp+'/'+ end_ntp);
14241407 //js_log("pre uri:" + this.uri);
14251408 //if we have time we can use:
@@ -1590,6 +1573,8 @@
15911574 for(var i in playable_sources){
15921575 if(i==index){
15931576 this.selected_source = playable_sources[i];
 1577+ //update the user prefrence:
 1578+ embedTypes.players.userSelectFormat(playable_sources[i].mime_type);
15941579 break;
15951580 }
15961581 }
@@ -1599,16 +1584,45 @@
16001585 /** selects the default source via cookie preference, default marked, or by id order
16011586 * */
16021587 autoSelectSource:function(){
 1588+ js_log('f:autoSelectSource');
16031589 //@@todo read user preference for source
16041590 // Select the default source
1605 - var playable_sources = this.getPlayableSources();
 1591+ var playable_sources = this.getPlayableSources();
 1592+ var flash_flag=ogg_flag=false;
16061593 for (var source in playable_sources){
 1594+ var mime_type =playable_sources[source].mime_type;
16071595 if(playable_sources[source].marked_default){
16081596 this.selected_source = playable_sources[source];
16091597 return true;
16101598 }
1611 - }
1612 - // select streams that start with 'mv_' first source
 1599+ //set via prefrence
 1600+ if(embedTypes.players.preference['format_prefrence']==mime_type){
 1601+ js_log('set via prefrence: '+playable_sources[source].mime_type);
 1602+ this.selected_source = playable_sources[source];
 1603+ }
 1604+ }
 1605+ //set Ogg via player support:
 1606+ for(var source in playable_sources){
 1607+ var mime_type =playable_sources[source].mime_type;
 1608+ //set source via player
 1609+ if(mime_type=='video/ogg' || mime_type=='ogg/video' || mime_type=='video/annodex'){
 1610+ for(i in embedTypes.players){
 1611+ var player = embedTypes.players[i];
 1612+ if(player.library=='vlc' || player.library=='native'){
 1613+ js_log('setting ogg via order')
 1614+ this.selected_source = playable_sources[source];
 1615+ }
 1616+ }
 1617+ }
 1618+ }
 1619+ //set Flash via player support
 1620+ for(var source in playable_sources){
 1621+ var mime_type =playable_sources[source].mime_type;
 1622+ if(mime_type=='video/x-flv'){
 1623+ this.selected_source = playable_sources[source];
 1624+ }
 1625+ }
 1626+ //select first source
16131627 if (!this.selected_source)
16141628 {
16151629 js_log('autoselecting first source:' + playable_sources[0]);
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js
@@ -490,9 +490,14 @@
491491 //stop current clip
492492 this.cur_clip.embed.stop();
493493 //do swap:
494 - $j('#clipDesc_'+this.cur_clip.id).hide();
 494+ //if transition done (animation_state==2) hide:
 495+ if(this.cur_clip.transOut.animation_state==2)
 496+ $j('#clipDesc_'+this.cur_clip.id).hide();
495497 this.cur_clip=next_clip;
496 - $j('#clipDesc_'+this.cur_clip.id).show();
 498+ //if not already vissable show
 499+ if(!$j('#clipDesc_'+this.cur_clip.id).is(':visible'))
 500+ $j('#clipDesc_'+this.cur_clip.id).show();
 501+
497502 this.cur_clip.embed.play();
498503 }else{
499504 js_log('do next');