
dale at svn
Aug 27, 2008, 2:44 PM
Post #1 of 1
(22 views)
Permalink
|
|
SVN: [40111] trunk/extensions/MetavidWiki/skins/mv_embed
|
|
Revision: 40111 Author: dale Date: 2008-08-27 21:44:57 +0000 (Wed, 27 Aug 2008) Log Message: ----------- updates to mv_embed better support for firefox native video bug fixes Modified Paths: -------------- trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_genericEmbed.js trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_nativeEmbed.js trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_page.php trunk/extensions/MetavidWiki/skins/mv_embed/mv_data_proxy.php trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js Modified: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js =================================================================== --- trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js 2008-08-27 21:37:50 UTC (rev 40110) +++ trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_flashEmbed.js 2008-08-27 21:44:57 UTC (rev 40111) @@ -318,10 +318,17 @@ var flashEmbed = { instanceOf:'flashEmbed', monitorTimerId : 0, - supports: {'play_head':true, 'play_or_pause':true, 'stop':true, 'fullscreen':true, 'time_display':true, 'volume_control':true}, - getPluginEmbedHTML : function (){ + supports: {'play_head':true, + 'play_or_pause':true, + 'stop':true, + 'fullscreen':true, + 'time_display':true, + 'volume_control':true, + 'overlay':false + }, + getEmbedHTML : function (){ setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 150); - return this.getEmbedObj(); + return this.wrapEmebedContainer( this.getEmbedObj() ); }, getEmbedObj:function(){ if(!this.duration)this.duration=30; Modified: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_genericEmbed.js =================================================================== --- trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_genericEmbed.js 2008-08-27 21:37:50 UTC (rev 40110) +++ trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_genericEmbed.js 2008-08-27 21:44:57 UTC (rev 40111) @@ -1,7 +1,7 @@ /* the most simple implementation used for unknown application/ogg plugin */ var genericEmbed={ instanceOf:'genericEmbed', - getEmbedObj:function(){ + getEmbedHTML:function(){ return '<object type="application/ogg" '+ 'width="'+this.width+'" height="'+this.height+'" ' + 'data="' + this.src + '"></object>'; Modified: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_nativeEmbed.js =================================================================== --- trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_nativeEmbed.js 2008-08-27 21:37:50 UTC (rev 40110) +++ trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_nativeEmbed.js 2008-08-27 21:44:57 UTC (rev 40111) @@ -1,22 +1,57 @@ var nativeEmbed = { instanceOf:'nativeEmbed', + canPlayThrough:false, supports: {'play_head':true, 'play_or_pause':true, 'stop':true, 'fullscreen':true, 'time_display':true, 'volume_control':true}, getEmbedHTML : function (){ - setTimeout('document.getElementById(\''+this.id+'\').postEmbedJS()', 150); + setTimeout('$j(\'#'+this.id+'\').get(0).postEmbedJS()', 150); //set a default duration of 30 seconds: cortao should detect duration. - return this.wrapEmebedContainer( this.getEmbedObj() ); + var embed_code = this.getEmbedObj(); + js_log('EMBED CODE: ' + embed_code); + return this.wrapEmebedContainer( embed_code); }, getEmbedObj:function(){ return '<video " ' + - 'id="'+this.pid + '" ' + - 'style="width:'+this.width+';height:'+this.height+';" ' + - 'src="'+this.media_element.selected_source.uri+'" >' + + 'id="'+this.pid + '" ' + + 'style="width:'+this.width+'px;height:'+this.height+'px;" ' + + 'src="'+this.media_element.selected_source.uri+'" ' + + 'controls="false" ' + + 'oncanplaythrough="$j(\'#'+this.id+'\').get(0).oncanplaythrough();return false;" ' + + 'onloadedmetadata="$j(\'#'+this.id+'\').get(0).onloadedmetadata();return false;" >' + '</video>'; }, - postEmbedJS:function(){ - document.getElementById(this.pid).play(); + //@@todo : loading progress + postEmbedJS:function(){ + this.getVID(); + if(this.vid){ + this.vid.load(); + setTimeout('$j(\'#'+this.id+'\').get(0).monitor()',100); + }else{ + js_log('could not grab vid obj:' + typeof this.vid); + setTimeout('$j(\'#'+this.id+'\').get(0).postEmbedJS()',100); + } + }, + monitor : function(){ + this.getVID(); //make shure we have .vid obj + js_log('time loaded: ' + this.vid.TimeRanges() ); + //update load progress and + if( ! this.monitorTimerId ){ + if(document.getElementById(this.id)){ + this.monitorTimerId = setInterval('$j(\'#'+this.id+'\').get(0).monitor()', 1000); + } + } + }, + /* + * native callbacks for the video tag: + */ + oncanplaythrough : function(){ + js_log("f:oncanplaythrough start playback"); + this.play(); }, + onloadedmetadata: function(){ + js_log('f:onloadedmetadata get duration'); + //this. + }, pause : function(){ document.getElementById(this.pid).pause(); }, @@ -26,5 +61,9 @@ }else{ document.getElementById(this.pid).play(); } - } + }, + // get the embed vlc object + getVID : function (){ + this.vid = $j('#'+this.pid).get(0); + } } \ No newline at end of file Modified: trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js =================================================================== --- trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js 2008-08-27 21:37:50 UTC (rev 40110) +++ trunk/extensions/MetavidWiki/skins/mv_embed/embedLibs/mv_vlcEmbed.js 2008-08-27 21:44:57 UTC (rev 40111) @@ -6,12 +6,19 @@ */ var vlcEmbed = { instanceOf:'vlcEmbed', - supports: {'play_head':true, 'play_or_pause':true, 'stop':true, 'fullscreen':true, 'time_display':true, 'volume_control':true}, + supports: {'play_head':true, + 'play_or_pause':true, + 'stop':true, + 'fullscreen':true, + 'time_display':true, + 'volume_control':false, + 'overlay':false + }, //init vars: monitorTimerId : 0, prevState : 0, currentTime:0, - duration:0, + duration:0, userSlide:false, getEmbedHTML : function(){ //give VLC 150ms to initialize before we start playback @@ -92,8 +99,8 @@ var msgtype = msg.type.toString(); if( (msg.severity == 1) && (msgtype == "input") ) { - js_log( msg.message ); - } + js_log( msg.message ); + } } // clear the log once finished to avoid clogging this.vlc.log.messages.clear(); @@ -225,6 +232,7 @@ }, /* js hooks/controls */ play : function(){ + js_log('f:vlcPlay'); this.getVLC(); if(!this.vlc || this.thumbnail_disp){ //call the parent @@ -275,7 +283,7 @@ }, */ // get the embed vlc object - getVLC : function getVLC(){ + getVLC : function(){ this.vlc = this.getPluginEmbed(); } } Modified: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_page.php =================================================================== --- trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_page.php 2008-08-27 21:37:50 UTC (rev 40110) +++ trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_page.php 2008-08-27 21:44:57 UTC (rev 40111) @@ -61,10 +61,9 @@ $sample_embed[3]['desc'] = 'Demo2 of json ROE attribute'; -//$sample_embed[2]['tag'] = '<video id="v2" controls="true" roe="http://mammoth.dnip.net/mvWiki/index.php?title=Special:MvExportStream&feed_format=roe&stream_name=senate_11-14-05&t=0:42:14/0:42:56"></video>'; -//$sample_embed[2]['desc'] = 'video with controls and thumbnail'; +$sample_embed[2]['tag'] = '<video id="v2" controls="true" src="sample_fish.ogg" poster="sample_fish.jpg"></video>'; +$sample_embed[2]['desc'] = 'simple video with controls and thumbnail'; - //playlist tags: $sample_embed[4]['tag'] = '<playlist id="playlist1" width="400" height="300" src="sample_xspf.xml" controls="true" embed_link="true"/>'; @@ -108,7 +107,6 @@ $sample_embed[7]['desc'] = '<b>Inline Playlist:</b> for more info see <a href="http://metavid.ucsc.edu/wiki/index.php/Mv_embed">mv_embed wiki</a> page'; //real video sample: -// $smilURL = 'sample_smil.smil.xml'; $sample_embed[8]['tag']= '<playlist id="smil_pl" src="'.$smilURL.'">'; $sample_embed[8]['desc']=' <br><b>Crossfading Videos</b><br/><a href="http://service.real.com/help/library/guides/realone/ProductionGuide/HTML/htmfiles/transit.htm">source</a> @@ -126,10 +124,11 @@ ?> <table border="1" cellpadding="6" width="600"> <? foreach($sample_embed as $key=>$aval){ - if($key!=8 && $key!=3)continue; + //$key!=8 + if($key!=2)continue; ?> <tr> - <td><?=$aval['tag']?></td> + <td valign="top"><?=$aval['tag']?></td> <td valign="top"><b>Sample Embed <?=$key?></b><br /> <?=$aval['desc']?><br /> <-- code used: <br /> Modified: trunk/extensions/MetavidWiki/skins/mv_embed/mv_data_proxy.php =================================================================== --- trunk/extensions/MetavidWiki/skins/mv_embed/mv_data_proxy.php 2008-08-27 21:37:50 UTC (rev 40110) +++ trunk/extensions/MetavidWiki/skins/mv_embed/mv_data_proxy.php 2008-08-27 21:44:57 UTC (rev 40111) @@ -7,8 +7,9 @@ * (so that remote use of mv_embed can load remote xml ) */ -//NOTE THIS IS DISABLED BY DEFAULT simply comment out the line below to enable; -die('note mv_data_proxy is disabled by default, see var mv_data_proxy in mv_embed.js for more info'); +//NOTE THIS IS DISABLED BY DEFAULT FOR A RESON +//See var mv_data_proxy in mv_embed.js for more info +die('note mv_data_proxy is disabled by default'); if(isset($_POST['url'])){ $req_url = $_POST['url']; Modified: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js =================================================================== --- trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js 2008-08-27 21:37:50 UTC (rev 40110) +++ trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js 2008-08-27 21:44:57 UTC (rev 40111) @@ -39,9 +39,10 @@ var debug_global_vid_ref=null; /* * its best if you just require all your external data sources to serve up json data. - * mv_proxy is not such a good idea from security standpoint but if you know what your doing - * ie mv_data_proxy should not be hosted on domain as with any other web services running... - * you can enable it here ) + * or + * have a limited set of domains that you accept data from + * enabling mv_proxy is not such a good idea from security standpoint but if you know what your doing + * you can enable it here (also you have to uncomment mv_data_proxy die(); line) */ var MV_ENABLE_DATA_PROXY=false; @@ -442,7 +443,7 @@ { var name_value = pairs[i].split('='); this.preference[name_value[0]]=name_value[1]; - js_log('setting preference for ' + name_value[0] + ' to ' + name_value[1]); + js_log('load preference for ' + name_value[0] + ' to ' + name_value[1]); } } }, @@ -903,8 +904,12 @@ js_log('did swap'); $j('#'+embed_video.id).get(0).on_dom_swap(); // now that "embed_video" is stable, do more initialization (if we are ready) - if($j('#'+embed_video.id).get(0).loading_external_data==false) - $j('#'+embed_video.id).get(0).more_init(); + if($j('#'+embed_video.id).get(0).loading_external_data==false && + $j('#'+embed_video.id).get(0).init_with_sources_loadedDone==false){ + js_log("NOT LOADING ext data jump to init with sources"); + $j('#'+embed_video.id).get(0).init_with_sources_loaded(); + } + //js_log(" isd: "+this.init_with_sources_loadedDone + ' ed:' + ) //js_log('vid elm:'+ $j(video_element).html() ); @@ -1582,6 +1587,7 @@ media_element:null, slider:null, loading_external_data:false, + init_with_sources_loadedDone:false, inDOM:false, supports:{}, //utility functions for property values: @@ -1652,16 +1658,17 @@ { //continue _this.media_element.addROE(data); - js_log('added_roe::' + _this.media_element.sources); - _this.more_init(); - js_log('done loading ROE '+_this.thumbnail_disp ) - _this.loading_external_data=false; + js_log('added_roe::' + _this.media_element.sources); + js_log('done loading ROE '+_this.thumbnail_disp ) + _this.init_with_sources_loaded(); + js_log('set loading_external_data=false'); + _this.loading_external_data=false; }); } }, - more_init : function(ready_callback) + init_with_sources_loaded : function(ready_callback) { - js_log('f:more_init'); + js_log('f:init_with_sources_loaded'); //autoseletct the source this.media_element.autoSelectSource(); //auto select player based on prefrence or default order @@ -1683,7 +1690,7 @@ * @@TODO lazy load plugin types * override all relevant exported functions with the {embed_type} Object * place the base functions in parent.{function name} - */ + */ this.inheritEmbedObj(ready_callback); //update HTML @@ -1691,13 +1698,16 @@ //js_log('HTML FROM IN OBJECT' + this.getHTML()); //return this object: - //return this; + //return this; + this.init_with_sources_loadedDone=true; }, selectPlayer:function(player) { var _this = this; - this.selected_player = player; - this.inheritEmbedObj(); + if(this.selected_player.id != player.id){ + this.selected_player = player; + this.inheritEmbedObj(); + } }, getTimeReq:function(){ js_log('f:getTimeReq'); @@ -1717,20 +1727,27 @@ getDurationNTP:function(){ return seconds2ntp(this.getDuration()/1000); }, + /* + * wrapEmebedContainer + * wraps the embed code into a container to better support playlist function + * (where embed element is swapped for next clip + * (where plugin method does not support playlsits) + */ wrapEmebedContainer:function(embed_code){ //check if parent clip is set( ie we are in a playlist so name the embed container by playlistID) var id = (this.pc!=null)?this.pc.pp.id:this.id; return '<div id="mv_ebct_'+id+'" style="width:'+this.width+'px;height:'+this.height+'px;">' + embed_code + '</div>'; - }, + }, getEmbedHTML : function(){ - return this.wrapEmebedContainer( this.getPluginEmbedHTML() ); + //return this.wrapEmebedContainer( this.getEmbedObj() ); + return 'function getEmbedHTML should be overiten by embedLib '; }, doEmbedHTML:function() { js_log('f:doEmbedHTML'); - js_log('thum disp:'+this.thumbnail_disp); + js_log('thum disp:'+this.thumbnail_disp); var _this = this; this.closeDisplayedHTML(); @@ -1904,20 +1921,21 @@ }); }, getHTML : function (){ - //check if we have sources avaliable + //@@todo check if we have sources avaliable js_log('f:getHTML'); var html_code = ''; html_code = '<div style="width:'+this.width+'px;" class="videoPlayer">'; html_code += '<div id="mv_embedded_player_'+this.id+'">' + - this.getThumbnailHTML(); + this.getThumbnailHTML() + '</div>'; if(this.controls) { html_code += '<div id="mv_embedded_controls_'+this.id+'" class="controls">'; - html_code += this.getControlsHTML(); + html_code += this.getControlsHTML(); html_code += '</div>'; + var dlLink = 'javascript:$j(\'#'+this.id+'\').get(0).showVideoDownload();'; var source_link = 'javascript:$j(\'#'+this.id+'\').get(0).selectPlaybackMethod();'; var close_link = '$j(\'#mv_embedded_options_'+this.id+'\').hide();'; @@ -2033,7 +2051,6 @@ js_log("PLAY BUTTON: " + this.play_button); if(this.play_button==true) thumb_html+=this.getPlayButton(); -22 thumb_html+='</div>'; return thumb_html; }, @@ -2365,8 +2382,8 @@ * the play button calls */ play : function(){ - js_log("mv_embed play:"+this.id); - js_log('thum disp:'+this.thumbnail_disp); + js_log("mv_embed play:"+this.id); + js_log('thum disp:'+this.thumbnail_disp); //check if thumbnail is being displayed and embed html if(this.thumbnail_disp){ if(!this.selected_player){ @@ -2435,6 +2452,9 @@ this.update_interval = null; } }, + fullscreen:function(){ + js_log('fullscreen not supported for this plugin type'); + }, /* returns bool true if playing false if paused or stooped */ isPlaying : function(){ Modified: trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js =================================================================== --- trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js 2008-08-27 21:37:50 UTC (rev 40110) +++ trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js 2008-08-27 21:44:57 UTC (rev 40111) @@ -290,8 +290,7 @@ return ; } $j(this).html('<div id="dc_'+this.id+'" style="border:solid thin;width:'+this.width+'px;' + - 'height:'+this.height+'px;position:relative;"></div>'); - + 'height:'+this.height+'px;position:relative;"></div>'); var plObj=this; //append all embed details @@ -1449,12 +1448,19 @@ var smilPlaylist ={ transitions:{}, doParse:function(){ + var _this = this; js_log('do parse smil'+ typeof this.transitions); //@@todo get/parse meta: - + var meta_tags = this.data.getElementsByTagName('meta'); + $j.each(meta_tags, function(i,meta_elm){ + if(meta_elm.hasAttribute('name') && meta_elm.hasAttribute('content')){ + if(meta_elm.getAttribute('name')=='title' ){ + _this.title = meta_elm.getAttribute('content'); + } + } + }); //add transition objects: - var transition_tags = this.data.getElementsByTagName('transition'); - var _this = this; + var transition_tags = this.data.getElementsByTagName('transition'); $j.each(transition_tags, function(i,trans_elm){ if(trans_elm.hasAttribute("id")){ _this.transitions[trans_elm.getAttribute("id")]= new transitionObj(trans_elm); @@ -1463,7 +1469,6 @@ } }); //add seq (latter we will have support than one) - var _this_pl = this; var seq_tags = this.data.getElementsByTagName('seq'); $j.each(seq_tags, function(i,seq_elm){ var inx = 0; @@ -1475,8 +1480,8 @@ //set up basic mvSMILClip send it the mediaElemnt & mvClip init: var cur_clip = new mvSMILClip(mediaElemnt, { - id:'p_' + _this_pl.id + '_c_'+inx, - pp:_this_pl, + id:'p_' + _this.id + '_c_'+inx, + pp:_this, order:inx } ); @@ -1484,7 +1489,7 @@ //set up embed: cur_clip.setUpEmbedObj(); //add clip to track: - _this_pl.addCliptoTrack(cur_clip); + _this.addCliptoTrack(cur_clip); //valid clip up the order inx: inx++; } _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS[at]lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
|