setCodecPreferences() configures the transceiver's
codecs given a list of
RTCRtpCodecCapability objects specifying the new
preferences for each codec. The specified set of codecs and
configurations will be used for all future connections including this transceiver until
this method is called again.
When preparing to open an
RTCPeerConnection, you can change the codec
parameters from the user agent's default configuration by
setCodecParameters() before calling either
A guide to codecs supported by WebRTC—and each codec's positive and negative characteristics—can be found in Codecs used by WebRTC.
An array of
RTCRtpCodecCapabilityobjects, in order of preference, each providing the parameters for one of the transceiver's supported codecs. If
codecsis empty, the codec configurations are all returned to the user agent's defaults.Note: Any codecs not included in
codecswill not be considered during the process of negotiating a connection. This lets you prevent the use of codecs you don't wish to use.
codecslist includes one or more codecs which are not supported by the transceiver.
You can only include in the
codecs list codecs which the transceiver
actually supports. That means that either the associated
RTCRtpReceiver needs to support every codec in the list. If any
unsupported codecs are listed, the browser will throw an
exception when you call this method.
A good approach to setting codec preferences is to first get the list of codecs that
are actually supported, then modify that list to match what you want. Pass the altered
setCodecPreferences() to specify your preferences.
var availSendCodecs = transceiver.sender.getCapabilities("video").codecs; var availReceiveCodecs = transceiver.receiver.getCapabilities("video").codecs;
|WebRTC 1.0: Real-time Communication Between Browsers
The definition of 'RTCRtpTransceiver.setCodecPreferences()' in that specification.
BCD tables only load in the browser