Dan Rossi wrote:
Johannes Nel wrote:theres this:Hi, what exactly is this from what app from adobe, the port checker, it didnt work for me at all as im being a router, so it came up incorrect lol. Here is the additions ive added to my connect helper class, its a little kludgy atm, especially when i cant seem to work out how to send the rest keyword arguments to the super method. The rest of it is kludged aswell so try and fallback to an rtmpt connection on the default port, it obviouslly could use more work on it. public class Connect extends NetConnection { private var code:String; private var _autoBandwidthDetection:Boolean = false; private var _fallBackServer:String; private var params:*; private var connectRetry:int = 0; public var ncInt:Array = new Array(); public function Connect(encodeAMF0:Boolean = true) { setDefaultEncoding(encodeAMF0); super(); this.addEventListener(NetStatusEvent.NET_STATUS, onStatus); } public function set fallBackServer(server:String):void { _fallBackServer = server; } override public function connect(command:String, ... rest):void { this.params = rest; switch (rest.length) { case 0: super.connect(command); break; case 1: super.connect(command, rest[0]); break; case 2: super.connect(command, rest[0], rest[1]); break; case 3: super.connect(command, rest[0], rest[1], rest[2]); break; } } private function parseURL(url:String):Array { return url.split("://") } private function getURL(url:String):String { return parseURL(url)[1]; } private function getProtocol(url:String):String { return parseURL(url)[0]; } private function setDefaultEncoding(encodeAMF0:Boolean = true):void { if (encodeAMF0) { this.objectEncoding = flash.net.ObjectEncoding.AMF0; } else { this.objectEncoding = flash.net.ObjectEncoding.DEFAULT; } } public function onStatus(event:NetStatusEvent):void { switch (event.info.code) { case "NetConnection.Connect.Success": stopReconnect(); break; case "NetConnection.Connect.Failed": nextConnect(); break; } trace(event.info.code); } private function stopReconnect():void { clearInterval(this.ncInt[0]); } private function nextConnect():void { trace("Couldnt connect to " + this.uri); this.ncInt[0] = setInterval(tryFallBack, 1500); } private function tryFallBack():void { if (connectRetry > 1) { stopReconnect(); this.dispatchEvent(new Event("failed")); } else { this.dispatchEvent(new Event("reconnected")); var url:String = getURL(this.uri); this.close(); this.connect("rtmpt://" + url); connectRetry++; } } } |
_______________________________________________ Red5 mailing list [email protected] http://osflash.org/mailman/listinfo/red5_osflash.org
