SdpParser

SdpParser

Simplify SDP parser.

Methods

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

Replace codec name of a SDP.

Parameters:
Name Type Description
sdp String

Current SDP.

codec String

Codec name to be replaced.

newCodecName String

New codec name to replace.

Returns:

SDP updated with new codec name.

Type
String

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

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

Parameters:
Name Type Description
sdp String

Current SDP.

Returns:

All available header extension IDs.

Type
Array.<Number>

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

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

Parameters:
Name Type Description
sdp String

Current SDP.

Returns:

All available payload type ids.

Type
Array.<Number>

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

Remove SDP line.

Parameters:
Name Type Description
sdp String

Current SDP.

sdpLine String

SDP line to remove.

Returns:

SDP without the line.

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

# (static) renegotiate(localDescription, remoteDescription)

Renegotiate remote sdp based on 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

Updated local sdp

remoteDescription String

Previous remote sdp

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

Mangle SDP for adding absolute capture time header extension.

Parameters:
Name Type Description
sdp String

Current SDP.

Returns:

SDP mungled with abs-catpure-time header extension.

Type
String
Example
SdpParser.setAbsoluteCaptureTime(sdp)

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

Mangle SDP for adding dependency descriptor header extension.

Parameters:
Name Type Description
sdp String

Current SDP.

Returns:

SDP mungled with abs-catpure-time header extension.

Type
String
Example
SdpParser.setAbsoluteCaptureTime(sdp)

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

Parse SDP for support dtx.

Parameters:
Name Type Description
sdp String

Current SDP.

Returns:

SDP parsed with dtx support.

Type
String
Example
SdpParser.setDTX(sdp)

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

Parse SDP for support multiopus.

Only available in Google Chrome.

Parameters:
Name Type Description
sdp String

Current SDP.

mediaStream MediaStream

MediaStream offered in the stream.

Returns:

SDP parsed with multiopus support.

Type
String
Example
SdpParser.setMultiopus(sdp, mediaStream)

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

Parse SDP for support simulcast.

Only available in Google Chrome.

Parameters:
Name Type Description
sdp String

Current SDP.

codec String

Codec.

Returns:

SDP parsed with simulcast support.

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

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

Parse SDP for support stereo.

Parameters:
Name Type Description
sdp String

Current SDP.

Returns:

SDP parsed with stereo support.

Type
String
Example
SdpParser.setStereo(sdp)

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

Parse SDP for desired bitrate.

Parameters:
Name Type Description
sdp String

Current SDP.

bitrate Number

Bitrate value in kbps or 0 for unlimited bitrate.

Returns:

SDP parsed with desired bitrate.

Type
String
Example
SdpParser.setVideoBitrate(sdp, 1000)

# (static) 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