angularwebrtcshimzonejs

WebRTC ICE connection fails using Angular between safari and firefox even when ice candidates are gathered


Calling from Firefox 61.0.1 to Safari 11.1.2 results in ICE connection failed after all of the candidates are gathered in the Angular 5.x app.

The app is using webrtc-adapter to add cross-browser support.

Tested browsers:

Platform: macOS High Sierra 10.13.6

All other browsers combinations works.

Here are the webrtc logs from firefox:

insert 'ice' (registry) succeeded: ice

insert 'ice.pref' (registry) succeeded: ice.pref

insert 'ice.pref.type' (registry) succeeded: ice.pref.type

insert 'ice.pref.type.srv_rflx' (UCHAR) succeeded: 0x64

insert 'ice.pref.type.peer_rflx' (UCHAR) succeeded: 0x6e

insert 'ice.pref.type.host' (UCHAR) succeeded: 0x7e

insert 'ice.pref.type.relayed' (UCHAR) succeeded: 0x05

insert 'ice.pref.type.srv_rflx_tcp' (UCHAR) succeeded: 0x63

insert 'ice.pref.type.peer_rflx_tcp' (UCHAR) succeeded: 0x6d

insert 'ice.pref.type.host_tcp' (UCHAR) succeeded: 0x7d

insert 'ice.pref.type.relayed_tcp' (UCHAR) succeeded: 0x00

insert 'stun' (registry) succeeded: stun

insert 'stun.client' (registry) succeeded: stun.client

insert 'stun.client.maximum_transmits' (UINT4) succeeded: 7

insert 'ice.trickle_grace_period' (UINT4) succeeded: 5000

insert 'ice.tcp' (registry) succeeded: ice.tcp

insert 'ice.tcp.so_sock_count' (INT4) succeeded: 0

insert 'ice.tcp.listen_backlog' (INT4) succeeded: 10

insert 'ice.tcp.disable' (char) succeeded: \000

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): failed to create passive TCP host candidate: 3

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): failed to create passive TCP host candidate: 3

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): failed to create passive TCP host candidate: 3

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): failed to create passive TCP host candidate: 3

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): failed to create passive TCP host candidate: 3

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default) has no stream matching stream 0-1531925753097790 (id=25769803783 url=http://localhost:4242/call/1 aLevel=1

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default) has no stream matching stream 0-1531925753097790 (id=25769803783 url=http://localhost:4242/call/1 aLevel=2

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default) no streams with non-empty check lists

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default) no streams with pre-answer requests

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default) no checks to start

Unrecognized attribute: 0x802b

STUN-CLIENT(srflx(IP4:10.0.8.47:57340/UDP|turn.example.com:443)): Received response; processing

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default) pairing local trickle ICE candidate srflx(IP4:10.0.8.47:57340/UDP|turn.example.com:443)

Write buffer not empty for IP4:0.0.0.0:443/TCP 44 - already armed (@0x160026df4), not connected

STUN-CLIENT(relay(IP4:10.0.8.47:57340/UDP|turn.example.com:443)::TURN): Received response; processing

STUN-CLIENT(relay(IP4:10.0.8.47:57340/UDP|turn.example.com:443)::TURN): Error processing response: Retry may be possible, stun error code 401.

Unrecognized attribute: 0x802b

STUN-CLIENT(srflx(IP4:10.0.8.47:53521/UDP|turn.example.com:443)): Received response; processing

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default) pairing local trickle ICE candidate srflx(IP4:10.0.8.47:53521/UDP|turn.example.com:443)

STUN-CLIENT(relay(IP4:10.0.8.47:57340/UDP|turn.example.com:443)::TURN): Received response; processing

TURN(relay(IP4:10.0.8.47:57340/UDP|turn.example.com:443)): Succesfully allocated addr IP4:0.0.0.0:63335/UDP lifetime=3600

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default) pairing local trickle ICE candidate turn-relay(IP4:10.0.8.47:57340/UDP|IP4:0.0.0.0:63335/UDP)

Write buffer not empty for IP4:0.0.0.0:443/TCP 44 - already armed (@0x1600291f4), not connected

STUN-CLIENT(relay(IP4:10.0.8.47:53521/UDP|turn.example.com:443)::TURN): Received response; processing

STUN-CLIENT(relay(IP4:10.0.8.47:53521/UDP|turn.example.com:443)::TURN): Error processing response: Retry may be possible, stun error code 401.

STUN-CLIENT(relay(IP4:10.0.8.47:53521/UDP|turn.example.com:443)::TURN): Received response; processing

TURN(relay(IP4:10.0.8.47:53521/UDP|turn.example.com:443)): Succesfully allocated addr IP4:0.0.0.0:50605/UDP lifetime=3600

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default) pairing local trickle ICE candidate turn-relay(IP4:10.0.8.47:53521/UDP|IP4:0.0.0.0:50605/UDP)

Firing write callback (0)

Invoking writable_cb on connected (44)

Writable_cb IP4:0.0.0.0:443/TCP (0 (0x1600291f4) pending)

Firing write callback (0)

Invoking writable_cb on connected (44)

Writable_cb IP4:0.0.0.0:443/TCP (0 (0x160026df4) pending)

UpdateBufferedAmount: (tracking 1): 0, waiting: no

UpdateBufferedAmount: (tracking 1): 0, waiting: no

STUN-CLIENT(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)::TURN): Received response; processing

STUN-CLIENT(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)::TURN): Error processing response: Retry may be possible, stun error code 401.

STUN-CLIENT(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)::TURN): Received response; processing

STUN-CLIENT(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)::TURN): Error processing response: Retry may be possible, stun error code 401.

UpdateBufferedAmount: (tracking 2): 0, waiting: no

UpdateBufferedAmount: (tracking 2): 0, waiting: no

STUN-CLIENT(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)::TURN): Received response; processing

TURN(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)): Succesfully allocated addr IP4:0.0.0.0:58399/UDP lifetime=3600

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default) pairing local trickle ICE candidate turn-relay(IP4:10.0.8.47:0/TCP|IP4:0.0.0.0:58399/UDP)

STUN-CLIENT(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)::TURN): Received response; processing

TURN(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)): Succesfully allocated addr IP4:0.0.0.0:56773/UDP lifetime=3600

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default) pairing local trickle ICE candidate turn-relay(IP4:10.0.8.47:0/TCP|IP4:0.0.0.0:56773/UDP)

ICE(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default) Trickle grace period is over; marking every component with only failed pairs as failed.

ICE-PEER(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default)/STREAM(0-1531925753097790 (id=25769803783 url=http://localhost:4242/call/1 aLevel=0)/COMP(1): All pairs are failed, and grace period has elapsed. Marking component as failed.

ICE-PEER(PC:1531925753097790 (id=25769803783 url=http://localhost:4242/call/1:default): all checks completed success=0 fail=1

TURN(relay(IP4:10.0.8.47:57340/UDP|turn.example.com:443)): deallocating

TURN(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)): deallocating

TURN(relay(IP4:10.0.8.47:53521/UDP|turn.example.com:443)): deallocating

TURN(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)): deallocating

UpdateBufferedAmount: (tracking 3): 0, waiting: no

UpdateBufferedAmount: (tracking 3): 0, waiting: no

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): failed to create passive TCP host candidate: 3

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): failed to create passive TCP host candidate: 3

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): failed to create passive TCP host candidate: 3

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): failed to create passive TCP host candidate: 3

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:173 function nr_socket_multi_tcp_create_stun_server_socket skipping UDP STUN server(addr:)

/builds/worker/workspace/build/src/media/mtransport/third_party/nICEr/src/net/nr_socket_multi_tcp.c:617 function nr_socket_multi_tcp_listen failed with error 3

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): failed to create passive TCP host candidate: 3

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default) has no stream matching stream 0-1531926015943360 (id=25769803783 url=http://localhost:4242/call/1 aLevel=1

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default) has no stream matching stream 0-1531926015943360 (id=25769803783 url=http://localhost:4242/call/1 aLevel=2

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default) no streams with non-empty check lists

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default) no streams with pre-answer requests

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default) no checks to start

Unrecognized attribute: 0x802b

STUN-CLIENT(srflx(IP4:10.0.8.47:55447/UDP|turn.example.com:443)): Received response; processing

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default) pairing local trickle ICE candidate srflx(IP4:10.0.8.47:55447/UDP|turn.example.com:443)

Write buffer not empty for IP4:0.0.0.0:443/TCP 44 - already armed (@0x14d18e5f4), not connected

STUN-CLIENT(relay(IP4:10.0.8.47:55447/UDP|turn.example.com:443)::TURN): Received response; processing

STUN-CLIENT(relay(IP4:10.0.8.47:55447/UDP|turn.example.com:443)::TURN): Error processing response: Retry may be possible, stun error code 401.

STUN-CLIENT(relay(IP4:10.0.8.47:55447/UDP|turn.example.com:443)::TURN): Received response; processing

TURN(relay(IP4:10.0.8.47:55447/UDP|turn.example.com:443)): Succesfully allocated addr IP4:0.0.0.0:56397/UDP lifetime=3600

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default) pairing local trickle ICE candidate turn-relay(IP4:10.0.8.47:55447/UDP|IP4:0.0.0.0:56397/UDP)

Unrecognized attribute: 0x802b

STUN-CLIENT(srflx(IP4:10.0.8.47:57093/UDP|turn.example.com:443)): Received response; processing

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default) pairing local trickle ICE candidate srflx(IP4:10.0.8.47:57093/UDP|turn.example.com:443)

Write buffer not empty for IP4:0.0.0.0:443/TCP 44 - already armed (@0x14d18fdf4), not connected

STUN-CLIENT(relay(IP4:10.0.8.47:57093/UDP|turn.example.com:443)::TURN): Received response; processing

STUN-CLIENT(relay(IP4:10.0.8.47:57093/UDP|turn.example.com:443)::TURN): Error processing response: Retry may be possible, stun error code 401.

STUN-CLIENT(relay(IP4:10.0.8.47:57093/UDP|turn.example.com:443)::TURN): Received response; processing

TURN(relay(IP4:10.0.8.47:57093/UDP|turn.example.com:443)): Succesfully allocated addr IP4:0.0.0.0:60501/UDP lifetime=3600

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default) pairing local trickle ICE candidate turn-relay(IP4:10.0.8.47:57093/UDP|IP4:0.0.0.0:60501/UDP)

Firing write callback (0)

Invoking writable_cb on connected (44)

Writable_cb IP4:0.0.0.0:443/TCP (0 (0x14d18fdf4) pending)

Firing write callback (0)

Invoking writable_cb on connected (44)

Writable_cb IP4:0.0.0.0:443/TCP (0 (0x14d18e5f4) pending)

UpdateBufferedAmount: (tracking 1): 0, waiting: no

UpdateBufferedAmount: (tracking 1): 0, waiting: no

STUN-CLIENT(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)::TURN): Received response; processing

STUN-CLIENT(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)::TURN): Error processing response: Retry may be possible, stun error code 401.

STUN-CLIENT(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)::TURN): Received response; processing

STUN-CLIENT(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)::TURN): Error processing response: Retry may be possible, stun error code 401.

UpdateBufferedAmount: (tracking 2): 0, waiting: no

UpdateBufferedAmount: (tracking 2): 0, waiting: no

STUN-CLIENT(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)::TURN): Received response; processing

TURN(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)): Succesfully allocated addr IP4:0.0.0.0:50309/UDP lifetime=3600

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default) pairing local trickle ICE candidate turn-relay(IP4:10.0.8.47:0/TCP|IP4:0.0.0.0:50309/UDP)

STUN-CLIENT(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)::TURN): Received response; processing

TURN(relay(IP4:10.0.8.47:0/TCP|turn.example.com:443)): Succesfully allocated addr IP4:0.0.0.0:62199/UDP lifetime=3600

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default) pairing local trickle ICE candidate turn-relay(IP4:10.0.8.47:0/TCP|IP4:0.0.0.0:62199/UDP)

ICE(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1): peer (PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default) Trickle grace period is over; marking every component with only failed pairs as failed.

ICE-PEER(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default)/STREAM(0-1531926015943360 (id=25769803783 url=http://localhost:4242/call/1 aLevel=0)/COMP(1): All pairs are failed, and grace period has elapsed. Marking component as failed.

ICE-PEER(PC:1531926015943360 (id=25769803783 url=http://localhost:4242/call/1:default): all checks completed success=0 fail=1

+++++++ END ++++++++

Solution

  • The problem happens because both zone.js and adapter-js are putting their wrappers on top of various RTC methods.

    The solution is to add the line below, at the end of the polyfills.ts file.

    import 'zone.js/dist/webapis-rtc-peer-connection';
    

    More info: