Skip to content

Assemble full recording alongside chunked streaming#46

Open
vishwakarmanikhil wants to merge 1 commit into
YZarytskyi:mainfrom
vishwakarmanikhil:vishwakarmanikhil/chunk-recording-final-blob
Open

Assemble full recording alongside chunked streaming#46
vishwakarmanikhil wants to merge 1 commit into
YZarytskyi:mainfrom
vishwakarmanikhil:vishwakarmanikhil/chunk-recording-final-blob

Conversation

@vishwakarmanikhil

Copy link
Copy Markdown

Summary

  • When timeslice + onChunkAvailable are used to stream audio chunks in real time, the library previously dropped the chunks after emitting them — no recordedBlob, audioSrc, playback, or duration was ever produced for that recording. This buffers the chunks and assembles them into the final blob once recording stops, so the full recording still works exactly as it does without timeslice.
  • onChunkAvailable now also receives a meta: { index, isLast } argument so callers can order and finalize chunk uploads (e.g. know when to close out a streamed upload).
  • Documents the timeslice/onChunkAvailable feature in the README, including a chunked-upload usage example (it wasn't documented before).

Test plan

  • npm run build (tsc + vite build) passes
  • npm run lint passes (no new warnings)
  • Verified end-to-end in headless Chromium (real MediaRecorder via a fake audio device): chunked recording emits chunks live during recording, produces a valid final blob/duration/playback after stopRecording(), and chunk index/isLast metadata is correct (sequential indices, exactly one isLast: true chunk)
  • Verified the standard (non-chunked) recording path is unaffected

When timeslice + onChunkAvailable are used to stream audio chunks in
real time, buffer the chunks and combine them into the final blob once
recording stops, so recordedBlob/audioSrc/playback still work exactly
as they do without timeslice.

Also pass each chunk's index and isLast flag to onChunkAvailable so
callers can order and finalize uploads, and document the timeslice/
onChunkAvailable feature in the README.
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