mganeko / mediasoup_sample

Multiple participants sample for WebRTC SFU mediasoup with node.js
MIT License
39 stars 14 forks source link

Can't get example to work #5

Closed MrMoronIV closed 5 years ago

MrMoronIV commented 6 years ago

Hello,

I hope you can help me:

  1. I've installed your project including mediasoup 1.2.8
  2. Using mediasoup_sample_multi_ssl.js 3 . I've set the server script to listen on an open port on my server (works)
  3. I've setup the actual domain certificates in the cert folder (works)
  4. I started the server on the command line (works)
  5. I've opened index_ssl.html in the browser Opera
  6. Websocket runs fine
  7. Webcam and audio are enabled just fine
  8. Clicking connect says ice connection state=connected
  9. I've added my own STUN and TURN server which it uses to connect (seems to work) I can see packages being transfered, not sure whereto though
  10. I open another browser (chrome) and do the same with a different CAm and audio source (works) 12 Result: nothing happens

This is the server log: $ node mediasoup_sample_multi_ssl.js websocket server start. port=8440 Web server start. https://serverurl:8440/ server.createRoom() succeeded client connected. id=member_1 , total clients=1 received id=member_1 type=call got call from id=member_1 send Offer to id=member_1 --- create RTCPeerConnection -- -- peers in the room = 1 peerconnection.setCapabilities() OK offer to id=member_1 -- PeerConnection.signalingstatechanged, state=have-local-offer peer.dump after createOffer transports=1 receivers=0 senders=0 --- sending sdp --- sendto:member_1 type:offer client connected. id=member_2 , total clients=2 received id=member_2 type=call got call from id=member_2 send Offer to id=member_2 --- create RTCPeerConnection -- -- peers in the room = 2 peerconnection.setCapabilities() OK offer to id=member_2 -- PeerConnection.signalingstatechanged, state=have-local-offer peer.dump after createOffer transports=1 receivers=0 senders=0 --- sending sdp --- sendto:member_2 type:offer

Any suggestions? It would mean the world for me if this gets working somehow.

In addition when I throw Firefox in the mix it says in the console ==***== ice gathering state=complete index_ssl.html:269:7 empty ice event index_ssl.html:233:9 == ice connection state=failed index_ssl.html:258:7 -- failed, so give up -- index_ssl.html:264:9 Hang up. index_ssl.html:389:7 == ice connection state=closed index_ssl.html:258:7 == signaling state=closed index_ssl.html:255:7 ICE failed, see about:webrtc for more details

Chrome/Opera doesn't complain at all

mganeko commented 6 years ago

Hello, thank you for your interest in this project. I do not find what is happening in this case right now. I would like to confirm in my server.

For additional information, would you tell me your version of Chrome / Firefox ?

mganeko commented 6 years ago

I guess you need configuration for your STUN/TURN server in public/index_ssl.html, around line 182. https://github.com/mganeko/mediasoup_sample/blob/aa2932f8e14203b106d58e1e9e7f6a3dad9a40a7/public/index_ssl.html#L182

// example 1
let pc_config = {"iceServers":[{"urls": "stun:stun.l.google.com:19302"}]};

// example 2
var pc_config = {"iceServers":[
      {"urls":"stun:turn.yourserver.com:80"},
      {"urls":"turn:turn.yourserver.com:443?transport=tcp", "username":"youruser", "credential":"yourpassword"}
    ]};

Would you confirm your index_ssl.html ?

MrMoronIV commented 6 years ago

I already had the stun and turn servers configured indeed, the only difference is the port: 8449

I'm on windows 7: Chrome: 63.0.3239.132 Opera: 50.0.2762.58 Firefox: 57.0.4

The mediasoup demo here is working for me: https://demo.mediasoup.org/ I also can't install this other demo cause it gives me errors all over the place while running the NPM install

For some reason when a user joins the index_ssl.html page and connects it never receives the other streams.

In regard to the TURN server, isn't that what mediasoup is supposed to handle? Why would a turn server relay a stream to mediasoup, isn't this an unnecessary double setup? The turn and mediasoup server are on the same machine btw, which is a real public server, not localhost.

mganeko commented 6 years ago

I already had the stun and turn servers configured indeed I see.

I tested on Mac OS 10.12.6. It seems to working correctly. Chrome: 63.0.3239.132 Opera: 50.0.2762.58 Firefox: 57.0.4 I have not figured out what happening to you.

Regarding STUN server and TURN server, you have mediasoup in internet with global IP adsress, I think you do not need STUN server actually. If your client is inside of restricted network such as enterprise, you may need TURN server to use flxed port or TCP.

MrMoronIV commented 6 years ago

You see what I think the problem is, is that the TURN server catches the connection correctly but doesn't send it to the right place, do you have any idea how is should configure my TURN server so it sends its data to your mediasoup script?

If I leave out my turn server in index_ssl.html it simply never gets to the connected state.

I must admit I'm on a fancy internet setup, but if I get this to works somehow I'm really confident that it will always work.

MrMoronIV commented 6 years ago

Do you happen to have a public index_ssl.html up that I can test to confirm there is a problem on my end and not just with the script? If only accessible for a day would be fine, just to quickly confirm the problem is on my end :)

mganeko commented 6 years ago

I prepare tentative server. https://coturn.talkin.info/index_ssl.html Will you try it?

MrMoronIV commented 6 years ago

Thank you,

So your page somewhat works, chrome to opera seems to work first try. When I throw Firefox in the mix, Opera console gives me:

index_ssl.html:320 setRemoteDescription(offer) ERROR: DOMException: Failed to parse SessionDescription. a=ssrc:1702143352 msid Failed to get the ssrc attribute value from msid. Expected format :.

What does planB mean / do on your page? It seems a little confusing why that checkbox is there / needed. Only connectig ovver planB seems to be working? not sure though...

Also, after I made a successful connection in chrome to opera and showing both cams, it doesn't work anymore after that, console gives (after a retry) Received offer ... index_ssl.html:303 peerConnection alreay exist, reuse it

Which is weird since I disconnected and reloaded the page in both browsers, the videos don't show up anymore as well after that one successful connection. But after a while of not using the script, it works again! pretty weird. After some more tests it seems to be an issue when you try connecting with and without planB checked. Somehow things are going funky then.

So although it seems to be working, it's pretty buggy as well. But I think the test case is a success, it works on your site.

I copied your turn and stun servers in my script to see if that would make any difference, it didn't. So the stun/turn server is not the problem. Or does your Turn server have a special setting that makes it work with mediasoup?

If only I knew what the difference was between our servers.

  1. On what port do you run your multi_ssl.js script?

I'm running the nodejs server on port 8440, could that be the problem somehow? This port is opened in the firewall though, the page seems to work fine at first glance. I think yours runs on port 80?

Do you have any idea what else it could be?

I'm also running apache on the same server, which handles port 80, I could use a proxypass if port 80 is required for this nodejs script.

If only this would work one day :p

mganeko commented 6 years ago

Thank you for trying.

Please check "Use Plan B" for Chrome. I guess Opera needs "Use Plan B" also. Please do not check it for Firefox.

Honestly speaking, I have not tested with Opera.

I use port 433 for node.js server, so I use sudo. I use separate server for node.js (mediasoup) and TURN server. I do not use special setting for mediasoup in my TURN server. Its setting is same as for P2P.

I am sorry that I could not find your reason.

MrMoronIV commented 6 years ago

what does planB do?

Opera is chromium browser btw, basically the same engine as chrome

mganeko commented 6 years ago

There are 2 types of SDP for multiple stream of WebRTC.

In mediasoup v1.x, application has to specify witch type to use.

mganeko commented 5 years ago

Close. For mediasoup v2, please try https://github.com/mganeko/mediasoup_sample_v2