new WebRtcPeer(mode, localVideo, remoteVideo, videoStream, audioStream)
Wrapper object of an RTCPeerConnection. This object is aimed to simplify the
development of WebRTC-based applications.
Parameters:
Name | Type | Description |
---|---|---|
mode |
String | Mode in which the PeerConnection will be configured. Valid values are: 'recvonly', 'sendonly', and 'sendrecv' |
localVideo |
Video tag for the local stream | |
remoteVideo |
Video tag for the remote stream | |
videoStream |
MediaStream | Stream to be used as primary source (typically video and audio, or only video if combined with audioStream) for localVideo and to be added as stream to the RTCPeerConnection |
audioStream |
MediaStream | Stream to be used as second source (typically for audio) for localVideo and to be added as stream to the RTCPeerConnection |
- Source:
Methods
addIceCandidate(iceCandidate, callback)
Callback function invoked when an ICE candidate is received. Developers are
expected to invoke this function in order to complete the SDP negotiation.
Parameters:
Name | Type | Description |
---|---|---|
iceCandidate |
Literal object with the ICE candidate description | |
callback |
Called when the ICE candidate has been added. |
- Source:
dispose()
This method frees the resources used by WebRtcPeer.
- Source:
processAnswer(sdpAnswer, callback)
Callback function invoked when a SDP answer is received. Developers are
expected to invoke this function in order to complete the SDP negotiation.
Parameters:
Name | Type | Description |
---|---|---|
sdpAnswer |
Description of sdpAnswer | |
callback |
Invoked after the SDP answer is processed, or there is an error. |
- Source:
processOffer(sdpOffer, callback)
Callback function invoked when a SDP offer is received. Developers are
expected to invoke this function in order to complete the SDP negotiation.
Parameters:
Name | Type | Description |
---|---|---|
sdpOffer |
Description of sdpOffer | |
callback |
Called when the remote description has been set successfully. |
- Source: