sourcey / libsourcey

C++14 evented IO libraries for high performance networking and media based applications
https://sourcey.com/libsourcey
GNU Lesser General Public License v2.1
1.31k stars 347 forks source link

webrtcstreamer black screen on remote connection #216

Closed Biancakr closed 6 years ago

Biancakr commented 6 years ago

At the moment I am trying to make webrtcstreamer working. Currently I am able to send video local, but not remote except when I use the camera in a network that is not behind a NAT (4G).

When the camera is in a network behind NAT, I get a black screen on the client side. The camera is sending data, but the client does not receive this.

Do I need to define the STUN and TURN servers? I have tested with the google STUN server and my own (coTurn). I have configured the STUN and TURN server in the index.ejs.

// WebRTC config
// This is where you would add TURN servers for use in production
WEBRTC_CONFIG = {
    'iceServers': [
        {'url': 'stun:stun.l.google.com:19302'}
    ]
}

and my own:

// WebRTC config
// This is where you would add TURN servers for use in production
WEBRTC_CONFIG = {
    'iceServers': [
        {'url': 'stun:ip-adress:port'},
    {'url': 'stun:ip-adress:port',
     'user': user,
     'credentials': credentials} 
    ]
}

Can someone please help me, give me directions? Kind regards!

Biancakr commented 6 years ago

I am able to setup a remote connection sometimes. But in some cases I still receive no video data, black screen. I have a STUN and TURN server available, so even when STUN can't penetrate trough NAT, TURN must resolve this.

Am I missing something?

Thanks in advance!

ziahamza commented 6 years ago

@auscaster The sample defn seems broken. Video + audio stream does not show properly even if run locally!

auscaster commented 6 years ago

You may have to add STUN or TURN servers if you are viewing the stream remotely. It's best to test on localhost first, so you can debug these host issues later.

These servers should be defined on the C++ server side like so: https://github.com/sourcey/libsourcey/blob/master/src/webrtc/src/peer.cpp#L39

traw commented 6 years ago

Any one succeed in getting it work on Network. I'm trying but didn't succeed so far. So far I tried enabling IceServer uri in Peer.cpp and in index.ejs file, but it only works on localhost but not on network.