Membrane.MoQ.Source (Membrane MoQ plugin v0.1.0)

Copy Markdown View Source

Membrane Source acting as a MoQ subscriber.

Connects to a MoQ relay server and subscribes to tracks of a single broadcast over one shared QUIC connection. An output pad corresponds to one MoQ track.

Parent notifications

Membrane.MoQ.Source watches the broadcast catalog and notifies its parent about track changes:

  • {:new_track, {track :: ExMoQ.Native.track(), stream_format :: struct()}} when a track is advertised. track is the catalog rendition key to pass as the :track option of an output pad; stream_format is the format the pad will start with.
  • {:track_removed, track :: ExMoQ.Native.track()} when an advertised track disappears from the catalog (e.g. the publisher ended it).
  • A track whose codec parameters change mid-broadcast is reported as a :track_removed, followed by a :new_track, so a stale pad can be torn down and re-wired against the new format.
  • {:subscription_died, {track :: ExMoQ.Native.track(), reason :: String.t()}} when the native subscription feeding a pad fails while the track may still be advertised in the catalog. The source sends :end_of_stream to that pad; re-linking a pad for the track starts a fresh subscription.
  • {:disconnected, reason :: String.t() | ExMoQ.Native.close_reason()} when the broadcast goes away or the session drops. The source sends :end_of_stream to all active pads.

Element options

Passed via struct Membrane.MoQ.Source.t/0

  • url

    String.t()

    Required
    URL of the MoQ relay to connect to, e.g. "https://localhost:4443".

  • broadcast

    String.t()

    Required
    Broadcast path to subscribe to, see Broadcast at https://doc.moq.dev/concept/layer/moq-lite.html#terminology. A .msf suffix pulls track info from the MSF catalog, and the default fallback is hang.

  • disable_tls_verify?

    boolean()

    Default value: false
    If true, the QUIC client skips TLS certificate verification. Useful for self-signed local relays only.

  • latency

    Membrane.Time.t()

    Default value: 1000000000
    How long each track buffers received frames before emitting them, trading end-to-end delay for resilience to network jitter and reordering.

Pads

:output

Accepted formats:

Membrane.AAC
Membrane.Opus
Membrane.H264
Membrane.H265
%Membrane.RemoteStream{type: :packetized}
Direction::output
Availability::on_request
Flow control::push

Pad options:

  • track

    ExMoQ.Native.track()

    Required
    Catalog rendition key within the broadcast to subscribe to on this pad, see Track at https://doc.moq.dev/concept/layer/moq-lite.html#terminology

  • priority

    0..255 | nil

    Default value: nil
    Delivery priority of this subscription. Under congestion, tracks with a higher value are sent first. When nil, hang defaults for the track's media kind are used.

Summary

Types

Options for pad :output

t()

Struct containing options for Membrane.MoQ.Source

Functions

Returns description of options available for this module

Types

output_pad_opts()

@type output_pad_opts() :: [track: ExMoQ.Native.track(), priority: 0..255 | nil]

Options for pad :output

t()

@type t() :: %Membrane.MoQ.Source{
  broadcast: String.t(),
  disable_tls_verify?: boolean(),
  latency: Membrane.Time.t(),
  url: String.t()
}

Struct containing options for Membrane.MoQ.Source

Functions

options()

@spec options() :: keyword()

Returns description of options available for this module