Minimal WebRTC sender client with WHIP, DTLS via NWConnection, and SRTP#229
Closed
Minimal WebRTC sender client with WHIP, DTLS via NWConnection, and SRTP#229
Conversation
Co-authored-by: eerimoq <176810+eerimoq@users.noreply.github.com>
…rser Co-authored-by: eerimoq <176810+eerimoq@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Implement minimal WebRTC client sender in Swift
Implement minimal WebRTC sender client with WHIP protocol
Feb 9, 2026
Co-authored-by: eerimoq <176810+eerimoq@users.noreply.github.com>
Copilot
AI
changed the title
Implement minimal WebRTC sender client with WHIP protocol
Add fingerprint to WebRTC SDP offer
Feb 9, 2026
Co-authored-by: eerimoq <176810+eerimoq@users.noreply.github.com>
Copilot
AI
changed the title
Add fingerprint to WebRTC SDP offer
Minimal WebRTC sender with WHIP, DTLS, and SRTP
Feb 9, 2026
Co-authored-by: eerimoq <176810+eerimoq@users.noreply.github.com>
Copilot
AI
changed the title
Minimal WebRTC sender with WHIP, DTLS, and SRTP
Minimal WebRTC sender client with WHIP, DTLS via NWConnection, and SRTP
Feb 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
From-scratch WebRTC send-only client: single outgoing stream (H.264 video + Opus audio), WHIP signaling, local ICE candidates only. No incoming streams, no data channels, no WHEP, no STUN/TURN.
DTLS uses
NWConnectionwithNWParameters(dtls:udp:)rather than a custom protocol implementation — Apple handles the handshake natively.New files (
Moblin/Media/HaishinKit/WebRtc/)RtpPacket.swift— RTP header encode/decode, sequencer with SSRC/timestamp managementStunMessage.swift— STUN binding request/response (RFC 5389) for ICE connectivity checksSdpMessage.swift— SDP offer/answer generation and parsing; sendonly, BUNDLE, rtcp-muxIceAgent.swift— Host candidate gathering viagetifaddrs()(IPv4 only)WhipSession.swift— WHIP client: POST offer → parse answer → DELETE teardown;whip://→https://DtlsSession.swift—NWConnection-based DTLS 1.2 session with self-signed EC P-256 certificate, SHA-256 fingerprint for SDP, SRTP keying material export viaSSLExportKeyingMaterialSrtpSession.swift— SRTP key derivation (RFC 3711), AES-128-CTR payload encryption, HMAC-SHA1 auth tagsWebRtcStream.swift— Top-level stream wiring WHIP → ICE → DTLS → SRTP → encoder pipelineDTLS approach
Self-signed cert created via keychain (
SecIdentity), fingerprint derived from DER data, keychain entries cleaned up immediately after identity creation.Integration
SettingsStreamProtocol— added.webRtcSettingsStream.getProtocol()— mapswhip://scheme →.webRtcMedia.swift—webRtcStreamlifecycle,WebRtcStreamDelegateconformanceModelStream.swift—.webRtccase in start/stop streamValidate.swift—whiprecognized as valid URL scheme✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.