Hi Charlie,
We implemented this into our wowza player and most of the time it works well. Unfortunately there have been some random instances of our video beginning to play and then being interupted after say 5 seconds with the error message we set to display at your “Failed to connect after “+ncTryIndex+” tries”);" point.
As mentioned it is only happening to a selection of people. We are not sure if it may be a strain on the server perhaps? That somehow sends a failed status when it has actually already connected?
We are using the code like below and replaced nc.connect(serverName) in the doConnect() function in your standard as2 player with tryConnect();
We set init() to run just before mainInit() at the bottom of the standard player.
As mentioned most of the time it works fine and it definitely switches ports if the first one is blocked. Any ideas? Thanks
var ncConnectTimer:Number = 0;
var ncConnectTimeout:Number = 8000; // 8 seconds
var ncDomain:String = “OUR IP”;
var ncProtocol:String = “rtmp”;
var ncProtocol2:String = “rtmpt”;
var ncPort:Number = 1935;
var ncPort2:Number = 80;
var ncApplication:String = “flvsecure”;
var ncTryIndex:Number = 0;
var url:String = “”;
function tryConnect()
{
clearConnectTimer();
switch(ncTryIndex)
{
case 0:
ncConnectTimeout= 8000
url = ncProtocol + “://”+ncDomain+":"+ncPort+"/"+ncApplication;
trace("tried " + url)
break;
case 1:
ncConnectTimeout= 15000
ncPort = ncPort2;
ncProtocol = ncProtocol2;
url = ncProtocol + “://”+ncDomain+":"+ncPort+"/"+ncApplication;
trace("tried " + url)
break;
default:
{trace(“Failed to connect after “+ncTryIndex+” tries”);
url = “”;
statusBox.text=“failed to connect”;
nc.close();
nc=null;
gotoAndStop(2);
}
break;
}
if (url.length > 0)
{
nc.connect(url);
ncConnectTimer = setInterval(_root, “tryReconnect”, ncConnectTimeout);
}
}