Skip to content

Libdatachannel body webrtc audio - #703

Draft
stefpi wants to merge 23 commits into
masterfrom
libdatachannel-body-webrtc-audio
Draft

Libdatachannel body webrtc audio#703
stefpi wants to merge 23 commits into
masterfrom
libdatachannel-body-webrtc-audio

Conversation

@stefpi

@stefpi stefpi commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

No description provided.

stefpi and others added 22 commits July 29, 2026 15:56
The video player was kept in sync with a virtual timeline clock by
nudging videoElement.playbackRate by ±0.1 every 200-500ms whenever
they drifted. Each playbackRate write hits the audio decoder, so on
audio-sensitive paths (iOS Safari, CarPlay, AirPlay/Bluetooth, macOS
audio routes) the audio crackled, stuttered, and dropped.

Several layers of workarounds had grown around it:

- iOS hid the playback speed UI entirely.
- iOS skipped the rate-fudge step (so iOS audio was OK, but iOS video
  drifted from the timeline and `readyState` got pumped via a
  force-pause hack to "unstick" the buffer).
- Firefox capped at 8x because it mutes audio above 8x.
- HLS.js had a custom pause/play orchestration to work around the
  rate writes interfering with playback.

This change inverts the model: the video plays at its declared rate
and the timeline follows it, instead of the timeline driving the
video. syncVideo now only acts on real divergence:

- |diff| > 0.5s → push to video (user seek, loop wrap, initial sync).
- |diff| > 0.05s while playing → pull the timeline to the video by
  dispatching a seek action (Redux only, no media-element touch).

Buffering state switches to the browser's own waiting/playing events
via ReactPlayer's onBuffer/onBufferEnd, replacing the readyState
polling and the iOS-specific force-pause "fix". Drops the 16x cap and
the Firefox 8x branch — playback rate is now whatever the user
actually selected, not a moving target.

Restores the speed UI on iOS, drops the now-unused isFirefox helper.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Welcome to connect! Make sure to:

  • read the contributing guidelines
  • mark your PR as a draft until it's ready to review
  • post the preview on Discord; feedback from users will speedup the PR review

deployed preview: https://703.connect-d5y.pages.dev
gallery report: https://703.connect-d5y.pages.dev/connect-gallery

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants