Is it possible to access a webcam from lan and from internet at the same time?
I have FMS3 setup on a local ip address with the router forwarding ports to it. But once a request comes in off the internet, they need to be sent out with the routers ip address. Here is an example. If I wanted to access the camera from my lan, I would have the swf point to a local ip address. but if I wanted to access the camera from the internet, I would need to use the router's ip address in the swf otherwise the page I am looking at would try to find the Flash Media Server on that local network. So I found some code that I modified in order to do this in the swf. But am I doing it the hard way. Could I just tell the FMS to interpret forward that come from internet to go out as a different IP address?
Here is what I did with the swf in order to view camera from lan and internet at the same time. I had to put an extra case in for it to actually work.
var nc:NetConnection = new NetConnection();
var ncConnectTimer:Number = 0;
var ncConnectTimeout:Number = 5000; // 5 seconds
var ncTryIndex:Number = 0;
nc.onStatus = function(info:Object)
else if(info.code == "NetConnection.Connect.Failed")
if (ncConnectTimer != 0)
ncConnectTimer = 0;
var url:String = "";
url = "rtmp://x.x.x.207/live/_definst_";
url = "rtmp://192.168.1.1/live/_definst_";
url = "rtmp://192.168.1.76/live/_definst_";
trace("Failed to connect after "+ncTryIndex+" tries");
if (url.length > 0)
ncConnectTimer = setInterval(_root, "tryReconnect", ncConnectTimeout);
cam = Camera.get();
cam.setMode(320, 240, 10);
ns = new NetStream(nc);
//make the player stream too
nsPlayer = new NetStream(nc);