i’m having some problems with converting the BWChecker to AS3.
this is what i’ve got :
var constring="rtmp://localhost/bwcheck";
var detected_bw:String;
var counter:Number=0;
var nc:NetConnection=new NetConnection;
nc.client=this;
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler );
function netStatusHandler (e:NetStatusEvent):void{
trace("Level: "+e.info.level+" Code: "+e.info.code);
if (e.info.code == "NetConnection.Connect.Success") {
trace("--- connected to: " + nc.uri); //this.uri
}
}
function onBWCheck(latency:String):Number{
trace("in onBWCheck");
return ++counter; // Serverside, just ignore any return value, For now return the call count
}
function onBWDone(kbitDown, deltaDown, deltaTime, latency):void{
trace("==>in onBW_DONE");
trace("onBWDone: kbitDown:"+kbitDown+" deltaDown:"+deltaDown+" deltaTime:"+deltaTime+" latency:"+latency);
//detected_bw = kbitDown;
nc.close();
}
nc.connect(constring, true);
stop();
and i get this as a result (haven’t changed anything to serverside code, or is it necessary that i do that?):
in onBWCheck
Level: status Code: NetConnection.Connect.Success
— connected to: rtmp://localhost/bwcheck