makePeerConnection
fun makePeerConnection(coroutineScope: CoroutineScope, configuration: PeerConnection.RTCConfiguration, type: StreamPeerType, mediaConstraints: MediaConstraints, onStreamAdded: (MediaStream) -> Unit? = null, onNegotiationNeeded: (StreamPeerConnection, StreamPeerType) -> Unit? = null, onIceCandidateRequest: (IceCandidate, StreamPeerType) -> Unit? = null, maxPublishingBitrate: Int): StreamPeerConnection
Builds a StreamPeerConnection that wraps the WebRTC PeerConnection and exposes several helpful handlers.
Return
StreamPeerConnection That's fully set up and can be observed and used to send and receive tracks.
Parameters
coroutineScope
Scope used for asynchronous operations.
configuration
The PeerConnection.RTCConfiguration used to set up the connection.
type
The type of connection, either a subscriber of a publisher.
mediaConstraints
Constraints used for audio and video tracks in the connection.
onStreamAdded
Handler when a new MediaStream gets added.
onNegotiationNeeded
Handler when there's a new negotiation.
onIceCandidateRequest
Handler whenever we receive IceCandidates.