Skip to content

Commit

Permalink
Updating documentation to prevent setRemoteDescription error (twilio#160
Browse files Browse the repository at this point in the history
)
  • Loading branch information
charliesantos authored Apr 27, 2023
1 parent 3367771 commit fe1be12
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions lib/twilio/device.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1746,6 +1746,41 @@ namespace Device {

/**
* Overrides the native RTCPeerConnection class.
*
* By default, the SDK will use the `unified-plan` SDP format if the browser supports it.
* Unexpected behavior may happen if the `RTCPeerConnection` parameter uses an SDP format
* that is different than what the SDK uses.
*
* For example, if the browser supports `unified-plan` and the `RTCPeerConnection`
* parameter uses `plan-b` by default, the SDK will use `unified-plan`
* which will cause conflicts with the usage of the `RTCPeerConnection`.
*
* In order to avoid this issue, you need to explicitly set the SDP format that you want
* the SDK to use with the `RTCPeerConnection` via [[Device.ConnectOptions.rtcConfiguration]] for outgoing calls.
* Or [[Call.AcceptOptions.rtcConfiguration]] for incoming calls.
*
* See the example below. Assuming the `RTCPeerConnection` you provided uses `plan-b` by default, the following
* code sets the SDP format to `unified-plan` instead.
*
* ```ts
* // Outgoing calls
* const call = await device.connect({
* rtcConfiguration: {
* sdpSemantics: 'unified-plan'
* }
* // Other options
* });
*
* // Incoming calls
* device.on('incoming', call => {
* call.accept({
* rtcConfiguration: {
* sdpSemantics: 'unified-plan'
* }
* // Other options
* });
* });
* ```
*/
RTCPeerConnection?: any;

Expand Down

0 comments on commit fe1be12

Please sign in to comment.