
dale at svn
Aug 19, 2008, 3:02 PM
Post #1 of 1
(45 views)
Permalink
|
|
SVN: [39665] trunk/extensions/MetavidWiki
|
|
Revision: 39665 Author: dale Date: 2008-08-19 22:02:56 +0000 (Tue, 19 Aug 2008) Log Message: ----------- updates to interface styles updates to lazy load ROE file updates to mediaURL handling Modified Paths: -------------- trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php trunk/extensions/MetavidWiki/includes/MV_MagicWords.php trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php trunk/extensions/MetavidWiki/includes/MV_Title.php trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php trunk/extensions/MetavidWiki/languages/MV_Messages.php trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js trunk/extensions/MetavidWiki/skins/mv_embed/mv_vlcEmbed.js trunk/extensions/MetavidWiki/skins/mv_embed/skin/styles.css trunk/extensions/MetavidWiki/skins/mv_stream.js Modified: trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php =================================================================== --- trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php 2008-08-19 21:24:47 UTC (rev 39664) +++ trunk/extensions/MetavidWiki/includes/MV_DefaultSettings.php 2008-08-19 22:02:56 UTC (rev 39665) @@ -91,8 +91,10 @@ $mvVideoArchivePaths['mvprime']= 'http://metavid.ucsc.edu/media/'; $mvVideoArchivePaths['cap1'] = 'http://128.114.20.64/media/'; +//stream msgKeys that support ?t=start_time/end_time temporal url media serving: $mvDefaultVideoQualityKey = 'mv_ogg_low_quality'; $mvDefaultFlashQualityKey = 'mv_flash_low_quality'; +$mvDefaultVideoHighQualityKey = 'mv_ogg_high_quality'; #local path to video archive (if hosted locally) $mvLocalVideoLoc = '/metavid/video_archive'; Modified: trunk/extensions/MetavidWiki/includes/MV_MagicWords.php =================================================================== --- trunk/extensions/MetavidWiki/includes/MV_MagicWords.php 2008-08-19 21:24:47 UTC (rev 39664) +++ trunk/extensions/MetavidWiki/includes/MV_MagicWords.php 2008-08-19 22:02:56 UTC (rev 39665) @@ -158,16 +158,19 @@ $getText=true, $smw_properties=array('Speech_by', 'Bill'), $options=array('limit'=>1) - ); + ); if(count($mvd_rows)!=0){ - $mvd_row = current($mvd_rows); - if($mvd_row->Speech_by){ + reset($mvd_rows); + $mvd_row = current($mvd_rows); + //print_r($mvd_rows); + //print "type of: " . gettype($mvd_row); + if(isset($mvd_row->Speech_by)){ $ptitle = Title::MakeTitle(NS_MAIN, $mvd_row->Speech_by); $o.='<span class="keywords">'. $sk->makeKnownLinkObj($ptitle, $ptitle->getText()). '</span>'; } - if($mvd_row->Bill){ + if(isset($mvd_row->Bill)){ $btitle = Title::MakeTitle(NS_MAIN, $mvd_row->Bill); $o.='<span class="keywords">Bill:'. $sk->makeKnownLinkObj($btitle).' Modified: trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php =================================================================== --- trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php 2008-08-19 21:24:47 UTC (rev 39664) +++ trunk/extensions/MetavidWiki/includes/MV_MetavidInterface/MV_VideoPlayer.php 2008-08-19 22:02:56 UTC (rev 39665) @@ -51,21 +51,22 @@ } $flash_stream_url = $mvTitle->getWebStreamURL($mvDefaultFlashQualityKey); if($flash_stream_url!=''){ - $o.=$coma.' <a href="'.htmlspecialchars($ogg_stream_url).'"> + $o.=$coma.' <a href="'.htmlspecialchars($flash_stream_url).'"> Flash Video </a>'; $coma=', '; } $o.='</span>'; - $o.='<span class="download"><a href="javascript:">More Download Options</a></span>'; + $o.='<span class="download"><a href="javascript:$j(\'#'.htmlspecialchars($this->embed_id).'\').get(0).showVideoDownload()">More Download Options</a></span>'; } $o.='<span class="embed"><a href="javascript:hideShowEmbedCode();">Embed Video</a></span>'. '</p>'; //about file: + $talkPage = Title::newFromText('Anno_en:'.strtolower($mvTitle->wiki_title), MV_NS_MVD_TALK); $o.='<p class="about_file"> <span class="views">Views:'.htmlspecialchars($mvTitle->getViewCount()).'</span> <span class="duration">Duration: '.htmlspecialchars($mvTitle->getSegmentDurationNTP()).'</span> - <span class="comments">na</span> + <span class="comments">'.$sk->makeKnownLinkObj($talkPage, wfMsg('talk')).'</span> </p> </div>'; return $o; Modified: trunk/extensions/MetavidWiki/includes/MV_Title.php =================================================================== --- trunk/extensions/MetavidWiki/includes/MV_Title.php 2008-08-19 21:24:47 UTC (rev 39664) +++ trunk/extensions/MetavidWiki/includes/MV_Title.php 2008-08-19 22:02:56 UTC (rev 39665) @@ -274,13 +274,19 @@ * */ function getWebStreamURL($quality=null){ - global $mvStreamFilesTable, $mvVideoArchivePaths, $mvDefaultVideoQualityKey; + global $mvStreamFilesTable, $mvVideoArchivePaths; + global $mvDefaultVideoQualityKey,$mvDefaultVideoHighQualityKey,$mvDefaultFlashQualityKey; //@@todo mediawiki path for media (insted of hard link to $mvVideoArchive) //@@todo make sure file exisits if(!$quality)$quality=$mvDefaultVideoQualityKey; - $anx_req=''; + $time_req=''; if( $this->getStartTime()!='' && $this->getEndTime()!=''){ - $anx_req ='.anx?t='. $this->getStartTime() . '/' . $this->getEndTime(); + if($quality==$mvDefaultVideoQualityKey || + $quality==$mvDefaultVideoHighQualityKey){ + $time_req ='.anx?t='. $this->getStartTime() . '/' . $this->getEndTime(); + }else if($quality== $mvDefaultFlashQualityKey){ + $time_req ='?t='. $this->getStartTime() . '/' . $this->getEndTime(); + } } if( $this->doesStreamExist() ){ //@@todo cache this / have a more organized store for StreamFiles in streamTitle @@ -297,7 +303,7 @@ $mvStreamFile = new MV_StreamFile($this->mvStream, $streamFile); //if link empty return false: if($mvStreamFile->getFullURL()=='')return false; - return $mvStreamFile->getFullURL() . $anx_req; + return $mvStreamFile->getFullURL() . $time_req; }else{ //@@todo throw ERROR return false; Modified: trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php =================================================================== --- trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php 2008-08-19 21:24:47 UTC (rev 39664) +++ trunk/extensions/MetavidWiki/includes/specials/MV_SpecialExport.php 2008-08-19 22:02:56 UTC (rev 39665) @@ -180,7 +180,8 @@ }*/ //start high level: function get_roe_xml($header=true){ - global $mvDefaultVideoQualityKey, $wgServer; + global $wgServer; + global $mvDefaultVideoQualityKey, $mvDefaultFlashQualityKey,$mvDefaultVideoHighQualityKey; $dbr =& wfGetDB(DB_SLAVE); $this->get_row_data(); @@ -213,7 +214,12 @@ <switch distinction="quality"> <? foreach($this->file_list as $file){ $dAttr=($file->getNameKey()==$mvDefaultVideoQualityKey)?' default="true"':''; - $dSrc=($file->getPathType()=='url_anx')?$this->mvTitle->getWebStreamURL($file->getNameKey()):$file->getFullURL(); + $dSrc=($file->getNameKey() == $mvDefaultVideoQualityKey || + $file->getNameKey() == $mvDefaultFlashQualityKey || + $file->getNameKey() == $mvDefaultVideoHighQualityKey ) + ? $this->mvTitle->getWebStreamURL($file->getNameKey()) + : $file->getFullURL(); + //if not ogg include start and end times in the attribute: //@@todo in the future support client side ogg seeking (and don't automaticly put .anx at the end) $startendattr= (htmlentities($file->getContentType())!='video/ogg')? Modified: trunk/extensions/MetavidWiki/languages/MV_Messages.php =================================================================== --- trunk/extensions/MetavidWiki/languages/MV_Messages.php 2008-08-19 21:24:47 UTC (rev 39664) +++ trunk/extensions/MetavidWiki/languages/MV_Messages.php 2008-08-19 22:02:56 UTC (rev 39665) @@ -17,6 +17,7 @@ #stream/files key descriptions: 'mv_ogg_low_quality' => 'Web streamable - Ogg Theora 300kbs', 'mv_ogg_high_quality' => 'High quality - Ogg Theora 900kbs', + 'mv_flash_low_quality' => 'Web streamable - Flash video', 'mv_archive_org_link' => 'Links into Archive.org mpeg2 originals', 'ao_file_64Kb_MPEG4' => 'Archive.org - mpeg4 64kbs', 'ao_file_256Kb_MPEG4' => 'Archive.org - mpeg4 256kbs', Modified: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js =================================================================== --- trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js 2008-08-19 21:24:47 UTC (rev 39664) +++ trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js 2008-08-19 22:02:56 UTC (rev 39665) @@ -156,7 +156,11 @@ mvJsLoader.doLoad(this.lib_jquery,function(){ //once jQuery is loaded set up no conflict & load plugins: _global['$j'] = jQuery.noConflict(); - js_log('jquery loaded'); + //set up ajax to not send dynamic urls for loading scripts + $j.ajaxSetup({ + cache: true + }); + js_log('jquery loaded'); mvJsLoader.doLoad(_this.lib_plugins, function(){ js_log('plugins loaded'); mvEmbed.libs_loaded=true; @@ -228,8 +232,7 @@ supported_types:null, library:null, loaded:false, - loading_callbacks:null, - + loading_callbacks:null, supportsMIMEType : function(type) { for (var i in this.supported_types) @@ -241,14 +244,6 @@ { return getMsg('ogg-player-' + this.id); }, - getLibraryFile : function() - { - return 'mv_'+this.library+'Embed.js'; - }, - getLibraryObject : function() - { - return this.library+'Embed'; - }, load : function(callback) { if(this.loaded) @@ -262,12 +257,13 @@ this.loading_callbacks.push(callback); if(this.loading_callbacks.length==1) { - js_log('requesting plugin: ' + mv_embed_path + this.getLibraryFile()); + js_log('requesting plugin: ' + mv_embed_path + 'mv_'+this.library+'Embed.js'); var _this = this; - $j.getScript(mv_embed_path + _this.getLibraryFile(), function() - { + //swaped for doLoad so that we use cache + // getScript has cache disabled for some reason (probably could be set up at init to cache) + $j.getScript(mv_embed_path + 'mv_'+_this.library+'Embed.js', function(){ js_log(_this.id + ' plugin loaded'); - _this.loaded = true; + _this.loaded = true; for(var i in _this.loading_callbacks) _this.loading_callbacks[i](); _this.loading_callbacks = null; @@ -570,19 +566,20 @@ libreq:{}, load_time:0, doLoad:function(libs,callback){ - if(libs){this.libs=libs;}else{libs=this.libs;} + this.libs = libs; this.callback=(callback)?callback:this.callback; var loading=0; var i=null; //js_log("doLoad_ load set to 0 on libs:"+ libs); for(i in libs){ + //if(i=='vlcEmbed')alert('got called with '+i+' ' + typeof(vlcEmbed)); //itor the objPath (to avoid 'has no properties' errors) var objPath = i.split('.'); var cur_path =''; var cur_load=0; for(p in objPath){ cur_path = (cur_path=='')?cur_path+objPath[p]:cur_path+'.'+objPath[p]; - //js_log("looking at path: "+ cur_path); + //if(i=='vlcEmbed')alert("looking at path: "+ cur_path); //js_log("eval: " + eval('typeof ('+cur_path+');')); if(eval('typeof '+cur_path)=='undefined'){ cur_load = loading=1; @@ -1107,11 +1104,6 @@ getMenu:function(){ var out=''; //add in loading icon: - /* - out+= '<div class="mv_loading_icon" style="background:url(\''+mv_embed_path+'images/indicator.gif\');display:'; - out+= (this.roe_xml)? 'none':'inline'; - out+='"/>'; - */ var as_checked = (this.autoscroll)?'checked':''; out+= '<div id="mmenu_'+this.pe.id+'" style="background:#AAF;font-size:small;position:absolute;top:0;height:20px;left:0px;right:0px;">' + '<a style="font-color:#000;" title="'+getMsg('close')+'" href="#" onClick="document.getElementById(\''+this.pe.id+'\').closeTextInterface();return false;">'+ @@ -1287,7 +1279,8 @@ */ detectType:function(uri) { - //@@todo if media is on the same server as the javascript we can issue a HEAD request and read the mime type of the media... + //@@todo if media is on the same server as the javascript or we have mv_proxy configured + //we can issue a HEAD request and read the mime type of the media... // (this will detect media mime type independently of the url name) //http://www.jibbering.com/2002/4/httprequest.html (this should be done by extending jquery's ajax objects) switch(uri.substr(uri.lastIndexOf('.'),4)){ @@ -1316,6 +1309,7 @@ sources:null, /** Playable sources **/ playable_sources:null, + addedROEData:false, /** Selected mediaSource element. */ selected_source:null, thumbnail:null, @@ -1407,13 +1401,22 @@ return mime_type=='video/ogg' || mime_type=='video/annodex' || mime_type=='video/x-flv'; }, /** Adds a single mediaSource using the provided element if - the element has a 'src' attribute. + the element has a 'src' attribute. @param element {element} <video>, <source> or <mediaSource> element. */ tryAddSource:function(element) { if (!element.hasAttribute('src')) return; + var new_src = element.getAttribute('src'); + //make sure an existing element with the same src does not already exist: + js_log("New src: "+new_src); + for(i in this.sources){ + js_log(' ext src: '+this.sources[i].getURI()); + if(this.sources[i].getURI()==new_src){ + return false; + } + } var source = new mediaSource(element); this.sources.push(source); if(this.isPlayableType(source.mime_type)) @@ -1423,8 +1426,9 @@ @param roe_data ROE data. */ addROE:function(roe_data) - { - var _this = this; + { + this.addedROEData=true; + var _this = this; if(typeof roe_data == 'string') { var parser=new DOMParser(); @@ -1452,7 +1456,8 @@ }) } else - js_log('ROE data empty.'); + js_log('ROE data empty.'); + } }; @@ -1467,8 +1472,7 @@ embedVideo.prototype = { /** The mediaElement object containing all mediaSource objects */ media_element:null, - slider:null, - roe_xml:null, + slider:null, load_external_data:false, //utility functions for property values: hx : function ( s ) { @@ -1858,7 +1862,6 @@ thumb_html+='</div>'; return thumb_html; - }, GetEmbeddingHTML:function() { @@ -2060,8 +2063,10 @@ '<div class="videoOptionsComplete">'+ //@@TODO: this style should go to .css '<div style="width: 247px;border:none;position:absolute;z-index:13;padding: 12px 19px; text-align:right;"><span>'+ - '<a href="#" style="color:white;" onClick="$j(\'#'+sel_id+'\').get(0).closeDisplayedHTML();">close</a></span></div>'+ - html_code + + '<a href="#" style="color:white;" onClick="$j(\'#'+sel_id+'\').get(0).closeDisplayedHTML();return false;">close</a></span></div>'+ + '<div id="mv_disp_inner_'+sel_id+'">'+ + html_code + +'</div>'+ // close_link+'</span>'+ '</div></div>'; $j('#'+sel_id).append(div_code); @@ -2142,33 +2147,51 @@ out+='</blockquote></span>'; return out; }, - showVideoDownload:function(){ - var select_code=this.getDLlist(function(index, source) - { - return '<a style="color:white" href="' + source.getURI() +'"> ' - + source.getTitle()+'</a>'; - }); - this.displayHTML(select_code); + /*download list is exessivly complicated ... rewrite for clarity: */ + showVideoDownload:function(){ + //load the roe if avaliable (to populate out download options: + if(this.roe && this.media_element.addedROEData==false){ + var _this = this; + this.displayHTML(getMsg('loading_txt')); + do_request(this.roe, function(data) + { + _this.media_element.addROE(data); + $j('#mv_disp_inner_'+_this.id).html(_this.getShowVideoDownload()); + }); + }else{ + this.displayHTML(this.getShowVideoDownload()); + } }, - getDLlist:function(transform_function){ - var out='<b style="color:white;">'+getMsg('download_from')/*+' '+parseUri(this.src).queryKey['t']*/+'</b><br>'; + getShowVideoDownload:function(){ + var out='<b style="color:white;">'+getMsg('download_from')+'</b><br>'; out+='<span style="color:white"><blockquote>'; - var dl_list=dl_txt_list=''; - $j.each(this.media_element.getSources(), function(index, source) - { - var dl_line = '<li>' + transform_function(index, source) + '</li>'+"\n"; - if(this.getMIMEType()=="video/ogg"){ + 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"){ dl_txt_list+=dl_line; }else{ dl_list+=dl_line; } + }); + out+='</blockquote>'+getMsg('download_full')+"<blockquote>"+dl_list+'</blockquote>'; + out+='</blockquote>'+getMsg('download_text')+"<blockquote>"+dl_txt_list+'</blockquote></span>'; + return out; + }, + /*getDLlist:function(transform_function){ + + var dl_list=dl_txt_list=''; + $j.each(this.media_element.getSources(), function(index, source) + { + }); - out+='</blockquote>'+getMsg('download_full')+"<blockquote>"+dl_list+'</blockquote>'; - out+='</blockquote>'+getMsg('download_text')+"<blockquote>"+dl_txt_list+'</blockquote></span>'; + return out; - }, + },*/ /* * base embed controls * the play button calls @@ -2537,7 +2560,7 @@ //@@todo swich over to jQuery injection function loadExternalJs(url){ js_log('load js: '+ url); -/* if(window['$j']) + if(window['$j']) //have to use direct ajax call insted of $j.getScript() //since you can't send "cache" option to $j.getScript() $j.ajax({ @@ -2546,8 +2569,7 @@ dataType: 'script', cache: true }); - else*/ - { + else{ var e = document.createElement("script"); e.setAttribute('src', url); e.setAttribute('type',"text/javascript"); Modified: trunk/extensions/MetavidWiki/skins/mv_embed/mv_vlcEmbed.js =================================================================== --- trunk/extensions/MetavidWiki/skins/mv_embed/mv_vlcEmbed.js 2008-08-19 21:24:47 UTC (rev 39664) +++ trunk/extensions/MetavidWiki/skins/mv_embed/mv_vlcEmbed.js 2008-08-19 22:02:56 UTC (rev 39665) @@ -3,7 +3,6 @@ * javascript api: http://www.videolan.org/doc/play-howto/en/ch04.html * assume version > 0.8.5.1 */ - var vlcEmbed = { instanceOf:'vlcEmbed', supports: {'play_head':true, 'play_or_pause':true, 'stop':true, 'fullscreen':true, 'time_display':true, 'volume_control':true}, Modified: trunk/extensions/MetavidWiki/skins/mv_embed/skin/styles.css =================================================================== --- trunk/extensions/MetavidWiki/skins/mv_embed/skin/styles.css 2008-08-19 21:24:47 UTC (rev 39664) +++ trunk/extensions/MetavidWiki/skins/mv_embed/skin/styles.css 2008-08-19 22:02:56 UTC (rev 39665) @@ -320,15 +320,16 @@ /* margin: -305px 0 0 0; */ .videoComplete .videoOptionsComplete { - background: url(images/player_video_options_bg.png) 0 0 no-repeat; - width: 266px; - height: 172px; - margin: 5px auto; - padding: 12px 19px; -/* font-size: 14px;*/ - font-size:10pt; - overflow: auto; - color: #7a7a7a; + background:transparent url('images/player_video_options_bg.png') no-repeat scroll 0pt; + color:#7A7A7A; + font-size:10pt; + height:158px; + left:10%; + overflow:auto; + padding:19px; + position:relative; + top:16%; + width:283px; } .videoComplete .videoOptionsComplete p {text-align: center; margin: 3px 0; padding: 0;} .videoComplete .videoOptionsComplete a { Modified: trunk/extensions/MetavidWiki/skins/mv_stream.js =================================================================== --- trunk/extensions/MetavidWiki/skins/mv_stream.js 2008-08-19 21:24:47 UTC (rev 39664) +++ trunk/extensions/MetavidWiki/skins/mv_stream.js 2008-08-19 22:02:56 UTC (rev 39665) @@ -112,6 +112,11 @@ ebvid['org_eb_stop'] = ebvid['stop']; ebvid['stop'] = function(){mv_do_stop();} } + if(ebvid['showVideoDownload'].toString!='function(){mv_doShowVideoDownload();}'){ + ebvid['org_showVideoDownload'] = ebvid['showVideoDownload']; + ebvid['showVideoDownload'] = function(){mv_doShowVideoDownload();} + } + //js_log("post stop: " +ebvid['stop'].toString()); } //call stop override @@ -269,7 +274,11 @@ } } } - +function mv_doShowVideoDownload(){ + //restores orginal state before showing download links: + mv_init_interface.doRestore(); + return $j('#embed_vid').get(0).org_showVideoDownload(); +} /* the mvdObject * * eventually a lot of mvd_based functionality should be ported over to this structure. _______________________________________________ MediaWiki-CVS mailing list MediaWiki-CVS [at] lists https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs
|