Teaonly / android-eye

Change your android phone to surveillance camera
Other
1.08k stars 492 forks source link

How to stream video not just in a local network ? #11

Open guypld opened 11 years ago

guypld commented 11 years ago

I'm trying to open a connection to a given IP that is not related to local network (WIFI), but it won't work. What is the problem? Thanks.

pastissolo commented 11 years ago

It does work for me!!!

if you are not on a local network than probably you don't have a public ip, because usually phones companies do not provides one to customers; so you are under a NAT and the browser cannot see the device.

i tried many sim cards, and so far only italian Telecom gives you a public ip, and on that connection i can see the video playing; but very slowly.

another trick is to change the timeout of the refreshing of the page in droideye.js line 38: with a small timeout the video will be smoother, for me with 50 ms the video in the browser it's quite similar to the android camera one (on a wifi).
But if your connection is not fast enough to support the refreshing rate(every refreshing is a new image downloaded) than you will see a black screen on your browser (as i experienced on sim card data connection). So in the last case maybe you should higher the timeout; I got the best performances with setTimeout(refreshLive, 50); on a wifi network and setTimeout(refreshLive, 500); on my simcard.

remeber also to have a look to the MainActivity class line 68: you should try different values for "final int maxVideoNumber = 2;" frames are stored in an array of that dimension when i lower the refreshing timeout i have to set maxVideoNumber to 10 or 15.

narcisgarcia commented 9 years ago

In version 2.3 the application shows an error message both if using only phone internet access and if acting as hotspot. Allowing internet access should be user-configurable, and refreshLive parameter too.