Problem deploying Android app with local server

I read this guide https://openvidu.io/docs/tutorials/openvidu-android/. Server is running locally, I visited and tested by visiting the url my_ip:4443 and works good.

But on Android the camera doesn’t open. I’m getting a toast message “error connecting to MY_IP:4443”
I’ve updated the default_openvidu_url string value.

Are you connected to the same network with the device?

Yes. Same wifi is used. Don’t know if it matters but I’m using Windows.

Do you mean that you have deployed OpenVidu Server docker container in a Windows box? Are you using Docker for Windows or Docker Toolbox? Networking is very critical when using WebRTC. I recommend to you to deploy OpenVidu in a ubuntu box to check if works as expected.

If you have AWS account, you can deploy an OpenVidu stack on there, just to test.

Hello,

I have a similar issue, I am going through the tutorials(insecure-angular and library-angular in particular) and I can make it work in localhost(or 127.0.0.1), but as soon as I try to use my LAN IP I cannot connect to the session.
The error I see in console is “Uncaught (in promise): TypeError: Cannot read property ‘enumerateDevices’ of undefined” and indeed the mediadevices is not defined if I am starting the frontend with -host MY_LAN_IP.

FYI:

  • I am using Windows 10
  • I started the openvidu-server-kms:2.14.0 with DOMAIN_OR_PUBLIC_IP=MY_LAN_IP
  • I am able to reach https://MY_LAN_IP:4443/dashboard/# and I can see my video stream
  • anyone in my network can connect to the dashboard
  • everyone in my LAN has the same problem connecting to the session

How should I connect different PCs from my network to a OpenVidu session if front-end can not serve my LAN IP ?

Kind regards,
Mihai.

You need selfsigned certificated to be able to serve your app under https.

Running
ng serve --host LAN_IP --ssl --ssl-key cert.key --ssl-cert cert.crt

and changing the openvidu_url inside of the app (pointing to LAN_IP) should work.

Hello CSantos,

I do not want to access MY_IP in HTTPS, but I did try to do it by creating a self signed certificate for MY_IP, adding it to windows trusted certificates, extrancting a key and cert from it with openssl tool and using the --ssl option for NG as you mentioned above.
This results in an error “Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt” when I try to start my frontend…

Am I forced to go to https in LAN environement?
Cant I just use MY_IP instead of 127.0.0.1 and, by doing so, being able to connect a different PC from my network?

PS: I have also tried to start another frontend from another PC running the -host as localhost, but the OPENVIDU_SERVER_URL as MY_IP:4443.
With two frontends started like this we can join a session, we can see our camera and that someone else is in the session, but their camera or sound are not displayed. Chat seems to be working fine. See attached images below.

Thank you.

Mihai.

The problem is pretty simple:

WebRTC doesn’t work in plain HTTP unless in the navigation bar you see “localhost” or “127.0.0.1”.

That’s it. The browser simply removes all of the WebRTC and Media devices methods from JavaScript under plain HTTP. That’s why you get Cannot read property ‘enumerateDevices’ of undefined” , because MediaDevices object is not available.

So no, you cannot serve your WebRTC app on HTTP unless you connect to it hrough localhost/127.0.0.1 (and I can afirm that only for Google Chrome. Other browsers may be even more restrictive).

@mcernea Try this:

  • run openvidu-server-kms:2.14.0 with -e DOMAIN_OR_PUBLIC_IP=<your_ip>

  • run ng serve --host 0.0.0.0 --ssl true

  • from other machines in your network, open Chrome and go to chrome://flags, find “Insecure origins treated as secure”, fill in https://<your_ip>:4200, set it to “Enabled” and relaunch the browser window. (In Safari you would need to go to “Develop > WebRTC > Allow Media Capture on Insecure Sites”)

  • Go to https://<your_ip>:4200. The browser will complain that the site looks phishy. Click on “Details”, or “Advanced” (or whatever it is called in other browsers), and click “Allow” or “Proceed”

  • Repeat the last step with https://<your_ip>:4443 as well.

2 Likes

@mcernea are suggestions from @ameotoko working for you?

Hi Micael,

Yes, for me, the ”–ssl true” option and marking the server IP and ports to trusted in each client browser made it possible to share the video over LAN.

Thank you.

Please help me to understand
I am developing an android app in java and i am using windows10 and i need to add an library that manager can see employees
And employees can see the manager ,and employees can’t see each others
I downloaded openvidu github sample
But i don’t understand the part of ip,why we should get the ip of computer,
The users will use only mobile devices,please help me with an easy explain,
Thank you