Membrane.WebRTC.SDP (Membrane WebRTC plugin v0.1.0-alpha) View Source

Module containing helper functions for creating SPD offer.

Link to this section Summary


Creates Unified Plan SDP offer.

Link to this section Types


fingerprint() :: {ExSDP.Attribute.hash_function(), binary()}

Link to this section Functions


  ice_ufrag: String.t(),
  ice_pwd: String.t(),
  fingerprint: fingerprint(),
  audio_codecs: [ExSDP.Attribute.t()],
  video_codecs: [ExSDP.Attribute.t()],
  inbound_tracks: [Membrane.WebRTC.Track.t()],
  outbound_tracks: [Membrane.WebRTC.Track.t()],
  use_default_codecs: [:audio | :video]
) :: ExSDP.t()

Creates Unified Plan SDP offer.

The mandatory options are:

  • ice_ufrag - ICE username fragment
  • ice_pwd - ICE password
  • fingerprint - DTLS fingerprint
  • inbound_tracks - list of inbound tracks
  • outbound_tracks - list of outbound tracks

Additionally accepts audio_codecs and video_codecs options, that should contain lists of SDP attributes for desired codecs, for example:

video_codecs: [
  %RTPMapping{payload_type: 98, encoding: "VP9", clock_rate: 90_000}

By default both lists are empty and default audio and video codecs get appended including OPUS for audio, H264 and VP8 for video.

To disable all or enable just one specific codec type use use_default_codecs option. To disable default codecs pass an empty list. To enable only either audio or video, pass a list with a single atom [:audio] or [:video].