You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2017/11/19 14:44:03 UTC

openmeetings git commit: [OPENMEETINGS-1764] all types of connection seems to work

Repository: openmeetings
Updated Branches:
  refs/heads/4.0.x 0ee01d170 -> ad4859841


[OPENMEETINGS-1764] all types of connection seems to work


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

Branch: refs/heads/4.0.x
Commit: ad4859841a5930588599908f9b528105406447fb
Parents: 0ee01d1
Author: Maxim Solodovnik <so...@gmail.com>
Authored: Sun Nov 19 21:43:54 2017 +0700
Committer: Maxim Solodovnik <so...@gmail.com>
Committed: Sun Nov 19 21:43:54 2017 +0700

----------------------------------------------------------------------
 .../flex/org/apache/openmeetings/OmVideo.as     | 113 ++++++++++---------
 1 file changed, 60 insertions(+), 53 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/openmeetings/blob/ad485984/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
----------------------------------------------------------------------
diff --git a/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as b/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
index a4d21e6..7b4077b 100644
--- a/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
+++ b/openmeetings-flash/src/main/flex/org/apache/openmeetings/OmVideo.as
@@ -20,6 +20,7 @@ package org.apache.openmeetings {
 import flash.events.AsyncErrorEvent;
 import flash.events.NetStatusEvent;
 import flash.events.IOErrorEvent;
+import flash.events.SecurityErrorEvent;
 import flash.external.ExternalInterface;
 import flash.media.Camera;
 import flash.media.H264Level;
@@ -219,68 +220,74 @@ public class OmVideo {
 		}
 	}
 
-	private function _connect(_url:String):void {
+	private function _connect(_url:String, callback:Function):void {
+		nc = new NetConnection();
+		nc.addEventListener(NetStatusEvent.NET_STATUS, function (e:NetStatusEvent):void {
+			debug("ConnectionStatus: " + e.info.code + ", fallback ? " + fallback);
+			switch (e.info.code) {
+				case 'NetConnection.Connect.Failed':
+				case 'NetConnection.Connect.Rejected':
+					if (!fallback) {
+						fallback = true;
+						url = params.fallback;
+						_connect(url, callback);
+					}
+					break;
+				case 'NetConnection.Connect.Success':
+					callback();
+					break;
+			}
+		});
+		nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, function (event:AsyncErrorEvent):void {
+			debug("OmVideo Async error" + event);
+		});
+		nc.addEventListener(SecurityErrorEvent.SECURITY_ERROR, function (event:SecurityErrorEvent):void {
+			debug("OmVideo Security error" + event);
+		});
+		nc.client = {
+			onMetaData: function (infoObject:Object):void {
+				debug("onMetaData::", infoObject);
+			}
+			, onBWDone: function(...rest):void {
+				debug("onBWDone");
+			}
+			, onBWCheck: function(...rest):Number {
+				debug("onBWCheck");
+				return 0;
+			}
+			, setId: function (id:Number):void {
+				debug("id: " + id); //TODO save connection id
+			}
+			, setUid: function (_uid:String):void {
+				params.selfUid = _uid;
+				debug("setUid :: ", params);
+			}
+			, newScreenCursor: function(arr:Array):void {
+				if (arr.length > 2 && params.uid === arr[0]) {
+					cursorCbk(arr[1] * zoomX(), arr[2] * zoomY());
+				}
+			}
+			, sendVarsToMessageWithClient: function(obj:Object):void {
+				if ("copiedText" === obj[0]) {
+					ExternalInterface.call("Room.showClipboard", obj[1]);
+				}
+			}
+		};
+		var nativeSsl:Boolean = 'true' === params.native;
+		debug("native ? " + nativeSsl + " " + _url);
+		nc.proxyType = nativeSsl ? 'best' : 'none';
 		nc.connect(_url, {
 			sid: params.sid
 			, roomClient: true
-			, nativeSsl: 'best' === params.proxyType
+			, nativeSsl: nativeSsl
 		});
 	}
 
 	public function connect(callback:Function):void {
 		if (nc === null || !nc.connected) {
-			url = params.url;
 			debug("NetConnection is not connected", url);
-			nc = new NetConnection();
-			nc.addEventListener(NetStatusEvent.NET_STATUS, function onConnectionStatus(e:NetStatusEvent):void {
-				debug("ConnectionStatus: " + e.info.code);
-				switch (e.info.code) {
-					case 'NetConnection.Connect.Failed':
-						if (!fallback) {
-							fallback = true;
-							url = params.fallback;
-							_connect(url);
-						}
-						break;
-					case 'NetConnection.Connect.Success':
-						callback();
-						break;
-					//TODO other cases
-				}
-			});
-			nc.addEventListener(AsyncErrorEvent.ASYNC_ERROR, function (event:AsyncErrorEvent):void {
-				debug("OmVideo Async error" + event);
-			});
-			nc.client = {
-				onMetaData: function (infoObject:Object):void {
-					debug("onMetaData::", infoObject);
-				}
-				, onBWDone: function(...rest):void {
-					debug("onBWDone");
-				}
-				, onBWCheck: function(...rest):Number {
-					debug("onBWCheck");
-					return 0;
-				}
-				, setId: function (id:Number):void {
-					debug("id: " + id); //TODO save connection id
-				}
-				, setUid: function (_uid:String):void {
-					params.selfUid = _uid;
-					debug("setUid :: ", params);
-				}
-				, newScreenCursor: function(arr:Array):void {
-					if (arr.length > 2 && params.uid === arr[0]) {
-						cursorCbk(arr[1] * zoomX(), arr[2] * zoomY());
-					}
-				}
-				, sendVarsToMessageWithClient: function(obj:Object):void {
-					if ("copiedText" === obj[0]) {
-						ExternalInterface.call("Room.showClipboard", obj[1]);
-					}
-				}
-			};
-			_connect(url);
+			url = params.url;
+			_connect(url, callback);
 		} else {
 			callback();
 		}