View Source Specter.TrackLocalStaticSample (specter v0.4.1)
A representation of webrtc.rs TrackLocalStaticSample
.
In general, a track in WebRTC represents a single audio or video and its main purpose is to provide user with API for sending and receiving media data/packets.
Therefore, webrtc.rs has multiple implementations of the track depending on what user want to do.
Local tracks are outbound tracks i.e. they are used when user wants to
send media to the other end of a peer connection.
User must instantiate local track explicitly.
At the moment, there are two types of local track: TrackLocalStaticSample
and TrackLocalStaticRtp
.
The former is used when user wants RTP encapsulation to be performed under the hood.
The latter, when user has already prepared RTP packets.
Remote tracks are inbound tracks i.e. they represent incoming media. User does not create remote track explicitly. Instead, it announces willingness to receive track by creating a rtp transceiver and then, when there are some remote packets, webrtc.rs creates a new remote track internally and notifies user.
Link to this section Summary
Link to this section Types
@opaque t()
Represents an instantiated TrackLocalStaticSample stored in the NIF.
Link to this section Functions
@spec new(Specter.t(), Specter.RtpCodecCapability.t(), String.t(), String.t()) :: {:ok, t()} | {:error, term()}
Creates new TrackLocalStaticSample.
usage
Usage
iex> {:ok, specter} = Specter.init()
iex> codec = %Specter.RtpCodecCapability{mime_type: "audio"}
iex> {:ok, _track} = Specter.TrackLocalStaticSample.new(specter, codec, "audio", "specter")
Reads H264 file and writes it to the track.