sip.js.sessiondescriptionhandler.peerconnection.md
October 21, 2022 ยท View on GitHub
Home > sip.js > SessionDescriptionHandler > peerConnection
SessionDescriptionHandler.peerConnection property
The peer connection. Undefined if peer connection has closed.
Signature:
get peerConnection(): RTCPeerConnection | undefined;
Remarks
Use the peerConnectionDelegate to get access to the events associated with the RTCPeerConnection. For example...
Do NOT do this...
peerConnection.onicecandidate = (event) => {
// do something
};
Instead, do this...
peerConnection.peerConnectionDelegate = {
onicecandidate: (event) => {
// do something
}
};
While access to the underlying RTCPeerConnection is provided, note that using methods which modify it may break the operation of this class. In particular, this class depends on exclusive access to the event handler properties. If you need access to the peer connection events, either register for events using addEventListener() on the RTCPeerConnection or set the peerConnectionDelegate on this SessionDescriptionHandler.