Assemble full recording alongside chunked streaming#46
Open
vishwakarmanikhil wants to merge 1 commit into
Open
Assemble full recording alongside chunked streaming#46vishwakarmanikhil wants to merge 1 commit into
vishwakarmanikhil wants to merge 1 commit into
Conversation
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.
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.
Summary
timeslice+onChunkAvailableare used to stream audio chunks in real time, the library previously dropped the chunks after emitting them — norecordedBlob,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 withouttimeslice.onChunkAvailablenow also receives ameta: { index, isLast }argument so callers can order and finalize chunk uploads (e.g. know when to close out a streamed upload).timeslice/onChunkAvailablefeature in the README, including a chunked-upload usage example (it wasn't documented before).Test plan
npm run build(tsc + vite build) passesnpm run lintpasses (no new warnings)MediaRecordervia a fake audio device): chunked recording emits chunks live during recording, produces a valid final blob/duration/playback afterstopRecording(), and chunkindex/isLastmetadata is correct (sequential indices, exactly oneisLast: truechunk)