muaz-khan / RTCMultiConnection

RTCMultiConnection is a WebRTC JavaScript library for peer-to-peer applications (screen sharing, audio/video conferencing, file sharing, media streaming etc.)
https://muazkhan.com:9001/
MIT License
2.57k stars 1.37k forks source link

Black screen and disconnect #869

Open evertronico1 opened 4 years ago

evertronico1 commented 4 years ago

Hello Mr Muaz Khan I create the room and when the client enters, only a black screen appears and then disappears. Sometimes it works.

Here are some debug:

Set local description for remote user hehyome1unm RTCMultiConnection.js:5840:25 Your candidate pairs: candidate:0 1 UDP 2122252543 192.168.0.105 50848 typ host RTCMultiConnection.js:3394:25 Your candidate pairs: candidate:5 1 TCP 2105524479 192.168.0.105 9 typ host tcptype active RTCMultiConnection.js:3394:25 Your candidate pairs: candidate:0 2 UDP 2122252542 192.168.0.105 50849 typ host RTCMultiConnection.js:3394:25 Your candidate pairs: candidate:5 2 TCP 2105524478 192.168.0.105 9 typ host tcptype active RTCMultiConnection.js:3394:25 Your candidate pairs: candidate:0 1 UDP 2122252543 192.168.0.105 50850 typ host RTCMultiConnection.js:3394:25 Your candidate pairs: candidate:5 1 TCP 2105524479 192.168.0.105 9 typ host tcptype active RTCMultiConnection.js:3394:25 Your candidate pairs: candidate:0 2 UDP 2122252542 192.168.0.105 50851 typ host RTCMultiConnection.js:3394:25 Your candidate pairs: candidate:5 2 TCP 2105524478 192.168.0.105 9 typ host tcptype active RTCMultiConnection.js:3394:25 Your candidate pairs: candidate:1 1 UDP 1686052863 45.227.146.4 50848 typ srflx raddr 192.168.0.105 rport 50848 RTCMultiConnection.js:3394:25 Your candidate pairs: candidate:1 2 UDP 1686052862 45.227.146.4 50849 typ srflx raddr 192.168.0.105 rport 50849 RTCMultiConnection.js:3394:25 Remote peer's sdp: v=0

o=- 7713223996396356072 2 IN IP4 127.0.0.1

s=-

t=0 0

a=group:BUNDLE 0 1

a=msid-semantic: WMS GyI726mV9ea8v9Lc9HJtSPvthx4wl3RuYyYg

m=audio 9 UDP/TLS/RTP/SAVPF 109 9 0 8 101

c=IN IP4 0.0.0.0

a=rtcp:9 IN IP4 0.0.0.0

a=ice-ufrag:x+gT

a=ice-pwd:V7hZia/aGtHOXxQyI1h8REAP

a=ice-options:trickle

a=fingerprint:sha-256 21:E2:C7:B1:C0:0B:0E:93:9C:B7:DD:9D:B7:FB:F9:AE:EC:D7:0D:2F:45:97:05:70:60:EC:B8:DF:47:DD:5E:69

a=setup:active

a=mid:0

a=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level

a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid

a=sendrecv

a=msid:GyI726mV9ea8v9Lc9HJtSPvthx4wl3RuYyYg 97e27d81-a11f-43d1-8b07-54b3f7c6776d

a=rtcp-mux

a=rtpmap:109 opus/48000/2

a=fmtp:109 minptime=10;useinbandfec=1

a=rtpmap:9 G722/8000

a=rtpmap:0 PCMU/8000

a=rtpmap:8 PCMA/8000

a=rtpmap:101 telephone-event/8000

a=ssrc:476856675 cname:ytLkwGafKxZdL6ZE

m=video 9 UDP/TLS/RTP/SAVPF 120 121 126 97

c=IN IP4 0.0.0.0

a=rtcp:9 IN IP4 0.0.0.0

a=ice-ufrag:x+gT

a=ice-pwd:V7hZia/aGtHOXxQyI1h8REAP

a=ice-options:trickle

a=fingerprint:sha-256 21:E2:C7:B1:C0:0B:0E:93:9C:B7:DD:9D:B7:FB:F9:AE:EC:D7:0D:2F:45:97:05:70:60:EC:B8:DF:47:DD:5E:69

a=setup:active

a=mid:1

a=extmap:5 urn:ietf:params:rtp-hdrext:toffset

a=extmap:4 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time

a=extmap:6 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay

a=extmap:3 urn:ietf:params:rtp-hdrext:sdes:mid

a=sendrecv

a=msid:GyI726mV9ea8v9Lc9HJtSPvthx4wl3RuYyYg 4965f6dc-a597-497c-a02b-ae4e8d3c0cae

a=rtcp-mux

a=rtpmap:120 VP8/90000

a=rtcp-fb:120 goog-remb

a=rtcp-fb:120 ccm fir

a=rtcp-fb:120 nack

a=rtcp-fb:120 nack pli

a=rtpmap:121 VP9/90000

a=rtcp-fb:121 goog-remb

a=rtcp-fb:121 ccm fir

a=rtcp-fb:121 nack

a=rtcp-fb:121 nack pli

a=fmtp:121 profile-id=0

a=rtpmap:126 H264/90000

a=rtcp-fb:126 goog-remb

a=rtcp-fb:126 ccm fir

a=rtcp-fb:126 nack

a=rtcp-fb:126 nack pli

a=fmtp:126 level-asymmetry-allowed=1;packetization-mode=1;profile-level-id=42e01f

a=rtpmap:97 H264/90000

a=rtcp-fb:97 goog-remb

a=rtcp-fb:97 ccm fir

a=rtcp-fb:97 nack

a=rtcp-fb:97 nack pli

a=fmtp:97 level-asymmetry-allowed=1;packetization-mode=0;profile-level-id=42e01f

a=ssrc:1239735924 cname:ytLkwGafKxZdL6ZE

RTCMultiConnection.js:745:29 Remote peer's candidate pairs: candidate:3350409123 1 udp 2122260223 192.168.0.101 54653 typ host generation 0 ufrag x+gT network-id 1 network-cost 10 RTCMultiConnection.js:756:29 Remote peer's candidate pairs: candidate:2301678419 1 tcp 1518280447 192.168.0.101 9 typ host tcptype active generation 0 ufrag x+gT network-id 1 network-cost 10 RTCMultiConnection.js:756:29 Remote peer's candidate pairs: candidate:1190865175 1 udp 1686052607 187.87.123.199 5515 typ srflx raddr 192.168.0.101 rport 54653 generation 0 ufrag x+gT network-id 1 network-cost 10 RTCMultiConnection.js:756:29 Your candidate pairs: RTCMultiConnection.js:3394:25 Peer connection is closed between you & hehyome1unm Object { } state: failed RTCMultiConnection.js:5749:29 Peer connection is closed between you & hehyome1unm Object { } state: closed RTCMultiConnection.js:5749:29 ICE failed, add a TURN server and see about:webrtc for more details AbortError: The fetching process for the media resource was aborted by the user agent at the user's request. hehyome1unm offline

My code open.

connection.getExternalIceServers = false;

    connection.rtcConfiguration = {
        iceTransports: 'relay' // none || relay || all - ref: http://goo.gl/40I39K
    };
    connection.iceServers = [];                  
    connection.iceServers = [{
      'urls': [
      'stun:stun.l.google.com:19302',
      'stun:stun1.l.google.com:19302',
      'stun:stun2.l.google.com:19302',
      'stun:stun.l.google.com:19302?transport=udp',
      ]
        }];

connection.open(document.getElementById('room-id').value, function(isRoomOpened, roomid, error) { console.log('teste); });

My code join:

// END_FIX_VIDEO_AUTO_PAUSE_ISSUES connection.getExternalIceServers = false;

    connection.rtcConfiguration = {
        iceTransports: 'relay' // none || relay || all - ref: http://goo.gl/40I39K
    };

    // first step, ignore default STUN+TURN servers
   connection.iceServers = [];                  
    connection.iceServers = [{
        'urls': [
            'stun:stun.l.google.com:19302',
            'stun:stun1.l.google.com:19302',
            'stun:stun2.l.google.com:19302',
            'stun:stun.l.google.com:19302?transport=udp',
        ]
    }];

    connection.join('<?php echo get_componente(); ?>', function(isRoomJoined, roomid, error) {
        if(isRoomJoined === false) {
            alert(error); // maybe room doesn't exist or room is full or password is invalid
        }
        else {
            alert('Successfully joined the room.');
        }
    });
juliangorge commented 4 years ago

what's device are you using? check out this: https://github.com/muaz-khan/RTCMultiConnection/issues/478

evertronico1 commented 4 years ago

I already looked, the problem appears from any browser. And that happens only on some internet. It seems to me that it is something related to nat or firewall, I have tried many types of Stun and all of them have the same problem, I even installed a Stun server and nothing worked.

image

It stays like this for a few seconds and then disconnects and this message appears:

Your candidate pairs: candidate:1 2 UDP 1686052862 45.227.146.4 51541 typ srflx raddr 192.168.0.105 rport 51541 RTCMultiConnection.js:3394:25 Your candidate pairs: RTCMultiConnection.js:3394:25 Peer connection is closed between you & dv2p6j116kv7antp1g Object { } state: closed RTCMultiConnection.js:5749:29 AbortError: The fetching process for the media resource was aborted by the user agent at the user's request. dv2p6j116kv7antp1g offline RTCMultiConnection.js:5630:25 InvalidStateError: RTCPeerConnection is gone (did you enter Offline mode?)

juliangorge commented 4 years ago

using video conferencing demo, i’ve got same problem iOS to iOS

RezaErfani67 commented 4 years ago

chrome show black screen and firefox show black screen with disconnection

rahul7827 commented 2 years ago

I already looked, the problem appears from any browser. And that happens only on some internet. It seems to me that it is something related to nat or firewall, I have tried many types of Stun and all of them have the same problem, I even installed a Stun server and nothing worked.

image

It stays like this for a few seconds and then disconnects and this message appears:

Your candidate pairs: candidate:1 2 UDP 1686052862 45.227.146.4 51541 typ srflx raddr 192.168.0.105 rport 51541 RTCMultiConnection.js:3394:25 Your candidate pairs: RTCMultiConnection.js:3394:25 Peer connection is closed between you & dv2p6j116kv7antp1g Object { } state: closed RTCMultiConnection.js:5749:29 AbortError: The fetching process for the media resource was aborted by the user agent at the user's request. dv2p6j116kv7antp1g offline RTCMultiConnection.js:5630:25 InvalidStateError: RTCPeerConnection is gone (did you enter Offline mode?)

I am also facing the same issue, But when i checked myip against spam/blacklist. I found that blackscreen issue only happening with blacklisted/spammed IP. When i changed my ip it was working good.

@evertronico1 Did you find its fix, I too trying to setup my own STUN/TURN. If you have any solution please guide me with this. Thank you.

webleb commented 2 years ago

connection.getExternalIceServers = false;

you need to set this to true