View Source Membrane.WebRTC.Sink (Membrane WebRTC plugin v0.22.0)
Membrane Bin that allows sending audio and video tracks via WebRTC.
It sends an SDP offer and expects an answer during initialization and
each time when new tracks are added. For more information about signaling,
see the signaling
option.
Before connecting pads, each audio and video track has to be negotiated.
Tracks passed via tracks
option are negotiated during initialization.
You can negotiate more tracks by sending add_tracks/0
notification
and waiting for new_tracks/0
notification reply.
When the tracks are negotiated, pads can be linked. The pad either
has to have a kind
option set or its id has to match the id of
the track received in new_tracks/0
notification.
Bin options
Passed via struct Membrane.WebRTC.Sink.t/0
signaling
SignalingChannel.t() | {:websocket, SimpleWebSocketServer.options()}
Required
Channel for passing WebRTC signaling messages (SDP and ICE). Either:Membrane.WebRTC.SignalingChannel
- See its docs for details.{:websocket, options}
- Spawns Membrane.WebRTC.SimpleWebSocketServer, see there for details.
tracks
[:audio | :video]
Default value:
[:audio, :video]
Tracks to be negotiated. By default one audio and one video track is negotiated, meaning that at most one audio and one video can be sent.video_codec
:vp8 | :h264
Default value:
:vp8
ice_servers
[ExWebRTC.PeerConnection.Configuration.ice_server()]
Default value:
[%{urls: "stun:stun.l.google.com:19302"}]
payload_rtp
boolean()
Default value:
true
Pads
:input
Accepted formats:
%Membrane.H264{alignment: :nalu}
%Membrane.RemoteStream{content_format: Membrane.VP8}
Membrane.Opus
Membrane.RTP
Direction: | :input |
Availability: | :on_request |
Pad options:
kind
:audio | :video | nil
Default value:
nil
When set, the pad is associated with the first negotiated track of the given kind. See the moduledoc for details.
Summary
Types
Notification that should be sent to the bin to negotiate new tracks.
Options for pad :input
Notification sent when new tracks are negotiated.
Struct containing options for Membrane.WebRTC.Sink
Types
@type add_tracks() :: {:add_tracks, [:audio | :video]}
Notification that should be sent to the bin to negotiate new tracks.
See the moduledoc for details.
@type input_pad_opts() :: [{:kind, :audio | :video | nil}]
Options for pad :input
@type new_tracks() :: {:new_tracks, [%{id: term(), kind: :audio | :video}]}
Notification sent when new tracks are negotiated.
See the moduledoc for details.
@type t() :: %Membrane.WebRTC.Sink{ ice_servers: [ExWebRTC.PeerConnection.Configuration.ice_server()], payload_rtp: boolean(), signaling: Membrane.WebRTC.SignalingChannel.t() | {:websocket, Membrane.WebRTC.SimpleWebSocketServer.options()}, tracks: [:audio | :video], video_codec: :vp8 | :h264 }
Struct containing options for Membrane.WebRTC.Sink
Functions
@spec options() :: keyword()
Returns description of options available for this module