You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Summary
- Add `preferredVideoCodec: "h264" | "vp9"` to `realtime.connect()`
options. Defaults to `h264` via existing config.
- VP9 publishes get a 2.6 Mbps `maxBitrate` cap (new
`REALTIME_CONFIG.livekit.vp9MaxVideoBitrateBps`); other codecs keep the
3.5 Mbps default.
- Desktop Safari still force-pins `vp8`; a warn log is emitted if a user
value is ignored.
- Only affects the LiveKit publish codec — the Safari-only
`livekit_server_codec` query param is untouched.
- Test page (`packages/sdk/index.html`) gets a codec dropdown in the
publisher config section.
## Test plan
- [x] `pnpm exec tsc --noEmit` clean
- [x] `pnpm test --run` — 206/206 passing
- [ ] Manual: load `packages/sdk/index.html`, pick `vp9`, connect;
verify `RTCRtpSender.getParameters().encodings[0].maxBitrate ===
2_600_000` and active codec is VP9 in `chrome://webrtc-internals`
- [ ] Manual: pick `h264` (or default), confirm `maxBitrate ===
3_500_000`
- [ ] Manual on Desktop Safari: pick `vp9`, confirm warn log and that
`vp8` is published
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- CURSOR_SUMMARY -->
---
> [!NOTE]
> **Medium Risk**
> Changes WebRTC publish encoding (codec, bitrate, simulcast) on the
realtime path; Safari override limits blast radius but wrong VP9
settings could affect stream quality or compatibility.
>
> **Overview**
> Adds optional **`preferredVideoCodec`** (`h264` | `vp9`) on
**`realtime.connect()`** so callers can choose the LiveKit **local
camera publish** codec; omitting it keeps the existing **h264** default.
>
> Publish options now **resolve codec explicitly**: **VP9** uses a **3
Mbps** max bitrate (`vp9MaxVideoBitrateBps`) and **disables simulcast**;
other codecs keep **3.5 Mbps** and simulcast. **Desktop Safari** still
**forces VP8** for publish (and the `livekit_server_codec` query param);
user preference does not override that.
>
> The SDK **test page** adds a codec dropdown wired into connect for
manual verification.
>
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
0878f7c. Bugbot is set up for automated
code reviews on this repo. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
0 commit comments