Membrane.RTC.Engine.Track (Membrane RTC Engine v0.1.0) View Source

Module representing media track.

Media track is a single audio or video. Tracks that are related to each other (e.g. audio from microphone that corresponds to video from a web cam) can be grouped into the same stream by assigning each of them the same stream id.

Link to this section Summary

Types

t()

This module contains

Functions

Creates a new track.

Generates stream id, that can be used to mark tracks belonging to the same stream.

Link to this section Types

Specs

encoding() :: atom()

Specs

format() :: [atom()]

Specs

id() :: String.t()

Specs

t() :: %Membrane.RTC.Engine.Track{
  active?: boolean(),
  ctx: map(),
  encoding: encoding(),
  fmtp: ExSDP.Attribute.FMTP,
  format: format(),
  id: id(),
  metadata: any(),
  stream_id: String.t(),
  type: :audio | :video
}

This module contains:

  • type - audio or video,
  • stream_id - media stream this track belongs to. Relationship between tracks (e.g. audio and video) can be indicated by assigning each of them the same stream_id. One stream_id can be assign to any number of tracks.
  • id - track id
  • encoding - track encoding
  • format - list of available track formats. At this moment max two formats can be specified. One of them has to be :raw which indicates that other Endpoints will receive this track in format of encoding. The other one can be any atom (e.g. :RTP).
  • fmtp - struct describing format specific parameters e.g. for H264 it contains profile_level_id
  • active? - indicates whether track is still available or not (because peer left a room)
  • metadata - any data passed by user to be linked with this track
  • ctx - any data Endpoints need to associate with Membrane.RTC.Engine.Track.t() for internal usage

Link to this section Functions

Link to this function

new(type, stream_id, opts \\ [])

View Source

Specs

new(:audio | :video, stream_id :: String.t(),
  id: String.t(),
  encoding: encoding(),
  format: format(),
  fmtp: ExSDP.Attribute.FMTP,
  metadata: any(),
  ctx: map()
) :: t()

Creates a new track.

Tracks belonging to the same stream should have the same stream_id, that can be generated with stream_id/0.

Specs

stream_id() :: String.t()

Generates stream id, that can be used to mark tracks belonging to the same stream.