[OPENMEETINGS-551] network testing is fixed

Project: http://git-wip-us.apache.org/repos/asf/openmeetings/repo
Commit: http://git-wip-us.apache.org/repos/asf/openmeetings/commit/c79c1213
Tree: http://git-wip-us.apache.org/repos/asf/openmeetings/tree/c79c1213
Diff: http://git-wip-us.apache.org/repos/asf/openmeetings/diff/c79c1213

Branch: refs/heads/master
Commit: c79c121387ab20014f49cabd57fbc82ba906d54e
Parents: 838bfbe
Author: Maxim Solodovnik <[email protected]>
Authored: Thu Apr 13 17:35:27 2017 +0000
Committer: Maxim Solodovnik <[email protected]>
Committed: Thu Apr 13 17:35:27 2017 +0000

----------------------------------------------------------------------
 .../swf10/networkTesting/networktesting.lzx     |  84 +--
 .../swf10/networkTesting/rtmpConnection.lzx     | 654 +++++++++----------
 .../apache/openmeetings/web/room/SwfPanel.java  |  63 +-
 .../openmeetings/web/room/VideoSettings.java    |   2 +-
 .../openmeetings/web/room/swf-functions.js      |  11 +-
 5 files changed, 392 insertions(+), 422 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/c79c1213/openmeetings-flash/src/main/swf10/networkTesting/networktesting.lzx
----------------------------------------------------------------------
diff --git 
a/openmeetings-flash/src/main/swf10/networkTesting/networktesting.lzx 
b/openmeetings-flash/src/main/swf10/networkTesting/networktesting.lzx
index acfef7a..df65c1b 100644
--- a/openmeetings-flash/src/main/swf10/networkTesting/networktesting.lzx
+++ b/openmeetings-flash/src/main/swf10/networkTesting/networktesting.lzx
@@ -19,7 +19,6 @@
   
 -->
 <canvas width="100%" height="100%" title="NetworkTesting">
-
        <switch>
                <when property="$as3">
                        <passthrough>
@@ -50,7 +49,10 @@
                for (var i = 0; i < lbls.length; ++i) {
                        canvas.lbls[lbls[i].id] = lbls[i].value;
                }
+               var config = ExternalInterface.call("getConfig");
                doDebugInit();
+               getSettings(config);
+               canvas.showTests();
        ]]></handler>
 
        <method name="lbl" args="key">
@@ -59,60 +61,18 @@
                return !!s ? s : "Missing[" + key + "]";
        </method>
 
-       <!--
-               These attributes are rewritten by values from 
"public/config.xml"
-       -->
-       <attribute name="rtmpProtocol" type="string" value="rtmp" />
-       <attribute name="rtmpHost" type="string" value="" />
-       <attribute name="rtmpPort" type="number" value="1935" />
-       
-       <attribute name="httpProtocol" type="string" value="http" />
-       <attribute name="httpHost" type="string" value="" />
-       <attribute name="httpPort" type="number" value="5080" />
-       <attribute name="uriContext" type="string" value="/openmeetings" />
-       <attribute name="rtmpUriPath" type="string" 
value="/openmeetings/hibernate" />
-
-       <method name="getBrowserHost">
-               var host:String = 
ExternalInterface.call("window.location.host.toString()");
-               // in case of IE or some other security issues we will fail ...
-               if (!host) {
-                       var url:String = canvas.proxyurl;
-                       if (url) {
-                               if ($debug) Debug.write("url ", url);
-                               var paramsIdx = url.indexOf("?");
-                               if (paramsIdx != -1) {
-                                       url = url.substr(0, paramsIdx);
-                               }
-                               if ($debug) Debug.write("url ", url);
-                               url = url.substr(url.indexOf("//") + 2);
-                               var portIdx = url.indexOf(":");
-                               host = url.substr(0, portIdx != -1 ? portIdx : 
url.indexOf("/"));
-                               if ($debug) Debug.write("host ", host);
-                       }
-               }
-               return host;
-       </method>
-       
-       <method name="getSettings">
-               var settingsPtr = canvas.settings.getPointer();
-               
-               var useSSL:Boolean = ("yes" == 
settingsPtr.xpathQuery("config/useSSL/text()"));
-               canvas.setAttribute("rtmpProtocol", useSSL ? "rtmps" : "rtmp");
-               canvas.setAttribute("proxyType", 
settingsPtr.xpathQuery("config/proxyType/text()"));
-               canvas.setAttribute("rtmpHost", 
settingsPtr.xpathQuery("config/rtmphostlocal/text()"));
-               if (!canvas.rtmpHost) {
-                       canvas.rtmpHost = getBrowserHost();
-               }
-               canvas.setAttribute("rtmpPort", 
settingsPtr.xpathQuery("config/" + (useSSL ? "rtmpsslport" : "rtmpport") + 
"/text()"));
+       <method name="getSettings" args="config">
+               if ($debug) Debug.write("getSettings:: ", config);
+               canvas.setAttribute("rtmpProtocol", config.flashProtocol);
+               canvas.setAttribute("proxyType", config.proxy);
+               canvas.setAttribute("rtmpHost", config.host);
+               canvas.setAttribute("rtmpPort", config.flashPort);
                
-               canvas.setAttribute("httpProtocol", 
settingsPtr.xpathQuery("config/protocol/text()"));
-               canvas.setAttribute("httpHost", 
settingsPtr.xpathQuery("config/httphostlocal/text()"));
-               if (!canvas.httpHost) {
-                       canvas.httpHost = rtmpHost;
-               }
-               canvas.setAttribute("httpPort", 
settingsPtr.xpathQuery("config/red5httpport/text()"));
+               canvas.setAttribute("httpProtocol", config.httpProtocol);
+               canvas.setAttribute("httpHost", config.host);
+               canvas.setAttribute("httpPort", config.httpPort);
 
-               canvas.setAttribute("uriContext", 
settingsPtr.xpathQuery("config/httpRootKey/text()"));
+               canvas.setAttribute("uriContext", '/' + config.path);
                canvas.setAttribute("rtmpUriPath", canvas.uriContext + 
"hibernate");
        </method>
 
@@ -121,24 +81,6 @@
                tests.testAll();
        </method>
 
-       <dataset type="http" name="settings" request="false" proxied="false">
-               <handler name="oninit">
-                       this.setAttribute("src", "config.xml");
-                       this.doRequest();
-               </handler>
-               <handler name="ondata">
-                       if ($debug) Debug.write("Settings are retrieved");
-                       canvas.getSettings();
-                       canvas.showTests();
-               </handler>
-               <handler name="onerror" args="e">
-                       if ($debug) Debug.write("Settings error [" + this.src + 
"]", e);
-               </handler>
-               <handler name="ontimeout" args="e">
-                       if ($debug) Debug.write("Settings timeout error", e);
-               </handler>
-       </dataset>
-
        <attribute name="busy" type="boolean" value="false"/>
        <attribute name="log" type="string" value="" />
 

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/c79c1213/openmeetings-flash/src/main/swf10/networkTesting/rtmpConnection.lzx
----------------------------------------------------------------------
diff --git 
a/openmeetings-flash/src/main/swf10/networkTesting/rtmpConnection.lzx 
b/openmeetings-flash/src/main/swf10/networkTesting/rtmpConnection.lzx
index 1cfb69f..ad1958f 100644
--- a/openmeetings-flash/src/main/swf10/networkTesting/rtmpConnection.lzx
+++ b/openmeetings-flash/src/main/swf10/networkTesting/rtmpConnection.lzx
@@ -7,369 +7,361 @@
   to you under the Apache License, Version 2.0 (the
   "License"); you may not use this file except in compliance
   with the License.  You may obtain a copy of the License at
-  
-      http://www.apache.org/licenses/LICENSE-2.0
-         
+
+         http://www.apache.org/licenses/LICENSE-2.0
+
   Unless required by applicable law or agreed to in writing,
   software distributed under the License is distributed on an
   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
   KIND, either express or implied.  See the License for the
   specific language governing permissions and limitations
   under the License.
-  
--->
 
+-->
 
 <class name="rtmpConnection" extends="node">
-
-        <switch>
-            <when property="$as3">
-                <passthrough>
-                    import flash.net.NetConnection;
-                    import flash.events.NetStatusEvent;
-                </passthrough>
-            </when>
-        </switch>
-
-       <attribute name="debug" value="false" type="boolean" />
-       
-       <event name="onconnect"/>
-       <event name="onerror"/>
-        
-        <!-- this attribute holds a reference to the current/last called 
netremoteCall,
-        in case of error you can debug that way which call did fail -->
-        <attribute name="lastCalled" value="null" />
-       
-       <attribute name="src" value="" type="string"/>
-
-               <method name="connect">
-            this._nc = new NetConnection();
-
-            // local reference to rtmpconnection
-            //this._nc.t = this;
-            
-            this._nc.proxyType = canvas.proxyType;
-            
-            var ok = this._nc.connect(src == "null" ? null : src, true); 
//isAVClient = true
-            if (this.debug) {
-               if($debug) Debug.write("*** debug ***");
-            }
-            
-            this._nc.addEventListener(NetStatusEvent.NET_STATUS, _onStatus);
-            
-               if($debug) Debug.write("devRtmpConnection/registerMethods()");
-               var clientObj = {};
-               clientObj.setId = this.setId;
-               
-               this._nc.client = clientObj;
-               
-                       //Register Methods
-                       //this.registerMethods();
-               </method>
-               
-               <method name="setId" args="tId">
-                       if ($debug) Debug.write("setId ", tId);
-               </method>
-               
-        <method name="_onStatus" args="stats"><![CDATA[
-            if ($debug) {
-                Debug.write("devrtmpconnection", this, "_onStatus", 
stats.info.code);
-            }
-
-            var msg = "";
-            var s;
-
-            switch (stats.info.code) {
-
-                case "NetConnection.Connect.Success": {
-                    // The connection attempt succeeded.
-                    //canvas.currentNC is the reference to the NetConnection 
that is used in the NetStream
-                    msg = stats.info.code;
-                    canvas.currentNC = this._nc;
-                    s = 2;
-                    break;
-                }
-                
-                case "NetConnection.Connect.Closed": {
-                    msg = stats.info.code;
-                    this._nc = null;
-                    canvas.currentNC = null;
-                    s = 0;
-                    break;
-                }
-
-                default: {
-                    msg = stats.info.code;
-                    s = 0;
-                    break;
-                }
-
-            }
-
-            this.setAttribute("status", msg);
-
-            if (s == 2) {
-                this.onconnect.sendEvent();
-            } else {
-               this.onerror.sendEvent();
-            }
-
-          ]]>
-        </method>      
-        
-        <method name="disconnect">
-               if ($debug) Debug.write(" DISCONNECT ");
-               if (this._nc != null) {
-                this._nc.close();
-            }
-        </method>
-    <!--- 
-        With this function all methods are registered to the NetConnection
-        A server can invoke this Method with a call for it from the Client
-        Only subnodes of rtmpconnections which are a instance of 
netRemoteCallHib
-        are registered, to add dynamically methods to the remotefunction you 
will
-        have to invoke this method once again
-        -swagner
-     -->
-    <method name="registerMethods">
-        <![CDATA[
-               if (this.subnodes!=null){
-                   var clientObj = {};
-                       //Register all methods which are onstanceof 
netRemoteCallHib
-                       for (var i=0;i<this.subnodes.length;i++){
-                           //If it is of Type netRemoteCallHib then register 
it to the NetConnection
-                           if (this.subnodes[i] instanceof 
lz.netRemoteCallHib){
-                               clientObj[this.subnodes[i].funcname] = 
function( args ){
-                            return 
canvas.thishib.remoteCallMethod(arguments.callee,arguments);
-                                   //return 
hib.remoteCallMethod(arguments.callee,args);
-                               }
-                           }
-                       }
-                       this._nc.client = clientObj;
-               }
-        ]]>
-    </method>
-    
-    <!-- 
-        Process the RemoteCall to the Right Funtion
-        -swagner
-     -->
-    <method name="remoteCallMethod" args="callee,args">
-        <![CDATA[
-            for (var eg in this._nc){
-                if (this._nc[eg]==callee){
-                    if (this.debug) {
-                        //_root.Debug.write.write("DEBUG invoked a function 
remotely: ",eg,args);
-                    }    
-                    if (args.length == 1) {
-                        return this.callFuntion(eg,args[0]);
-                    } else {
-                        return this.callFuntion(eg,args);
-                    }
-                    //return this.callFuntion(eg,args);
-                }
-            }
-        ]]>
-    </method>
-    
-    <!-- 
-        Map the Function to a netRemoteCallHib
-        -swagner
-     -->
-    <method name="callFuntion" args="funcname,args">
-        <![CDATA[
-            for (var i=0;i<this.subnodes.length;i++){
-                if (this.subnodes[i].funcname==funcname){
-                    return this.subnodes[i].onResult(args);
-                }
-            }
-        ]]>
-    </method>          
-    
-    <method name="callRPC" args="func, obj, params">
-       //if ($debug) Debug.write("*** call: func, obj, params",func,obj, 
typeof (params) ,params.length);
-       if (params.length != 0){
-               //does this really work?
-               //ASSetPropFlags(_global, null, 8, 1);
-            //setPropertyIsEnumerable(8, 1);
-               //Debug.write("does it work?",arguments);
-               <!--
-               this._nc.call.apply(this._nc,arguments);
-                -->
+       <switch>
+               <when property="$as3">
+                       <passthrough>
+                               import flash.net.NetConnection;
+                               import flash.events.NetStatusEvent;
+                       </passthrough>
+               </when>
+       </switch>
+
+       <attribute name="debug" value="false" type="boolean" />
+
+       <event name="onconnect"/>
+       <event name="onerror"/>
+
+       <!-- this attribute holds a reference to the current/last called 
netremoteCall,
+       in case of error you can debug that way which call did fail -->
+       <attribute name="lastCalled" value="null" />
+
+       <attribute name="src" value="" type="string"/>
+
+       <method name="connect">
+               this._nc = new NetConnection();
+
+               // local reference to rtmpconnection
+               //this._nc.t = this;
+
+               this._nc.proxyType = canvas.proxyType;
+
+               var ok = this._nc.connect(src == "null" ? null : src, {
+                       uid: "noclient"
+               });
+               if (this.debug) {
+                       if($debug) Debug.write("*** debug ***");
+               }
+
+               this._nc.addEventListener(NetStatusEvent.NET_STATUS, _onStatus);
+
+               if($debug) Debug.write("devRtmpConnection/registerMethods()");
+               var clientObj = {};
+               clientObj.setId = this.setId;
+
+               this._nc.client = clientObj;
+
+               //Register Methods
+               //this.registerMethods();
+       </method>
+
+       <method name="setId" args="tId">
+               if ($debug) Debug.write("setId ", tId);
+       </method>
+
+       <method name="_onStatus" args="stats"><![CDATA[
+               if ($debug) {
+                       Debug.write("devrtmpconnection", this, "_onStatus", 
stats.info.code);
+               }
+
+               var msg = "";
+               var s;
+
+               switch (stats.info.code) {
+
+                       case "NetConnection.Connect.Success": {
+                               // The connection attempt succeeded.
+                               //canvas.currentNC is the reference to the 
NetConnection that is used in the NetStream
+                               msg = stats.info.code;
+                               canvas.currentNC = this._nc;
+                               s = 2;
+                               break;
+                       }
+
+                       case "NetConnection.Connect.Closed": {
+                               msg = stats.info.code;
+                               this._nc = null;
+                               canvas.currentNC = null;
+                               s = 0;
+                               break;
+                       }
+
+                       default: {
+                               msg = stats.info.code;
+                               s = 0;
+                               break;
+                       }
+
+               }
+
+               this.setAttribute("status", msg);
+
+               if (s == 2) {
+                       this.onconnect.sendEvent();
+               } else {
+                       this.onerror.sendEvent();
+               }
+
+       ]]>
+       </method>
+
+       <method name="disconnect">
+               if ($debug) Debug.write(" DISCONNECT ");
+               if (this._nc != null) {
+                       this._nc.close();
+               }
+       </method>
+       <!---
+               With this function all methods are registered to the 
NetConnection
+               A server can invoke this Method with a call for it from the 
Client
+               Only subnodes of rtmpconnections which are a instance of 
netRemoteCallHib
+               are registered, to add dynamically methods to the 
remotefunction you will
+               have to invoke this method once again
+               -swagner
+        -->
+       <method name="registerMethods">
+               <![CDATA[
+                       if (this.subnodes!=null){
+                               var clientObj = {};
+                               //Register all methods which are onstanceof 
netRemoteCallHib
+                               for (var i=0;i<this.subnodes.length;i++){
+                                       //If it is of Type netRemoteCallHib 
then register it to the NetConnection
+                                       if (this.subnodes[i] instanceof 
lz.netRemoteCallHib){
+                                               
clientObj[this.subnodes[i].funcname] = function( args ){
+                                                       return 
canvas.thishib.remoteCallMethod(arguments.callee,arguments);
+                                                       //return 
hib.remoteCallMethod(arguments.callee,args);
+                                               }
+                                       }
+                               }
+                               this._nc.client = clientObj;
+                       }
+               ]]>
+       </method>
+
+       <!--
+               Process the RemoteCall to the Right Funtion
+               -swagner
+        -->
+       <method name="remoteCallMethod" args="callee,args">
+               <![CDATA[
+                       for (var eg in this._nc){
+                               if (this._nc[eg]==callee){
+                                       if (this.debug) {
+                                               
//_root.Debug.write.write("DEBUG invoked a function remotely: ",eg,args);
+                                       }
+                                       if (args.length == 1) {
+                                               return 
this.callFuntion(eg,args[0]);
+                                       } else {
+                                               return 
this.callFuntion(eg,args);
+                                       }
+                                       //return this.callFuntion(eg,args);
+                               }
+                       }
+               ]]>
+       </method>
+
+       <!--
+               Map the Function to a netRemoteCallHib
+               -swagner
+        -->
+       <method name="callFuntion" args="funcname,args">
+               <![CDATA[
+                       for (var i=0;i<this.subnodes.length;i++){
+                               if (this.subnodes[i].funcname==funcname){
+                                       return this.subnodes[i].onResult(args);
+                               }
+                       }
+               ]]>
+       </method>
+
+       <method name="callRPC" args="func, obj, params">
+               //if ($debug) Debug.write("*** call: func, obj, 
params",func,obj, typeof (params) ,params.length);
+               if (params.length != 0){
+                       //does this really work?
+                       //ASSetPropFlags(_global, null, 8, 1);
+                       //setPropertyIsEnumerable(8, 1);
+                       //Debug.write("does it work?",arguments);
+                       <!--
+                       this._nc.call.apply(this._nc,arguments);
+                        -->
                        if (params.length==1){
-                           this._nc.call(func, obj,params[0]);
+                               this._nc.call(func, obj,params[0]);
                        } else if (params.length==2){
-                           this._nc.call(func, obj,params[0],params[1]);
+                               this._nc.call(func, obj,params[0],params[1]);
                        } else if (params.length==3){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2]);
                        } else if (params.length==4){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3]);
                        } else if (params.length==5){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4]);
                        } else if (params.length==6){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5]);
                        } else if (params.length==7){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6]);
                        } else if (params.length==8){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7]);
                        } else if (params.length==9){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8]);
                        } else if (params.length==10){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9]);
                        } else if (params.length==11){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10]);
                        } else if (params.length==12){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11]);
                        } else if (params.length==13){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12]);
                        } else if (params.length==14){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13]);
                        } else if (params.length==15){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14]);
                        } else if (params.length==16){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15]);
                        } else if (params.length==17){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16]);
                        } else if (params.length==18){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16],params[17]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16],params[17]);
                        } else if (params.length==19){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16],params[17],params[18]);
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16],params[17],params[18]);
                        } else if (params.length==20){
-                           this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16],params[17],params[18],params[19]);
-                       }                
-        } else {
-            this._nc.call(func, obj);
-        }
-    </method>
-    
+                               this._nc.call(func, 
obj,params[0],params[1],params[2],params[3],params[4],params[5],params[6],params[7],params[8],params[9],params[10],params[11],params[12],params[13],params[14],params[15],params[16],params[17],params[18],params[19]);
+                       }
+               } else {
+                       this._nc.call(func, obj);
+               }
+       </method>
 </class>
 
 
-    <!---
-        Net remote call. 
-        @todo Document netremotecall class.
-    -->
-    <class name="netremotecall" extends="node">
-
-        <switch>
-            <when property="$as3">
-                <passthrough>
-                    import flash.net.Responder;
-                </passthrough>
-            </when>
-        </switch>
-
-        <!--- Name of the remote function. -->
-        <attribute name="funcname" value="$once{null}" type="string" />
-    
-        <attribute name="remotecontext" value="null" />
-    
-        <attribute name="dataobject" value="null" />
-
-        <attribute name="responder" value="null" />
-               
-        <!--- Data handling event. args="value"  -->
-        <event name="ondata" />
-
-        <!--- Error handling event. -->
-        <event name="onerror"/>
-
-        <!--- Call the remote method, passing the array of params. -->
-        <method name="callRPC" args="params"><![CDATA[
-            if (this.funcname == null) {
-                //Debug.write("No funcname given");
-                if (this.onerror) this.onerror.sendEvent("No funcname given");
-                return;
-            }
-
-            if (params == null) {
-                params = new Array();
-
-                var subnodes = this.subnodes;
-                if (subnodes != null) {
-                    var i;
-                    var n = subnodes.length;
-                    for (i = 0; i < n; i++) {
-                        // If getValue method is declared in param, call that
-                        // instead to get value.
-                        var tsi = subnodes[i];
-                        //TODO: fixme
-                        //if ((tsi["getValue"] != null) && 
(tsi.getValue["prototype"] != null)) {
-                        //    params[i] = tsi.getValue();
-                        //    Debug.write("tsi.getValue():", tsi.getValue());
-                        //} else {
-                        //    params[i] = tsi.value;
-                        //}
-                        params[i] = tsi.getValue();
-                    }
-                }
-
-            } else if (params.__proto__ != Array.prototype) {
-                //Debug.write(this.name, "error: first argument (params) is 
not an array");
-                return -1;
-            }
-
-            //if ($debug) Debug.write("call", this, this.parent, 
this.parent.status);
-            var rtmpObject = null;
-            if (this.parent instanceof lz.rtmpConnection){
-                   rtmpObject = this.parent;
-            } else if(this.remotecontext  instanceof lz.rtmpConnection){
-                   rtmpObject = this.remotecontext;
-            } else {
-                   if ($debug) Debug.warn("ERROR: no remotecontext availible 
abort call", this.funcname, this);
-                   return;
-            }
-               //Debug.write('call', this, rtmpObject, rtmpObject.status);
-               //Debug.write('call', this.remotecontext);
-            if (rtmpObject.debug) Debug.write('call', this, rtmpObject, 
rtmpObject.status);
-            rtmpObject.lastCalled = this;
-
-            this.responder = new Responder(onResult);
-
-            rtmpObject.callRPC(this.funcname, this.responder, params);
-
-          ]]>
-        </method>
-
-        <!--- Handle the result returned from the remote method. -->
-        <method name="onResult" args="value"><![CDATA[
-            // Can be overriden.
-            // Would be great if it can be used with dataobject,
-            // but I don't know how to convert Array/primitive to 
LzDataset/LzDataPointer.
-            ////Debug.write("netremotecall", this, "onResult", value);
-
-            if (this.dataobject!=null) {
-                if ( this.dataobject instanceof LzDataset ) {
-                    //Debug.write("onResult: ",this,value,dataobject);
-                    var element = LzDataElement.valueToElement(value);
-                    this.dataobject.setData(element.childNodes);
-                } else if ( this.dataobject instanceof LzDataElement ) {
-                    var element = LzDataElement.valueToElement(value);
-                    this.dataobject.appendChild( element );
-                } else {
-                    //TODO:fixme
-                    //Debug.warn("dataobject is not LzDataset or 
LzDataElement: ",this,this.dataobject,delegate);
-                }
-            }
-            this.ondata.sendEvent(value);              
-          ]]>
-        </method>
-
-
-    </class>
-
-
-    <!---
-        Net parameter.
-        Element to use inside netremotecall.
-        @todo Document netparam class.
-    -->
-    <class name="netparam" extends="node">
-
-        <!--- The value of the netparam. -->
-        <attribute name="value" value="null"/>
-
-    </class>
+       <!---
+               Net remote call.
+               @todo Document netremotecall class.
+       -->
+       <class name="netremotecall" extends="node">
+               <switch>
+                       <when property="$as3">
+                               <passthrough>
+                                       import flash.net.Responder;
+                               </passthrough>
+                       </when>
+               </switch>
+
+               <!--- Name of the remote function. -->
+               <attribute name="funcname" value="$once{null}" type="string" />
+
+               <attribute name="remotecontext" value="null" />
+
+               <attribute name="dataobject" value="null" />
+
+               <attribute name="responder" value="null" />
+
+               <!--- Data handling event. args="value"  -->
+               <event name="ondata" />
+
+               <!--- Error handling event. -->
+               <event name="onerror"/>
+
+               <!--- Call the remote method, passing the array of params. -->
+               <method name="callRPC" args="params"><![CDATA[
+                       if (this.funcname == null) {
+                               //Debug.write("No funcname given");
+                               if (this.onerror) this.onerror.sendEvent("No 
funcname given");
+                               return;
+                       }
+
+                       if (params == null) {
+                               params = new Array();
+
+                               var subnodes = this.subnodes;
+                               if (subnodes != null) {
+                                       var i;
+                                       var n = subnodes.length;
+                                       for (i = 0; i < n; i++) {
+                                               // If getValue method is 
declared in param, call that
+                                               // instead to get value.
+                                               var tsi = subnodes[i];
+                                               //TODO: fixme
+                                               //if ((tsi["getValue"] != null) 
&& (tsi.getValue["prototype"] != null)) {
+                                               //      params[i] = 
tsi.getValue();
+                                               //      
Debug.write("tsi.getValue():", tsi.getValue());
+                                               //} else {
+                                               //      params[i] = tsi.value;
+                                               //}
+                                               params[i] = tsi.getValue();
+                                       }
+                               }
+
+                       } else if (params.__proto__ != Array.prototype) {
+                               //Debug.write(this.name, "error: first argument 
(params) is not an array");
+                               return -1;
+                       }
+
+                       //if ($debug) Debug.write("call", this, this.parent, 
this.parent.status);
+                       var rtmpObject = null;
+                       if (this.parent instanceof lz.rtmpConnection){
+                               rtmpObject = this.parent;
+                       } else if(this.remotecontext  instanceof 
lz.rtmpConnection){
+                               rtmpObject = this.remotecontext;
+                       } else {
+                               if ($debug) Debug.warn("ERROR: no remotecontext 
availible abort call", this.funcname, this);
+                               return;
+                       }
+                       //Debug.write('call', this, rtmpObject, 
rtmpObject.status);
+                       //Debug.write('call', this.remotecontext);
+                       if (rtmpObject.debug) Debug.write('call', this, 
rtmpObject, rtmpObject.status);
+                       rtmpObject.lastCalled = this;
+
+                       this.responder = new Responder(onResult);
+
+                       rtmpObject.callRPC(this.funcname, this.responder, 
params);
+
+               ]]>
+               </method>
 
+               <!--- Handle the result returned from the remote method. -->
+               <method name="onResult" args="value"><![CDATA[
+                       // Can be overriden.
+                       // Would be great if it can be used with dataobject,
+                       // but I don't know how to convert Array/primitive to 
LzDataset/LzDataPointer.
+                       ////Debug.write("netremotecall", this, "onResult", 
value);
+
+                       if (this.dataobject!=null) {
+                               if ( this.dataobject instanceof LzDataset ) {
+                                       //Debug.write("onResult: 
",this,value,dataobject);
+                                       var element = 
LzDataElement.valueToElement(value);
+                                       
this.dataobject.setData(element.childNodes);
+                               } else if ( this.dataobject instanceof 
LzDataElement ) {
+                                       var element = 
LzDataElement.valueToElement(value);
+                                       this.dataobject.appendChild( element );
+                               } else {
+                                       //TODO:fixme
+                                       //Debug.warn("dataobject is not 
LzDataset or LzDataElement: ",this,this.dataobject,delegate);
+                               }
+                       }
+                       this.ondata.sendEvent(value);
+               ]]>
+               </method>
+       </class>
+
+       <!---
+               Net parameter.
+               Element to use inside netremotecall.
+               @todo Document netparam class.
+       -->
+       <class name="netparam" extends="node">
+               <!--- The value of the netparam. -->
+               <attribute name="value" value="null"/>
+       </class>
 
 </library>

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/c79c1213/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/SwfPanel.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/SwfPanel.java 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/SwfPanel.java
index d98dd4b..b8a55bf 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/SwfPanel.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/SwfPanel.java
@@ -18,43 +18,45 @@
  */
 package org.apache.openmeetings.web.room;
 
+import static 
org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter.FLASH_NATIVE_SSL;
+import static 
org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter.FLASH_PORT;
+import static 
org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter.FLASH_SECURE;
+import static 
org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter.FLASH_SSL_PORT;
+import static org.apache.openmeetings.util.OpenmeetingsVariables.webAppRootKey;
+import static org.apache.openmeetings.web.app.Application.getBean;
 import static org.apache.wicket.RuntimeConfigurationType.DEVELOPMENT;
 
+import java.net.URL;
+
+import org.apache.openmeetings.core.remote.red5.ScopeApplicationAdapter;
 import org.apache.openmeetings.web.app.Application;
-import org.apache.openmeetings.web.app.WebSession;
 import org.apache.openmeetings.web.common.BasePanel;
-import org.apache.wicket.ajax.AbstractDefaultAjaxBehavior;
+import org.apache.openmeetings.web.common.OmAjaxClientInfoBehavior;
+import org.apache.openmeetings.web.util.ExtendedClientProperties;
 import org.apache.wicket.ajax.AjaxRequestTarget;
 import org.apache.wicket.markup.head.IHeaderResponse;
 import org.apache.wicket.markup.head.JavaScriptHeaderItem;
-import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
 import org.apache.wicket.markup.head.PriorityHeaderItem;
-import org.apache.wicket.protocol.http.ClientProperties;
+import org.apache.wicket.protocol.http.request.WebClientInfo;
 import org.apache.wicket.request.mapper.parameter.PageParameters;
 import org.apache.wicket.request.mapper.parameter.PageParametersEncoder;
 import org.apache.wicket.request.resource.JavaScriptResourceReference;
 import org.apache.wicket.request.resource.ResourceReference;
 import org.apache.wicket.util.string.StringValue;
 import org.apache.wicket.util.string.Strings;
+import org.red5.logging.Red5LoggerFactory;
+import org.slf4j.Logger;
 
 import com.github.openjson.JSONArray;
 import com.github.openjson.JSONObject;
 
 public class SwfPanel extends BasePanel {
        private static final long serialVersionUID = 1L;
+       private final static Logger log = 
Red5LoggerFactory.getLogger(SwfPanel.class, webAppRootKey);
        public static final String SWF = "swf";
        public static final String SWF_TYPE_NETWORK = "network";
        public static final String SWF_TYPE_SETTINGS = "settings";
        private final PageParameters pp;
-       private final AbstractDefaultAjaxBehavior panelLoaded = new 
AbstractDefaultAjaxBehavior() {
-               private static final long serialVersionUID = 1L;
-
-               @Override
-               protected void respond(AjaxRequestTarget target) {
-                       PageParameters spp = new PageParameters(pp);
-                       target.appendJavaScript(getInitFunction(spp));
-               }
-       };
 
        public SwfPanel(String id) {
                this(id, new PageParameters());
@@ -68,7 +70,17 @@ public class SwfPanel extends BasePanel {
        @Override
        protected void onInitialize() {
                super.onInitialize();
-               add(panelLoaded);
+               add(new OmAjaxClientInfoBehavior() {
+                       private static final long serialVersionUID = 1L;
+
+                       @Override
+                       protected void onClientInfo(AjaxRequestTarget target, 
WebClientInfo info) {
+                               super.onClientInfo(target, info);
+                               ExtendedClientProperties cp = 
(ExtendedClientProperties)info.getProperties();
+                               PageParameters spp = new PageParameters(pp);
+                               target.appendJavaScript(getInitFunction(spp, 
cp));
+                       }
+               });
        }
 
        private static ResourceReference newResourceReference() {
@@ -79,10 +91,9 @@ public class SwfPanel extends BasePanel {
        public void renderHead(IHeaderResponse response) {
                super.renderHead(response);
                response.render(new 
PriorityHeaderItem(JavaScriptHeaderItem.forReference(newResourceReference())));
-               
response.render(OnDomReadyHeaderItem.forScript(panelLoaded.getCallbackScript()));
        }
 
-       public String getInitFunction(PageParameters pp) {
+       public String getInitFunction(PageParameters pp, 
ExtendedClientProperties cp) {
                String initStr = null;
                StringValue type = pp.get(SWF);
                String swf = getFlashFile(type);
@@ -110,9 +121,25 @@ public class SwfPanel extends BasePanel {
                                                , "save.success");
                        }
                        JSONObject options = new JSONObject().put("src", swf + 
new PageParametersEncoder().encodePageParameters(pp));
-                       ClientProperties cp = 
WebSession.get().getClientInfo().getProperties();
                        options.put("wmode", cp.isBrowserInternetExplorer() && 
cp.getBrowserVersionMajor() == 11 ? "opaque" : "direct");
-                       initStr = String.format("var labels = %s; 
initSwf(%s);", lbls, options.toString());
+
+                       JSONObject s = new JSONObject();
+                       try {
+                               URL url = new URL(cp.getCodebase());
+                               String path = url.getPath();
+                               path = path.substring(1, path.indexOf('/', 2) + 
1);
+                               JSONObject gs = 
getBean(ScopeApplicationAdapter.class).getFlashSettings();
+                               s.put("flashProtocol", 
gs.getBoolean(FLASH_SECURE) ? "rtmps" : "rtmp")
+                                               .put("flashPort", 
gs.getBoolean(FLASH_SECURE) ? gs.getString(FLASH_SSL_PORT) : 
gs.getString(FLASH_PORT))
+                                               .put("proxy", 
gs.getBoolean(FLASH_NATIVE_SSL) ? "best" : "none")
+                                               .put("httpProtocol", 
url.getProtocol())
+                                               .put("httpPort", url.getPort())
+                                               .put("host", url.getHost())
+                                               .put("path", path);
+                       } catch (Exception e) {
+                               log.error("Error while constructing video 
settings parameters", e);
+                       }
+                       initStr = String.format("labels = %s; config = %s; 
initSwf(%s);", lbls, s, options.toString());
                }
                return initStr;
        }

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/c79c1213/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/VideoSettings.java
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/VideoSettings.java
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/VideoSettings.java
index 0b9a08c..fad5838 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/VideoSettings.java
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/VideoSettings.java
@@ -80,7 +80,7 @@ public class VideoSettings extends Panel {
                        String path = url.getPath();
                        path = path.substring(1, path.indexOf('/', 2) + 1) + 
scope;
                        if (gs.getBoolean(FLASH_SECURE)) {
-                               s.put(FLASH_NATIVE_SSL, 
gs.get(FLASH_NATIVE_SSL));
+                               s.put(FLASH_NATIVE_SSL, 
gs.getBoolean(FLASH_NATIVE_SSL));
                                s.put(URL, getUri("rtmps", url.getHost(), 
gs.getString(FLASH_SSL_PORT), path));
                                s.put(FALLBACK, getUri("rtmps", url.getHost(), 
url.getPort(), path));
                        } else {

http://git-wip-us.apache.org/repos/asf/openmeetings/blob/c79c1213/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/swf-functions.js
----------------------------------------------------------------------
diff --git 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/swf-functions.js
 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/swf-functions.js
index 5ecc512..393ba41 100644
--- 
a/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/swf-functions.js
+++ 
b/openmeetings-web/src/main/java/org/apache/openmeetings/web/room/swf-functions.js
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
+var labels, config;
 function initSwf(_options) {
        var options = $.extend({
                allowfullscreen : 'true',
@@ -44,6 +44,15 @@ function initSwf(_options) {
                .attr('pluginspage', 
'http://www.macromedia.com/go/getflashplayer');
        $('#swfloading').after($('<div 
id="lzappContainer">').append(embed)).width('1px').height('1px');
 }
+function loadingComplete() {
+       document.getElementById("swfloading").style.display = 'none';
+       var lzApp = document.getElementById("lzappContainer");
+       lzApp.style.width = '100%';
+       lzApp.style.height = '100%';
+}
 function getStringLabels() {
        return labels;
 }
+function getConfig() {
+       return config;
+}

Reply via email to