Simplify SDP parser.

Methods

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

Replace codec name of a SDP.

Parameters:
NameTypeDescription
sdpString

Current SDP.

codecString

Codec name to be replaced.

newCodecNameString

New codec name to replace.

Returns:

SDP updated with new codec name.

Type: 
String

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

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

Parameters:
NameTypeDescription
sdpString

Current SDP.

Returns:

All available header extension IDs.

Type: 
Array.<Number>

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

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

Parameters:
NameTypeDescription
sdpString

Current SDP.

Returns:

All available payload type ids.

Type: 
Array.<Number>

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

Remove SDP line.

Parameters:
NameTypeDescription
sdpString

Current SDP.

sdpLineString

SDP line to remove.

Returns:

SDP without the line.

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

(inner) 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:
NameTypeDescription
localDescriptionString

Updated local sdp

remoteDescriptionString

Previous remote sdp

(inner) setAbsoluteCaptureTime(sdp) → {String}

Mangle SDP for adding absolute capture time header extension.

Parameters:
NameTypeDescription
sdpString

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:
NameTypeDescription
sdpString

Current SDP.

Returns:

SDP parsed with dtx support.

Type: 
String
Example
SdpParser.setDTX(sdp)

(inner) setDependencyDescriptor(sdp) → {String}

Mangle SDP for adding dependency descriptor header extension.

Parameters:
NameTypeDescription
sdpString

Current SDP.

Returns:

SDP mungled with abs-capture-time header extension.

Type: 
String
Example
SdpParser.setAbsoluteCaptureTime(sdp)

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

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

Parameters:
NameTypeDescription
sdpString

Current SDP.

mediaStreamMediaStream

MediaStream offered in the stream.

Returns:

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:
NameTypeDescription
sdpString

Current SDP.

codecString

Codec.

Returns:

SDP parsed with simulcast support.

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

(inner) setStereo(sdp) → {String}

Parse SDP for support stereo.

Parameters:
NameTypeDescription
sdpString

Current SDP.

Returns:

SDP parsed with stereo support.

Type: 
String
Example
SdpParser.setStereo(sdp)

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

Parse SDP for desired bitrate.

Parameters:
NameTypeDescription
sdpString

Current SDP.

bitrateNumber

Bitrate value in kbps or 0 for unlimited bitrate.

Returns:

SDP parsed with 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:
NameTypeDescription
localDescriptionString

Previous local sdp

remoteDescriptionString

Remote sdp

Returns:

SDP updated with missing extensions.

Type: 
String