r48038 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r48037‎ | r48038 | r48039 >
Date:00:22, 5 March 2009
Author:dale
Status:deferred
Tags:
Comment:
cortado and iframe updates
Modified paths:
  • /trunk/extensions/MetavidWiki/skins/mv_embed/cortado-svn.jar (added) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/cortado_iframe.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_page.php (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_baseEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_javaEmbed.js (modified) (history)
  • /trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js (modified) (history)

Diff [purge]

Index: trunk/extensions/MetavidWiki/skins/mv_embed/cortado_iframe.php
@@ -106,11 +106,27 @@
107107 <head>
108108 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
109109 <title>cortado_embed</title>
110 - <?php if( !empty( $parent_domain ) ){?>
111110 <script type="text/javascript">
112 - window.DOMAIN = '<?php echo escapeJsString( $parent_domain ); ?>';
 111+ var i = 1;
 112+ var last_msg='';
 113+ function doMonitor(){
 114+ //get the current time:
 115+ var jce = document.getElementById('<?php echo htmlspecialchars( $id ) ?>');
 116+ if(jce){
 117+ //setup the msg:
 118+ var hash = 'currentTime=' + jce.getPlayPosition();
 119+
 120+ //update the msg frame hash:
 121+ window.top['mvMsgFrame'].location = '#' + hash;
 122+ top.location = '#' + hash;
 123+
 124+ }
 125+
 126+ setTimeout(doMonitor, 1000);
 127+ i++;
 128+ }
 129+ setTimeout(doMonitor, 1000);
113130 </script>
114 - <?php }?>
115131 <style type="text/css">
116132 <!--
117133 body {
@@ -125,7 +141,7 @@
126142 <?php if (empty($error)){ ?>
127143 <applet id="<?php echo htmlspecialchars( $id ) ?>"
128144 code="com.fluendo.player.Cortado.class"
129 - archive="cortado-ovt-stripped_r34336.jar"
 145+ archive="cortado-svn.jar"
130146 width="<?php echo htmlspecialchars( $width )?>"
131147 height="<?php echo htmlspecialchars( $height )?>"
132148 >
@@ -140,7 +156,9 @@
141157 <param name="duration" value="<?php echo htmlspecialchars( $duration )?>" />
142158 <?
143159 } ?>
144 - <param name="bufferSize" value="200" />
 160+ <param name='BufferSize' value='8192'>
 161+ <param name='BufferHigh' value='30'>
 162+ <param name='BufferLow' value='5'>
145163 </applet>
146164 <? }else{ ?>
147165 <b>Error:</b> <?php echo htmlspecialchars( $error )?>
Index: trunk/extensions/MetavidWiki/skins/mv_embed/cortado-svn.jar
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes on: trunk/extensions/MetavidWiki/skins/mv_embed/cortado-svn.jar
___________________________________________________________________
Added: svn:mime-type
148166 + application/octet-stream
Index: trunk/extensions/MetavidWiki/skins/mv_embed/example_usage/sample_page.php
@@ -12,7 +12,7 @@
1313 <html>
1414 <head>
1515 <title>sample mv embed</title>
16 - <script type="text/javascript" src="../mv_embed.js?<?php echo time()?>"></script>
 16+ <script type="text/javascript" src="../mv_embed.js?urid=<?php echo time()?>"></script>
1717 </head>
1818 <body>
1919 <h3> Sample Embed</h3>
Index: trunk/extensions/MetavidWiki/skins/mv_embed/mv_embed.js
@@ -54,6 +54,7 @@
5555 if( !mv_embed_path ){
5656 var mv_embed_path = getMvEmbedPath();
5757 }
 58+//js_log("mv embed path:"+ mv_embed_path);
5859 //set the unique request id (for ensuring fresh copies of scripts on updates)
5960 if( !mv_embed_urid ){
6061 var mv_embed_urid = getMvUniqueReqId();
@@ -384,7 +385,7 @@
385386 });*/
386387
387388 eval('var lib = {"'+this.library+'Embed":\'libEmbedObj/mv_'+this.library+'Embed.js\'}');
388 - //js_log('DO LOAD: '+this.library);
 389+ js_log('DO LOAD: '+this.library);
389390 mvJsLoader.doLoad(lib,function(){
390391 //js_log( 'type of lib: ' + eval( 'typeof ' + this.library + 'Embed' ) );
391392 //js_log(_this.id + ' plugin loaded');
@@ -587,8 +588,6 @@
588589 (domain ? ("; domain=" + domain) : "") +
589590 (secure ? "; secure" : "");
590591 }
591 -
592 -js_log("mv embed path:"+ mv_embed_path);
593592 /*
594593 * embedTypes object handles setting and getting of supported embed types:
595594 * closely mirrors OggHandler so that its easier to share efforts in this area:
@@ -1230,7 +1229,8 @@
12311230 function getMvEmbedURL(){
12321231 js_elements = document.getElementsByTagName("script");
12331232 for(var i=0;i<js_elements.length; i++){
1234 - if( js_elements[i].src.indexOf('mv_embed') !=-1){
 1233+ //check for normal mv_embed.js and or script loader
 1234+ if( js_elements[i].src.indexOf('mv_embed.js') !=-1 || ( js_elements[i].src.indexOf('mv_embed') != -1 && js_elements[i].src.indexOf('mvwScriptLoader.php') != -1) ){
12351235 return js_elements[i].src;
12361236 }
12371237 }
@@ -1250,13 +1250,13 @@
12511251 */
12521252 function getMvEmbedPath(){
12531253 var mv_embed_url = getMvEmbedURL();
1254 - if(mv_embed_url.indexOf('mv_embed.js') !== -1){
 1254+ if( !mv_embed_url || mv_embed_url.indexOf('mv_embed.js') !== -1){
12551255 mv_embed_path = mv_embed_url.substr(0, mv_embed_url.indexOf('mv_embed.js'));
12561256 }else{
12571257 mv_embed_path = mv_embed_url.substr(0, mv_embed_url.indexOf('mvwScriptLoader.php'));
12581258 }
12591259 //absolute the url (if relative) (if we don't have mv_embed path)
1260 - if(mv_embed_path.indexOf('://')==-1){
 1260+ if( mv_embed_path.indexOf('://') == -1){
12611261 var pURL = parseUri( document.URL );
12621262 if(mv_embed_path.charAt(0)=='/'){
12631263 mv_embed_path = pURL.protocol + '://' + pURL.authority + mv_embed_path;
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_javaEmbed.js
@@ -1,5 +1,6 @@
22 var javaEmbed = {
33 instanceOf:'javaEmbed',
 4+ iframe_src:'',
45 supports: {
56 'play_head':true,
67 'pause':true,
@@ -14,9 +15,12 @@
1516 //set a default duration of 30 seconds: cortao should detect duration.
1617 return this.wrapEmebedContainer( this.getEmbedObj() );
1718 },
18 - getEmbedObj:function(){
19 - if(!this.duration)this.duration=30;
20 - if(mv_java_iframe){
 19+ getEmbedObj:function(){
 20+ //get the duration
 21+ this.getDuration();
 22+ //if still unset set to an arbitrary time 60 seconds:
 23+ if(!this.duration)this.duration=60;
 24+ if( mv_java_iframe ){
2125 //make sure iframe and embed path match (java security model)
2226 var iframe_src='';
2327 var src = this.media_element.selected_source.getURI();
@@ -45,9 +49,17 @@
4650 iframe_src+= "&width=" + this.width + "&height=" + this.height;
4751 iframe_src+= "&duration=" + this.duration;
4852 iframe_src+=parent_domain;
49 - return '<iframe id="iframe_'+this.pid+'" width="'+this.width+'" height="'+this.height+'" '+
50 - 'frameborder=0 scrolling=no marginwidth=0 marginheight=0 ' +
51 - 'src = "'+ iframe_src + '"></iframe>';
 53+
 54+ //check for the mvMsgFrame
 55+ if($j('#mvMsgFrame').length == 0){
 56+ js_log('appened mvMsgFrame');
 57+ //add it to the dom: (sh
 58+ $j('body').prepend( '<iframe id="mvMsgFrame" width="0" height="0" scrolling=no marginwidth=0 marginheight=0 src="#none"></iframe>' );
 59+ }
 60+ this.iframe_src = iframe_src;
 61+ return '<iframe id="iframe_' + this.pid + '" width="'+this.width+'" height="'+this.height+'" '+
 62+ 'frameborder="0" scrolling="no" marginwidth="0" marginheight="0" ' +
 63+ 'src = "'+ this.iframe_src + '"></iframe>';
5264 }else{
5365 //load directly in the page..
5466 // (media must be on the same server or applet must be signed)
@@ -62,31 +74,51 @@
6375 '<param name="duration" value="'+this.duration+'" />'+"\n"+
6476 '<param name="bufferSize" value="200" />'+"\n"+
6577 '</applet>';
 78+ }
 79+ },
 80+ sendFrameMsg:function( msg ){
 81+ var iwin;
 82+ if(navigator.userAgent.indexOf("Safari") != -1){
 83+ iwin = frames["iframe_" + this.pid];
 84+ }else{
 85+ iwin = document.getElementById("iframe_" + this.pid).contentWindow;
6686 }
67 - },
 87+ //update the msg text:
 88+ iwin.location = this.iframe_src +'#'+ msg;
 89+ },
6890 postEmbedJS:function(){
69 - this.getJCE();
 91+ //start monitor:
 92+ this.monitor();
 93+ this.sendFrameMsg('test_frame_update');
7094 },
71 - //get java cortado embed object
72 - getJCE:function(){
73 - if(!mv_java_iframe){
74 - this.jce = $j('#'+this.pid).get(0);
 95+ monitor:function(){
 96+ this.updateJavaState();
 97+
 98+ if( ! this.monitorTimerId ){
 99+ if(document.getElementById(this.id)){
 100+ this.monitorTimerId = setInterval('document.getElementById(\''+this.id+'\').monitor()', 250);
 101+ }
 102+ }
 103+ },
 104+ updateJavaState:function(){
 105+ if( ! mv_java_iframe ){
 106+ this.getJCE();
 107+ if(typeof this.jce != 'undefined' ){
 108+ if(typeof this.jce.getPlayPosition != 'undefined' ){
 109+ this.currentTime = this.jce.getPlayPosition();
 110+ }
 111+ }
75112 }else{
76 - //set via iframe refrence:
77 - //(does not work even if we set window.domain on the remote iframe)
78 - //this.jce = $j('#iframe_'+this.pid).get(0).contentDocument.getElementById(this.pid);
 113+ //read the packaged info from the iframe:
 114+ //js_log( 'iframe_src: ' + $j('#mvMsgFrame' + this.pid).attr("src") );
79115 }
80116 },
 117+ //get java cortado embed object
 118+ getJCE:function(){
 119+ this.jce = $j('#'+this.pid).get(0);
 120+ },
81121 pause:function(){
82122 this.parent_pause();
83123 this.stop();
84 - },
85 - currentTime:function(){
86 - if(typeof this.jce != 'undefined' ){
87 - if(typeof this.jce.getPlayPosition != 'undefined' ){
88 - return this.jce.getPlayPosition();
89 - }
90 - }
91 - return '0';
92124 }
93125 }
Index: trunk/extensions/MetavidWiki/skins/mv_embed/libEmbedObj/mv_baseEmbed.js
@@ -1677,13 +1677,13 @@
16781678 for(var i=0; i < supporting_players.length ; i++){
16791679 if( _this.selected_player.id == supporting_players[i].id && is_selected ){
16801680 out+='<li style="border-style:dashed;margin-left:20px;">'+
1681 - '<img border="0" width="16" height="16" src="'+mv_embed_path+'images/plugin.png">'+
 1681+ '<img border="0" width="16" height="16" src="' + mv_embed_path + 'images/plugin.png">' +
16821682 supporting_players[i].getName() +
16831683 '</li>';
16841684 }else{
16851685 //else gray plugin and the plugin with link to select
16861686 out+='<li style="margin-left:20px;">'+
1687 - '<a href="#" onClick="'+ source_select_code + 'embedTypes.players.userSelectPlayer(\''+supporting_players[i].id+'\',\''+ source.getMIMEType()+'\');return false;">'+
 1687+ '<a href="#" onClick="'+ source_select_code + 'embedTypes.players.userSelectPlayer(\'' + supporting_players[i].id + '\',\'' + source.getMIMEType() +'\');return false;">'+
16881688 '<img border="0" width="16" height="16" src="'+mv_embed_path+'images/plugin_disabled.png">'+
16891689 supporting_players[i].getName() +
16901690 '</a>'+

Status & tagging log