Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Call doesn't work when web client create the room #5

Open
digaa opened this issue Mar 23, 2021 · 7 comments
Open

Call doesn't work when web client create the room #5

digaa opened this issue Mar 23, 2021 · 7 comments

Comments

@digaa
Copy link

digaa commented Mar 23, 2021

Hi I tried to use your code before three, four months. At first all worked well, but I had problem with TURN server. When I fixed problem with TURN I find out that call only work when android user first go into the room. At first I think that I maybe create some mistake and bug, so that I downloaded your code and tried again without any changes. Result is same, connection between two clients is established only when web client go as a second user. I am 100% sure that this call works fine no matter who enters first. Do anyone know what is going on and why it doesn't work now?

@djsamseng
Copy link
Contributor

djsamseng commented Jul 24, 2021

Yeah I found that in order to allow the Android app to join second (browser first, then android app joins) I had to make these changes to start streaming the video once both clients were connected to the WebRTC server but before the android app answered the browser's offer. The key change here was that "got user media" was being sent only on doCall. This meant that "got user media" was only sent from the android app to the browser when the android app was the initiator. Thus the android app had to be the initiator (joined first). Always sending "got user media" when the android app wakes up allows for the android app to join second

djsamseng@476e336#diff-d5e563a4c154e88804b40a6bff3b9e0e482d67c2a961229f7d805ff105107b32L123-L305

@cartantino
Copy link

Hi @digaa,
what was your problem with TURN server? And how did you fixed it?
Thanks in advance,
Costantino.

@digaa
Copy link
Author

digaa commented Sep 22, 2021

@cartantino I work on windows server OS so I wasn't able to run Coturn server properly. I lost two weeks finding best replacement for Coturn and trying to run Goturn or some other turn server. Finally I manage to run Coturn using cygwin and after that as I describe in previous comment this app stop works in some situation.

@digaa
Copy link
Author

digaa commented Sep 22, 2021

@djsamseng I'm not on that project anymore but when I get back I'll try it. Thanks

@cartantino
Copy link

@digaa Thanks for your quick response!
If I don't bother you, I'd like to know where in the code you have made the reference for your personal TURN server.
Thanks in advance.

@digaa
Copy link
Author

digaa commented Sep 22, 2021

@cartantino you need to add url and credentials in android and web app. In android you have createPeerConnection method and there you have iceServers array. There you need to add your turn and stun server.

private PeerConnection createPeerConnection(PeerConnectionFactory factory) {
       ArrayList<PeerConnection.IceServer> iceServers = new ArrayList<>();
       iceServers.add(new PeerConnection.IceServer("stun:${ipadress}:${port}"));
       iceServers.add(new PeerConnection.IceServer("turn:${ipadress}:${port}?transport=udp",username,password));
       iceServers.add(new PeerConnection.IceServer("stun:stun.l.google.com:19302"));
     

in web there is similar list that you need to fill with your server data

iceServers: [{
        urls: 'stun:${ipadress}:${port}'
      },{
        urls:'turn:${ipadress}:${port}?transport=udp',
        username: username,
        credential: password
      },{
        urls: 'stun:stun.l.google.com:19302'
      }]
    }

@cartantino
Copy link

Thank you so much!! Did you use coturn to build your own TURN server?

@cartantino you need to add url and credentials in android and web app. In android you have createPeerConnection method and there you have iceServers array. There you need to add your turn and stun server.

private PeerConnection createPeerConnection(PeerConnectionFactory factory) {
       ArrayList<PeerConnection.IceServer> iceServers = new ArrayList<>();
       iceServers.add(new PeerConnection.IceServer("stun:${ipadress}:${port}"));
       iceServers.add(new PeerConnection.IceServer("turn:${ipadress}:${port}?transport=udp",username,password));
       iceServers.add(new PeerConnection.IceServer("stun:stun.l.google.com:19302"));
     

in web there is similar list that you need to fill with your server data

iceServers: [{
        urls: 'stun:${ipadress}:${port}'
      },{
        urls:'turn:${ipadress}:${port}?transport=udp',
        username: username,
        credential: password
      },{
        urls: 'stun:stun.l.google.com:19302'
      }]
    }

Thank you so much!! Did you use coturn to build your own TURN server?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants