Skip to content

IPv6 support for WebRTC

IPv6 support for WebRTC is added since build 5.2.660. This led to some changes in configuration settings and connection establishing procedure.

Configuration

By default, IPv6 support is disabled. To enable this feature, the following should be done:

  • in flashphoner.properties file set the external IPv6 server address and allow IPv6 candidates

    ip_v6=2a03:b0c0:3:e0::42e:c002
    ice_add_ipv6_candidate=true
    

  • in wcs-core.properies file allow IPv6 stack

    -Djava.net.preferIPv4Stack=false
    

The following settings can be used to set comma separated IPv4 and IPv6 interfaces to bind

  • hls.address
  • http.address
  • https.address
  • rtmfp.address
  • rtmp.address
  • rtsp.address
  • rtsp_client_address
  • ws.address
  • wss.address

Connection establishing procedure

Connection establishing to exchange WebRTC media traffic now looks as follows:

  1. Server waits for incoming Binding Request queries to IPv4 and IPv6 interfaces.

  2. When a query with USE-CANDIDATE attribute is received, the candidate is marked as nominated to use, if Binding Response would be received

  3. For every browser Binding Request server sends Binding Response

  4. At the same time, server sends Binding Request to browser. Requests will be repeated if necessary with the following period (1500 ms by default)

    stun_freshness_period=1500
    

  5. When Bindind Response is received from the first candidate, the timeout is started to wait for another candidates as set in the following parameter (1000 ms by default)

    stun_wait_candidate_timeout=1000
    

  6. When timeout is finished, server sends DTLS Client Hello to the priority candidate

When establishing connection with Safari browser, IPv4 candidates are preferred unless some problem in STUN-DTLS procedure occur with such candidate. Therefore, in Safari IPv4 will be used if client has both IPv4 and IPv6 interfaces working and traffic between client and server is not blocked. In other browsers (see example pictures above) IPv6 candidates are preferred.

Known issues

1. WebRTC publishing/playback does not work in any browser on IPv6 only host

Symptoms

Stream publishing or playback fails with Failed by ICE timeout error

Solution

If a host has only IPv6 address (and localhost), ICE candidates exchange does not work, RTCPeerConnection.onicecandidate event is nor fired in most browsers. Use RTMP to publish and RTSP, RTMP, HLS to play.