UDP / TCP transport fallback

SLM

Member
It seems that certain VPN providers do not support UDP streaming or limit its bandwidth to levels that basically make it unusable for streaming. Is it possible to detect this and to automatically switch to TCP server side or to detect it client side using the javascript API and use an event / function to switch?
 

Max

Administrator
Staff member
Good day.
It seems that certain VPN providers do not support UDP streaming or limit its bandwidth to levels that basically make it unusable for streaming. Is it possible to detect this and to automatically switch to TCP server side or to detect it client side using the javascript API and use an event / function to switch?
You can implement this on client side as follows:
1. Try to publish with UDP transport
Code:
session.createStream({
    name: streamName,
    display: localVideo,
    ...
    transport: "UDP"
    ...
}).publish();
2. If STREAM_STATUS.FAILED event is received, check stream.getInfo() result.
3. If stream.getInfo() result is "Failed by ICE timeout", try to publish with TCP transport
session.createStream({
name: streamName,
display: localVideo,
...
transport: "TCP"
...
}).publish();
You can also try to bypass those VPNs using TURN server.
 

SLM

Member
Good day.

You can implement this on client side as follows:
1. Try to publish with UDP transport
Code:
session.createStream({
    name: streamName,
    display: localVideo,
    ...
    transport: "UDP"
    ...
}).publish();
2. If STREAM_STATUS.FAILED event is received, check stream.getInfo() result.
3. If stream.getInfo() result is "Failed by ICE timeout", try to publish with TCP transport
session.createStream({
name: streamName,
display: localVideo,
...
transport: "TCP"
...
}).publish();
You can also try to bypass those VPNs using TURN server.
Hi,

Thank you for your reply. It's not so much the publishing streams that experience this. The publishers do not use a vpn. It's the people that play the streams that sometimes use vpn's and some of those limit or block UDP traffic. Does this result in the same "Failed by ICE timeout" ? Some report a lot of onprogress javascript events after the STREAM_STATUS.PLAYING event but not resulting in actually playing the stream. When I switch the player to force TCP transport that problem disappears.
 

Max

Administrator
Staff member
Thank you for your reply. It's not so much the publishing streams that experience this. The publishers do not use a vpn. It's the people that play the streams that sometimes use vpn's and some of those limit or block UDP traffic. Does this result in the same "Failed by ICE timeout" ?
Yes, if player tries to establish WebRTC connection, and UDP ports are locked, the result should be the same.
Some report a lot of onprogress javascript events after the STREAM_STATUS.PLAYING event but not resulting in actually playing the stream.
This means ports are not locked, but bandwidth is limited. You can check channel quality on players side and, if this is BAD (the bitrate received is lower when bitrate sent by server), switch to TCP playback.
 
Top