RTCConfiguration
The configuration of a connection and the STUN and TURN servers it gathers candidates with.
- class webrtc.models.rtc_configuration.RTCIceServer(urls, username=None, credential=None)
A STUN or TURN server to gather ICE candidates with.
It isn’t checked on creation, only when the configuration is applied. The URLs must be valid
stun,stuns,turnorturnsURLs (RFC 7064, RFC 7065), and a TURN server needs a username of at most 509 characters and a non-empty password. See MDN: RTCPeerConnection/RTCPeerConnection.
- class webrtc.models.rtc_configuration.RTCIceGatherOptions(gather_policy=RTCIceTransportPolicy.all, ice_servers=None)
How a standalone
webrtc.RTCIceTransportgathers candidates, forwebrtc.RTCIceTransport.gather().- Parameters:
gather_policy (
webrtc.RTCIceTransportPolicy, optional) – Whether to gather every type of candidate (all, the default) or only relay ones.ice_servers (
listofwebrtc.RTCIceServer, optional) – The STUN and TURN servers to gather with.
- class webrtc.models.rtc_configuration.RTCConfiguration(ice_servers=<factory>, ice_transport_policy=RTCIceTransportPolicy.all, bundle_policy=RTCBundlePolicy.balanced, rtcp_mux_policy=RTCRtcpMuxPolicy.require, ice_candidate_pool_size=0, port_range=None, certificates=None, always_negotiate_data_channels=False, rtp_header_encryption_policy=RTCRtpHeaderEncryptionPolicy.negotiate)
The configuration of a
webrtc.RTCPeerConnection.A connection takes it on creation and in
webrtc.RTCPeerConnection.set_configuration(), and checks the members there. This class doesn’t check them. Enum members accept their values too. See MDN: RTCPeerConnection/RTCPeerConnection.- Parameters:
ice_servers (
listofwebrtc.RTCIceServer, optional) – The STUN and TURN servers to gather ICE candidates with. There are none by default.ice_transport_policy (
webrtc.RTCIceTransportPolicy, optional) – Whether every type of candidate may be used (all, the default) or only relay ones.bundle_policy (
webrtc.RTCBundlePolicy, optional) – How media is grouped into transports when the remote peer doesn’t support bundling. It’sbalancedby default and can’t be changed.rtcp_mux_policy (
webrtc.RTCRtcpMuxPolicy, optional) – Whether RTCP multiplexing is required (the default). It can’t be changed.ice_candidate_pool_size (
int, optional) – How many candidates (0 to 255) to gather ahead of setting the local description. It’s 0 by default and can’t be changed once the local description is set.port_range (
tupleof twoint, optional) – The lowest and the highest local UDP and TCP port to use, for firewalls that only allow a range. This option is specific to this library.certificates (
listofwebrtc.RTCCertificate, optional) – The certificates to authenticate with. They’re generated if omitted. They can’t be changed, and leaving them out ofwebrtc.RTCPeerConnection.set_configuration()keeps the current ones.always_negotiate_data_channels (
bool, optional) – Whether every offer has a media section for data channels even before a channel is created. The section comes first among the new sections. It can’t be changed.rtp_header_encryption_policy (
webrtc.RTCRtpHeaderEncryptionPolicy, optional) –negotiate(the default) encrypts RTP header extensions with cryptex (RFC 9335) when the remote peer supports it,requirefails a remote description without it, anddisablenever encrypts. It can’t be changed.