SdpParser

Simplify the SDP parser.

Methods

# (inner) adaptCodecName(sdp, codec, newCodecName) → {String}

Replace the codec name of an SDP.

Parameters:
Name Type Description
sdp String

The current SDP.

codec String

The codec name to be replaced.

newCodecName String

The new codec name to use.

Returns:

The SDP updated with the new codec name.

Type
String

# (inner) getAvailableHeaderExtensionIdRange(sdp) → {Array.<Number>}

Get all available header extension IDs of the current Session Description.

Parameters:
Name Type Description
sdp String

The current SDP.

Returns:

All available header extension IDs.

Type
Array.<Number>

# (inner) getAvailablePayloadTypeRange(sdp) → {Array.<Number>}

Get all available payload type IDs of the current Session Description.

Parameters:
Name Type Description
sdp String

The current SDP.

Returns:

All available payload type IDs.

Type
Array.<Number>

# (inner) removeSdpLine(sdp, sdpLine) → {String}

Remove an SDP line.

Parameters:
Name Type Description
sdp String

The current SDP.

sdpLine String

The SDP line to remove.

Returns:

The SDP without the line.

Type
String
Example
SdpParser.removeSdpLine(sdp, 'custom line')

# (inner) renegotiate(localDescription, remoteDescription)

Renegotiate the remote SDP based on the previous description. This function will fill missing m-lines cloning on the remote description by cloning the codec and extensions already negotiated for that media.

Parameters:
Name Type Description
localDescription String

The updated local SDP.

remoteDescription String

The previous remote SDP.

# (inner) setAbsoluteCaptureTime(sdp) → {String}

Mangle the SDP for adding an absolute capture time header extension.

Parameters:
Name Type Description
sdp String

The current SDP.

Returns:

SDP mungled with abs-capture-time header extension.

Type
String
Example
SdpParser.setAbsoluteCaptureTime(sdp)

# (inner) setDependencyDescriptor(sdp) → {String}

Mangle SDP for adding dependency descriptor header extension.

Parameters:
Name Type Description
sdp String

The current SDP.

Returns:

SDP mungled with abs-capture-time header extension.

Type
String
Example
SdpParser.setAbsoluteCaptureTime(sdp)

# (inner) setDTX(sdp) → {String}

Set DTX (Discontinuous Transmission) to the connection. Advanced configuration of the opus audio codec that allows for a large reduction in the audio traffic. For example, when a participant is silent, the audio packets won't be transmitted.

Parameters:
Name Type Description
sdp String

The current SDP.

Returns:

The SDP parsed with DTX support.

Type
String
Example
SdpParser.setDTX(sdp)

# (inner) setMultiopus(sdp, mediaStream) → {String}

Parse SDP for support multiopus. Only available in Google Chrome.

Parameters:
Name Type Description
sdp String

The current SDP.

mediaStream MediaStream

The MediaStream offered in the stream.

Returns:

The SDP parsed with multiopus support.

Type
String
Example
SdpParser.setMultiopus(sdp, mediaStream)

# (inner) setSimulcast(sdp, codec) → {String}

Parse SDP for support simulcast. Only available in Google Chrome.

Parameters:
Name Type Description
sdp String

The current SDP.

codec String

The video codec.

Returns:

The SDP parsed with simulcast support.

Type
String
Example
SdpParser.setSimulcast(sdp, 'h264')

# (inner) setStereo(sdp) → {String}

Parse the SDP for stereo support.

Parameters:
Name Type Description
sdp String

The current SDP.

Returns:

The SDP parsed with stereo support.

Type
String
Example
SdpParser.setStereo(sdp)

# (inner) setVideoBitrate(sdp, bitrate) → {String}

Parse the SDP for the desired bitrate.

Parameters:
Name Type Description
sdp String

The current SDP.

bitrate Number

The bitrate value, in kbps, or 0 for unlimited bitrate.

Returns:

The SDP parsed with the desired bitrate.

Type
String
Example
SdpParser.setVideoBitrate(sdp, 1000)

# (inner) updateMissingVideoExtensions(localDescription, remoteDescription) → {String}

Adds missing extensions of each video section in the localDescription

Parameters:
Name Type Description
localDescription String

Previous local sdp

remoteDescription String

Remote sdp

Returns:

SDP updated with missing extensions.

Type
String