consumers/relay_fallback library

Classes

IceRelayOffer
The relay fields a server sends beside params in its createWebRtcTransport answer. All fields are absent on servers without a relay.

Constants

networkBlockedMessage → const String
Shown once per media socket when the call cannot connect through the network, even with the relay.

Functions

attachRelayFallback(Transport transport, Socket socket, IceRelayOffer offer, {required String direction, void onBlocked()?, Duration connectWait = const Duration(seconds: 12)}) → void Function()
Watches one transport and, when it stays stuck, restarts ICE once with the relay allowed. Returns a dispose function. Register it before the regular ICE recovery (which handles disconnected/failed); the two run side by side.
createRecvTransportWithRelay(Device device, Map data, IceRelayOffer offer, {Function? consumerCallback}) → Transport
Creates the receive transport. Only the 'always' mode adds the relay up front; otherwise this is exactly device.createRecvTransportFromMap.
createSendTransportWithRelay(Device device, Map data, IceRelayOffer offer, {Function? producerCallback}) → Transport
Creates the send transport. Only the 'always' mode adds the relay up front; otherwise this is exactly device.createSendTransportFromMap.
liveShowAlert(dynamic parameters) → ShowAlert?
Reads the live showAlert from a parameters object, when it has one.
parseIceServers(dynamic value) → List<Map<String, dynamic>>
Keeps the ICE server entries that carry at least one URL.
selectedCandidate(Transport transport) → Future<Map<String, String>>
Which candidate the connected transport uses: host, srflx, prflx or relay (and over what). Best effort: unknown values stay 'unknown'.
showNetworkBlocked(Socket socket, ShowAlert? showAlert) → void
Shows the blocked-network message once per media socket, however many transports hit it.
toRtcIceServers(List<Map<String, dynamic>> servers) → List<RTCIceServer>
Converts parsed ICE server maps to the mediasoup client type.