/media-os:webrtc-pion [example]from media-os
Builds Go WebRTC applications using Pion with examples for SFU, WHIP/WHEP, media file streaming, and data channels.
Ships in media-os. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Context: $ARGUMENTS
Pion is the canonical Go WebRTC stack. It is a library, not a server — you embed it in your own binary. The helper script in this skill wraps the examples repo for fast prototyping: it fetches one example via git sparse-checkout, builds it, and runs it.
pion.py list-examples)webrtc-spec when you need to verify protocol details as you build.Use webrtc-mediasoup or webrtc-livekit instead if the user wants a full product out of the box — Pion is one layer down from both.
go version). Install via brew install go / apt install golang-go / golang.org.git on PATH.uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py check
Prints Go version + git presence + current GOPATH.
uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py list-examples
Canonical set (mirrors https://github.com/pion/webrtc/tree/master/examples):
| Example | What it demonstrates |
|---|---|
broadcast | Minimal 1-to-N SFU |
sfu-ws | WebSocket-signaled SFU |
simulcast | Simulcast ingest + forwarding |
play-from-disk | Send a local IVF/Ogg file as a WebRTC track |
save-to-disk | Persist incoming RTP to IVF/Ogg |
save-to-webm | Mux received tracks to a WebM file |
data-channels | Basic SCTP data channel round-trip |
data-channels-detach | Detach a data channel for raw io.ReadWriter usage |
data-channels-close | Clean DC shutdown handshake |
ice-tcp | ICE over TCP fallback |
ice-single-port | Multiplex all UDP flows on one port (SFU-style) |
ice-restart | Trigger ICE restart mid-session |
insertable-streams | Encoded-transform hooks (E2EE, watermarks) |
rtp-forwarder | Receive over WebRTC, forward RTP to a UDP socket |
rtp-to-webrtc | Ingest raw RTP, expose as a WebRTC track |
whip-whep | WHIP ingestion + WHEP egress |
stats | StatsReport snapshot dump |
custom-logger | Pluggable logging |
swap-tracks | Hot-swap a TrackLocal at runtime |
trickle-ice | Explicit trickle-ICE signaling |
Full descriptions in references/examples.md.
uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py fetch-example broadcast --dest ~/pion-broadcast
uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py build ~/pion-broadcast
uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py run ~/pion-broadcast
fetch-example does git clone --depth 1 --filter=blob:none --sparse https://github.com/pion/webrtc then git sparse-checkout set examples/<name>. No go.mod rewrites — the example already declares a replace directive against the local repo root.
Read references/primitives.md for the full list. Core objects:
webrtc.API — factory holding a MediaEngine, SettingEngine, InterceptorRegistry.webrtc.PeerConnection — SDP + DTLS + SCTP wrapper.MediaEngine — registered codecs + header extensions.SettingEngine — transport tuning (ICE lite, candidate filters, single-port mux, custom loggers).InterceptorRegistry — RTCP generator stack (NACK, TWCC, report).TrackLocalStaticRTP / TrackLocalStaticSample — write outgoing media.TrackRemote — incoming media; .ReadRTP() returns *rtp.Packet.RTPSender / RTPReceiver / RTPTransceiver — track-flow control.DataChannel — SCTP data channel; use .Detach() for byte-stream mode.ICEAgent / DTLSTransport / SCTPTransport / SRTPSession — exposed for debugging / advanced graph work.Sibling modules: pion/rtp, pion/rtcp, pion/sdp/v3, pion/ice/v3, pion/dtls/v3, pion/srtp/v3, pion/turn/v4, pion/mediadevices.
uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py whip http://localhost:8080/whip --dest ~/pion-whip
# Publish from ffmpeg (see `ffmpeg-whip` skill for the muxer flags)
# ffmpeg -re -i input.mp4 -c:v libx264 -bf 0 -c:a libopus -f whip http://localhost:8080/whip
uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py whep http://localhost:8080/whep --dest ~/pion-whep
Both subcommands are thin wrappers: fetch-example whip-whep → build → run.
pion/turn has a minimal ready-to-run server:
package main
import (
"net"
"github.com/pion/turn/v4"
)
func main() {
udpListener, _ := net.ListenPacket("udp4", "0.0.0.0:3478")
server, _ := turn.NewServer(turn.ServerConfig{
Realm: "example.org",
AuthHandler: func(username, realm string, srcAddr net.Addr) (key []byte, ok bool) {
return turn.GenerateAuthKey("alice", "example.org", "secret"), true
},
PacketConnConfigs: []turn.PacketConnConfig{
{PacketConn: udpListener, RelayAddressGenerator: &turn.RelayAddressGeneratorStatic{RelayAddress: net.ParseIP("1.2.3.4"), Address: "0.0.0.0"}},
},
})
defer server.Close()
select {}
}
For an integrated STUN+TURN deployment most teams use coturn (C, battle-tested). Use pion/turn when you want to embed TURN in the same Go binary.
github.com/pion/webrtc/v4 (current), v3 (old), v2 (abandoned). Always use v4 for new code.MediaEngine is NOT reusable across API instances — register codecs once per API.webrtc.API{} zero value is invalid. Construct via webrtc.NewAPI(...).TrackLocalStaticRTP.WriteRTP needs a payload type matching the MediaEngine registration. Mismatch drops negotiation.Sample.Duration is critical — set to time.Second/fps, otherwise RTP timestamps will be wrong.PeerConnection.OnTrack fires once per track. Put the ReadRTP loop inside the callback in its own goroutine; don't spawn one per packet.OnICEConnectionStateChange vs OnConnectionStateChange — the second is what you want for "is the PC usable right now".SendEncodings with explicit Rids in RTPTransceiverInit — missing any drops simulcast to single-layer.Interceptor order matters — NACK generator must register before the RTCP sender. Default registry does it right.TrackRemote.SSRC() vs SDP a=ssrc: — with RTX you get primary + RTX as separate TrackRemote events.go.mod replace in examples points at the repo root. When copying an example outside the repo, drop the replace and use go get github.com/pion/webrtc/v4@latest.uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py fetch-example broadcast --dest ~/pion-broadcast
uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py run ~/pion-broadcast
uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py fetch-example save-to-disk --dest ~/pion-save
uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py run ~/pion-save
uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py whip http://0.0.0.0:8080/whip --dest ~/pion-whip
uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py fetch-example insertable-streams --dest ~/pion-is
uv run ${CLAUDE_SKILL_DIR}/scripts/pion.py run ~/pion-is
Copy Step-6 skeleton into main.go, go mod init local-turn && go get github.com/pion/turn/v4 && go run ..
go: module github.com/pion/webrtc/v4 ...: unexpected EOFCause: network hiccup during module resolution.
Solution: go clean -modcache then retry. Verify GOPROXY via go env GOPROXY.
failed to negotiate: cannot satisfy media sectionCause: offered codec isn't registered on the answerer's MediaEngine.
Solution: call MediaEngine.RegisterDefaultCodecs() or RegisterCodec per codec.
Cause: TrackLocalStaticSample.WriteSample called with Duration: 0 or wrong PT.
Solution: set Sample{Duration: time.Second/30} for 30 fps; confirm PT matches engine registration.
ICE connection state: failed on deployCause: no TURN, publisher behind symmetric NAT, or TURN unreachable from subscriber.
Solution: add TURN via RTCConfiguration.ICEServers. Test with trickle-ice probe.
examples/<name>/main.go: no such file or directoryCause: example renamed upstream.
Solution: re-run list-examples.
references/primitives.md when you need the full Pion object + sibling-lib catalog with pkg.go.dev URLs.references/examples.md when you need one-paragraph descriptions of every canonical example.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub damionrashford/media-os --plugin media-os110 skills in this plugin
/audio-coreaudioManipulate macOS audio at the Core Audio HAL layer: afinfo (audio file metadata), afplay (play), afconvert (convert format/rate/bit-depth/channel layout), say (TTS), SwitchAudioSource (change default input/output/system device — brew install switchaudio-osx), audiodevice CLIs (npm/Go variants), AppleScript via osascript to drive System Preferences Sound. HAL plugins at /Library/Audio/Plug-Ins/HAL/ load virtual drivers (BlackHole 2ch/16ch/64ch, Loopback, Background Music). Aggregate Device (drift-corrected multi-in) and Multi-Output Device via Audio MIDI Setup.app or AudioHardwareCreateAggregateDevice. Use when the user asks to change default macOS audio device, route audio between apps on Mac, install BlackHole, build an Aggregate Device, convert audio files with afconvert, or script Mac audio from the terminal.
/audio-jackRoute professional low-latency audio with JACK Audio Connection Kit (jackaudio.org): jackd server (ALSA/CoreAudio/PortAudio/ASIO backends), jack_control (D-Bus JACK2 config), jack_lsp (list ports/connections), jack_connect/jack_disconnect (manage links), jack_cpu_load, jack_samplerate, jack_bufsize (runtime period size), jack_transport, jack_rec (multi-channel WAV recording), jack_iodelay (round-trip latency), jack_wait, jack_midi_dump. JACK1 C maintenance vs JACK2 C++ multicore. Modern Linux swaps jackd for PipeWire's libjack shim — same client API. JackTrip for uncompressed multichannel UDP over the Internet. Use when the user asks to run a JACK server, connect audio clients, measure roundtrip latency, record from JACK ports, set JACK period size, or bridge JACK over the network with JackTrip.
Other plugins' skills for the same job