Skip to content

feat(sw): pass audio fetches through to the network#28

Merged
revtex merged 1 commit intodevfrom
feat/sw-audio-passthrough
Apr 25, 2026
Merged

feat(sw): pass audio fetches through to the network#28
revtex merged 1 commit intodevfrom
feat/sw-audio-passthrough

Conversation

@revtex
Copy link
Copy Markdown
Owner

@revtex revtex commented Apr 25, 2026

Summary

Skip event.respondWith() in the service worker for /api/calls/:id/audio and /api/shared/:token/audio so the browser's native Range-request handling reaches the server.

Why

With <audio src=…> playback (#27), the browser issues partial-content / Range requests to seek and stream. A service worker that wraps these fetches in respondWith(fetch(request)) would buffer the full body in memory before passing it back to the element and would also break seek behaviour. Letting the SW skip these paths gives us the browser default with zero overhead.

Verification

  • pnpm exec tsc --noEmit clean.
  • Regex coverage:
    • matches /api/calls/123/audio → pass-through
    • matches /api/shared/abc-XYZ/audio → pass-through
    • does NOT match /api/calls/123, /api/calls/123/audio/extra, /api/calls → continues network-first
  • No tests since sw.ts is not exercised by Vitest.

Skip event.respondWith() for /api/calls/:id/audio and
/api/shared/:token/audio so the browser's native Range-request
handling reaches the server. Without this the SW would buffer the
full call body in memory and the <audio> element would lose its
ability to seek.
@revtex revtex merged commit b2c1a90 into dev Apr 25, 2026
7 checks passed
@revtex revtex deleted the feat/sw-audio-passthrough branch April 25, 2026 20:26
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.

1 participant