View Source Membrane.RTC.Engine.Track (Membrane RTC Engine v0.6.0)
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
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
@type encoding() :: atom()
@type format() :: [atom()]
@type id() :: String.t()
@type opts_t() :: [ id: String.t(), simulcast_encodings: [String.t()], metadata: any(), ctx: map() ]
Options that can be passed to new/7
.
If not provided:
id
- will be generatedsimulcast_encodings
-[]
metadata
-nil
ctx
-%{}
For more information refer to t/0
.
@type t() :: %Membrane.RTC.Engine.Track{ active?: boolean(), clock_rate: Membrane.RTP.clock_rate_t(), ctx: map(), encoding: encoding(), fmtp: ExSDP.Attribute.FMTP.t(), format: format(), id: id(), metadata: any(), origin: String.t(), simulcast_encodings: [String.t()], 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 samestream_id
. Onestream_id
can be assign to any number of tracks.id
- track idorigin
- id of Endpoint this track belongs toencoding
- track encodingsimulcast_encodings
- for simulcast tracks this is a list of simulcast encoding identifiers. In other case, this is an empty list.clock_rate
- track clock rateformat
- 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 ofencoding
. The other one can be any atom (e.g.:RTP
).fmtp
- struct describing format specific parameters e.g. for H264 it containsprofile_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 trackctx
- any data Endpoints need to associate withMembrane.RTC.Engine.Track.t()
for internal usage
Link to this section Functions
Link to this function
new(type, stream_id, origin, encoding, clock_rate, format, fmtp, opts \\ [])
View Source@spec new( :audio | :video, String.t(), String.t(), encoding(), Membrane.RTP.clock_rate_t(), format(), ExSDP.Attribute.FMTP, opts_t() ) :: 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
.
@spec stream_id() :: String.t()
Generates stream id, that can be used to mark tracks belonging to the same stream.