r42157 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r42156‎ | r42157 | r42158 >
Date:23:42, 16 October 2008
Author:dale
Status:old
Tags:
Comment:
smil improvments
Modified paths:
  • /trunk/extensions/MetavidWiki/includes/articlepages/MV_SequencePage.php (modified) (history)
  • /trunk/extensions/MetavidWiki/includes/specials/MV_SpecialMediaSearch.php (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/includes/specials/MV_SpecialMediaSearch.php
@@ -1173,7 +1173,7 @@
11741174 //returns results via nickname via semantic query:
11751175 function getViaNickname($partname, $limit=5){
11761176 //split the nickname via spaces:
1177 - $nick_parts = split('_', $partname);
 1177+ $nick_parts = split('_', str_replace(' ', '_',$partname));
11781178 $query_string='';
11791179 $or='';
11801180 foreach($nick_parts as $pname){
Index: trunk/extensions/MetavidWiki/includes/articlepages/MV_SequencePage.php
@@ -76,7 +76,6 @@
7777 }
7878 //go from High level resource description to smile doc
7979 function resolveHLRD_to_SMIL(){
80 - global $wgTitle;
8180 //init smil skeleton:
8281 $this->smilDoc = new DOMDocument('1.0','UTF-8');
8382
@@ -87,9 +86,10 @@
8887 //add meta data:
8988 $titleNode = $this->smilDoc->createElement('meta');
9089 $titleNode->setAttribute("name", "title");
91 - $titleNode->setAttribute("content", $wgTitle->getText() );
 90+ $titleNode->setAttribute("content", $this->mTitle->getText() );
 91+ //add the title to the head node:
 92+ $headNode->appendChild($titleNode);
9293
93 -
9494 //add resolved transitions to the head:
9595 $tranNodeList = $this->hlrdDoc->getElementsByTagName('transition');
9696 foreach ($tranNodeList as $tranNode){
@@ -209,6 +209,14 @@
210210
211211 $node->setAttribute('type',$img->getMimeType());
212212 $node->setAttribute('src', $thumbnail->file->getURL());
 213+
 214+ //if type is ogg: (set dur and poster)
 215+ if( $img->getMimeType()=='application/ogg') {
 216+ if( !$node->hasAttribute('dur') )
 217+ $node->setAttribute('dur', $thumbnail->file->getLength() );
 218+ if( !$node->hasAttribute('poster') )
 219+ $node->setAttribute('poster', )
 220+ }
213221 }
214222 break;
215223 }
@@ -234,7 +242,10 @@
235243 if(trim($innerWikiText)!=''){
236244 $f = $node->ownerDocument->createDocumentFragment();
237245 $parserOutput = $wgParser->parse($innerWikiText ,$this->mTitle, ParserOptions::newFromUser( $wgUser ));
238 - $f->appendXML($parserOutput->getText());
 246+ $f->appendXML( "<![CDATA[\n".
 247+ $parserOutput->getText() .
 248+ "]]>"
 249+ );
239250 $node->appendChild($f);
240251 }
241252 return $node;
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -365,6 +365,7 @@
366366 this.default_players = new Object();
367367 this.default_players['video/x-flv']= ['flash','vlc'];
368368 this.default_players['video/ogg']=['native','vlc','java'];
 369+ this.default_players['application/ogg']=['native','vlc','java'];
369370 this.default_players['video/mp4']=['vlc'];
370371 },
371372 addPlayer : function(player, mime_type)
@@ -385,7 +386,7 @@
386387 this.players.push(player);
387388 },
388389 getMIMETypePlayers : function(mime_type)
389 - {
 390+ {
390391 var mime_players = new Array();
391392 if(this.default_players[mime_type])
392393 for (var d in this.default_players[mime_type])
@@ -398,14 +399,15 @@
399400 return mime_players;
400401 },
401402 defaultPlayer : function(mime_type)
402 - {
 403+ {
403404 var mime_players = this.getMIMETypePlayers(mime_type);
404405 if(mime_players.length)
405406 {
406407 // check for prior preference for this mime type
407 - for(var i in mime_players)
408 - if(mime_players[i].id==this.preference[mime_type])
 408+ for( var i in mime_players ){
 409+ if( mime_players[i].id==this.preference[mime_type] )
409410 return mime_players[i];
 411+ }
410412 // otherwise just return the first compatible player
411413 // (it will be chosen according to the default_players list
412414 return mime_players[0];
@@ -1761,12 +1763,13 @@
17621764 js_log('set via prefrence: '+playable_sources[source].mime_type);
17631765 this.selected_source = playable_sources[source];
17641766 }
1765 - }
 1767+ }
17661768 //set Ogg via player support:
17671769 for(var source in playable_sources){
 1770+ js_log('f:autoSelectSource' + playable_sources[source].mime_type);
17681771 var mime_type =playable_sources[source].mime_type;
17691772 //set source via player
1770 - if(mime_type=='video/ogg' || mime_type=='ogg/video' || mime_type=='video/annodex'){
 1773+ if(mime_type=='video/ogg' || mime_type=='ogg/video' || mime_type=='video/annodex' || mime_type=='application/ogg'){
17711774 for(var i in embedTypes.players){
17721775 var player = embedTypes.players[i];
17731776 //debugger;
@@ -1851,7 +1854,8 @@
18521855 },
18531856 getPlayableSources: function(){
18541857 var playable_sources= new Array();
1855 - for(var i in this.sources){
 1858+ for(var i in this.sources){
 1859+ js_log('getPlayableSources:'+this.sources[i].mime_type);
18561860 if(this.isPlayableType(this.sources[i].mime_type)){
18571861 if(mv_restrict_roe_time_source){
18581862 if(this.sources[i]['start'])
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_playlist.js
@@ -60,7 +60,7 @@
6161 disp_play_head:null,
6262 userSlide:false,
6363 loading:true,
64 - loading_external_data:true, //load external data by default
 64+ loading_external_data:true, //if we are loading external data (set to loading by default)
6565 tracks:{},
6666 default_track:null, // the default track to add clips to.
6767 init : function(element){
@@ -206,7 +206,7 @@
207207 _this.clip_ready_count++;
208208 continue;
209209 }
210 - js_log('clip sources count: '+ clip.embed.media_element.sources.length);
 210+ //js_log('clip sources count: '+ clip.embed.media_element.sources.length);
211211 clip.embed.on_dom_swap();
212212 if(clip.embed.loading_external_data==false &&
213213 clip.embed.init_with_sources_loadedDone==false){
@@ -437,11 +437,12 @@
438438 //js_log('found clip: '+ this.cur_clip.id + 'transIn:');
439439
440440 //updte start offset (@@todo should probably happen somewhere else like in getDuration() )
441 - if(!this.cur_clip.embed.start_offset)
 441+ if(typeof this.cur_clip.embed.start_offset=='undefined')
442442 this.cur_clip.embed.start_offset=this.cur_clip.embed.media_element.selected_source.start_offset;
443443
444444 //render effects ontop:
445 - //issue thumbnail update request: (if plugin supports it will render out frame (if media )
 445+ //issue thumbnail update request: (if plugin supports it will render out frame
 446+ // if not then we do a call to the server to get a new thumbnail
446447 this.cur_clip.embed.updateTimeThumb(perc);
447448
448449 this.cur_clip.embed.currentTime = (float_sec -pl_sum_time)+this.cur_clip.embed.start_offset ;
@@ -1682,12 +1683,12 @@
16831684 $j.each(seq_tags, function(i,seq_elm){
16841685 var inx = 0;
16851686 //get all the clips for the given seq:
1686 - $j.each(seq_elm.childNodes, function(i, mediaElemnt){
 1687+ $j.each(seq_elm.childNodes, function(i, mediaElement){
16871688 //~complex~ have to hannlde a lot like "switch" "region" etc
16881689 //js_log('proccess: ' + mediaElemnt.tagName);
1689 - if(typeof mediaElemnt.tagName!='undefined'){
 1690+ if(typeof mediaElement.tagName!='undefined'){
16901691 //set up basic mvSMILClip send it the mediaElemnt & mvClip init:
1691 - var cur_clip = new mvSMILClip(mediaElemnt,
 1692+ var cur_clip = new mvSMILClip(mediaElement,
16921693 {
16931694 id:'p_' + _this.id + '_c_'+inx,
16941695 pp:_this,
@@ -1715,6 +1716,7 @@
17161717 return this.init(smil_clip_element, mvClipInit);
17171718 }
17181719 //http://www.w3.org/TR/2007/WD-SMIL3-20070713/smil-extended-media-object.html#smilMediaNS-BasicMedia
 1720+//and some resource description elements
17191721 var mv_supported_media_attr = new Array(
17201722 'src',
17211723 'type',
@@ -1722,7 +1724,10 @@
17231725 'transIn',
17241726 'transOut',
17251727 'fill',
1726 - 'dur'
 1728+ 'dur',
 1729+
 1730+ 'uri',
 1731+ 'poster'
17271732 );
17281733 //all the overwritten and new methods for playlist extension of mv_embed
17291734 mvSMILClip.prototype = {
@@ -1749,7 +1754,11 @@
17501755 }
17511756 })
17521757 this['tagName'] =smil_clip_element.tagName;
1753 -
 1758+ if( smil_clip_element.firstChild ){
 1759+ this['wholeText']=smil_clip_element.firstChild.wholeText;
 1760+ js_log("SET wholeText: "+ this['wholeText']);
 1761+ }
 1762+ //debugger;
17541763 //mv_embed specific property:
17551764 if(smil_clip_element.hasAttribute('poster'))
17561765 this['img'] = smil_clip_element.getAttribute('poster');
@@ -1789,10 +1798,20 @@
17901799 if(this['type']){
17911800 switch(this['type']){
17921801 case 'text/html':
1793 - this.embed = new htmlEmbedWrapper({pc:this});
 1802+ case 'image/jpeg':
 1803+ this.embed = new htmlEmbedWrapper({pc:this, id:'e_'+this.id});
17941804 break;
 1805+ case 'application/ogg':
 1806+ case 'video/ogg':
 1807+ this['type']='video/ogg'; //conform to 'video/ogg' type
 1808+ this.parent_setUpEmbedObj();
 1809+ break;
17951810 }
17961811 }
 1812+ //if we got embed we are done:
 1813+ if(this.embed)
 1814+ return ;
 1815+ //guess by less reliable tagName:
17971816 if(this.tagName=='video')
17981817 return this.parent_setUpEmbedObj();
17991818
@@ -1802,16 +1821,67 @@
18031822 * grabs settings from parent clip
18041823 */
18051824 var htmlEmbedWrapper=function(init){
1806 - return this.init(init);
 1825+ ve = document.createElement('div');
 1826+ //extend ve with all this
 1827+ this.init(init);
 1828+ for(method in this){
 1829+ if(method!='readyState' && method!='style'){
 1830+ ve[method]= this[method];
 1831+ }
 1832+ }
 1833+ return ve;
18071834 }
18081835 var pcHtmlEmbedDefaults={
18091836 'dur':4 //default duration of 4seconds
18101837 }
18111838 htmlEmbedWrapper.prototype={
 1839+ supports: {
 1840+ 'play_head':true,
 1841+ 'play_or_pause':true,
 1842+ 'fullscreen':false,
 1843+ 'time_display':true,
 1844+ 'volume_control':true,
 1845+
 1846+ 'overlays':true,
 1847+ 'playlist_swap_loader':true //if the object supports playlist functions
 1848+ },
 1849+ start_offset:0,
18121850 init:function(init){
18131851 js_log('htmlEmbedWrapper');
18141852 if(init['pc']){
18151853 this['pc'] = init['pc'];
 1854+ }
 1855+ ve = document.createElement('div');
 1856+ for(i in init){
 1857+ //set the parent clip pointer:
 1858+ if(i=='pc'){
 1859+ this['pc']=init['pc'];
 1860+ }else{
 1861+ ve.setAttribute(i,init[i]);
 1862+ }
 1863+ }
 1864+ var videoInterface = new embedVideo(ve);
 1865+ //inherit the base embed properties:
 1866+ for( var i in videoInterface){
 1867+ if(typeof this[i] == 'undefined'){
 1868+ this[i]=videoInterface[i];
 1869+ }else{
 1870+ this['parent_'+i]=videoInterface[i];
 1871+ }
 1872+ }
 1873+ },
 1874+ //nothing to update in static html display:
 1875+ updateTimeThumb:function(){
 1876+ return ;
 1877+ },
 1878+ getHTML:function(){
 1879+ //set up the css for our parent div:
 1880+ $j(this).css({'width':this.pc.pp.width, 'height':this.pc.pp.height, 'overflow':"hidden"});
 1881+ //@@todo support more smil stuff:
 1882+ if( this.pc.type =='image/jpeg'){
 1883+ $j(this).html('<img src="'+this.pc.src+'">');
 1884+ }else{
 1885+ $j(this).html(this.pc.wholeText);
18161886 }
18171887 },
18181888 getDuration:function(){
@@ -1819,20 +1889,15 @@
18201890 return this.pc.dur;
18211891 //no dur use default:
18221892 return pcHtmlEmbedDefaults.dur;
 1893+ },
 1894+ //gives a chance to make any nesseary external requests
 1895+ //@@todo we can "start loading images" if we want
 1896+ on_dom_swap:function(){
 1897+ this.loading_external_data=false
 1898+ this.ready_to_play=true;
 1899+ return ;
18231900 }
18241901 }
1825 -/*
1826 -* ImgWrapperEmbed extends htmlEmbedWrapper and but displays an image
1827 -*/
1828 -var imgEmbedWrapper=function(img_init){
1829 - return this.init;
1830 -}
1831 -//all the overwritten and new methods for playlist extension of mv_embed
1832 -imgEmbedWrapper.prototype = {
1833 - init:function(){
1834 - js_log("imgWrapperEmbed init");
1835 - }
1836 -}
18371902 var mv_supported_transition_attr = new Array(
18381903 'id',
18391904 'type',
@@ -1974,7 +2039,7 @@
19752040 js_log('ignored pos: '+ pos);
19762041 //for now just add to the end:
19772042 this.clips.push(clipObj);
1978 - js_log('addClip cur_clip len:'+ clipObj.embed.media_element.sources.length);
 2043+ //js_log('addClip cur_clip len:'+ clipObj.embed.media_element.sources.length);
19792044 },
19802045 getClipCount:function(){
19812046 return this.clips.length;
@@ -2041,4 +2106,4 @@
20422107 newString = newString.replace (myRegExp, '&' + entities[i] + ';');
20432108 }
20442109 return newString;
2045 -}
 2110+}
\ No newline at end of file

Status & tagging log