# `Parlora.Channels.Browser`
[🔗](https://github.com/hfiguera/parlora/blob/v0.1.0/lib/parlora/channels/browser.ex#L1)

One browser audio connection, terminated at Parlora with ExWebRTC and libopus.

Supply `:signaling` as the owning signaling process. It receives
`{:parlora_browser, channel_pid, {:signal, json_map}}`; submit the browser's
offer and ICE candidates with `signal/2` from that same process. Its death
closes the channel. Only one audio offer is supported per session.

Options: `:ice_servers` (default `[]`), `:ice_transport_policy` (`:all` or
`:relay`, default `:all`), `:jitter_ms` (40),
`:playback_buffer_ms` (120), `:playback_buffering` (`:adaptive` or `:fixed`,
default `:adaptive`), `:playback_recovery_ms` (120),
`:max_rtp_packets` (32), `:max_age_ms` (200),
and `:max_mailbox` (256). Bounds reject overload rather than growing queues.
Adaptive playback learns a target between the initial cushion and 200 ms,
capped by queue duration. Recovery waiting has its own cap; zero initial
cushion disables buffering. See the [browser guide](browser-channel.html).
Clear affects Parlora buffers; packets already handed to ExWebRTC and browser
or OS buffers cannot be recalled. Handoff does not confirm audibility.

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `observations`

Bounded media counters; sent packets are not confirmed playback.

# `signal`

Admits one offer or ICE candidate from the channel's signaling owner.

After receiving `{:parlora_browser, channel, :attached}`, submit string-keyed maps:

    %{"type" => "offer", "sdp" => offer_sdp}
    %{"type" => "candidate", "candidate" => %{
      "candidate" => candidate_string, "sdpMid" => "0", "sdpMLineIndex" => 0
    }}

Send the offer before its candidates. The SDP must negotiate one bidirectional
Opus audio track. `sdpMid` may be nil; optional `usernameFragment` is forwarded.
Ignore the browser's null end-of-gathering candidate. Admission is asynchronous;
observe channel events for negotiation failure and session readiness.

See the [browser handshake and JavaScript client](browser-channel.html#signaling-messages)
for the WebSocket envelopes used by `Parlora.Channels.Browser.Signaling`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
