View Source Membrane.WebRTC.Source (Membrane WebRTC plugin v0.22.0)
Membrane Bin that allows receiving audio and video tracks via WebRTC.
It expects an SDP offer to be sent by the other peer at the beginning
of playback and each time new tracks are added. For more information
about signaling, see the signaling
option.
Pads connected immediately when the bin is created
(in the same spec Membrane.ChildrenSpec.t/0
) need to have the kind
option set to :audio
or :video
. Each of those pads will be associated
with the first WebRTC track of the given kind that arrives.
When a WebRTC tracks arrive and there's no pad to link them to,
the new_tracks/0
notification is sent. Then, the corresponding pads
should be linked - the id of each pad should match one of the track ids.
Bin options
Passed via struct Membrane.WebRTC.Source.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.
video_codec
:vp8 | :h264
Default value:
:vp8
keyframe_interval
Membrane.Time.t() | nil
Default value:
nil
If set, a keyframe will be requested as often as specified on each video track.ice_servers
[ExWebRTC.PeerConnection.Configuration.ice_server()]
Default value:
[%{urls: "stun:stun.l.google.com:19302"}]
depayload_rtp
boolean()
Default value:
true
Pads
:output
Accepted formats:
Membrane.H264
%Membrane.RemoteStream{content_format: Membrane.VP8}
%Membrane.RemoteStream{content_format: Membrane.Opus}
Membrane.RTP
Direction: | :output |
Availability: | :on_request |
Pad options:
kind
any
Default value:
nil
Summary
Types
Notification sent when new tracks arrive.
Options for pad :output
Struct containing options for Membrane.WebRTC.Source
Types
@type new_tracks() :: {:new_tracks, [%{id: term(), kind: :audio | :video}]}
Notification sent when new tracks arrive.
See moduledoc for details.
@type output_pad_opts() :: [{:kind, any()}]
Options for pad :output
@type t() :: %Membrane.WebRTC.Source{ depayload_rtp: boolean(), ice_servers: [ExWebRTC.PeerConnection.Configuration.ice_server()], keyframe_interval: Membrane.Time.t() | nil, signaling: Membrane.WebRTC.SignalingChannel.t() | {:websocket, Membrane.WebRTC.SimpleWebSocketServer.options()}, video_codec: :vp8 | :h264 }
Struct containing options for Membrane.WebRTC.Source
Functions
@spec options() :: keyword()
Returns description of options available for this module