experimental(webm-recorder): add developer-only recorder to export canvas + audio to WebM #4889
+244
−3
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
This PR adds a developer-only experimental recorder that captures the
main turtle/mouse animation canvas together with application audio into a
single WebM file using standard browser APIs:
canvas.captureStream()AudioContextcreateMediaStreamDestination()MediaRecorderThere are no UI changes. The feature is opt-in, experimental, and
intended only for maintainer and developer testing.
Files Added / Modified
js/recorder-dev-only.js(new)Dev-only recording module exposing global hooks for testing.
index.htmlIncludes the dev-only recorder script (experimental).
Behavior & Design Notes
(
connectAudioToDest) to avoid assumptions about the audio graph.MediaRecorder.isTypeSupported)This PR implements a prototype solution for issue #1673 to validate
synchronized animation + audio export before any UI or format expansion.
Notes:
Tone.context.resume())due to browser autoplay policy.
Summary
This PR adds a developer-only experimental recorder that captures the main turtle/mouse animation canvas together with application audio into a single WebM file.
The implementation uses browser-native APIs:
canvas.captureStream()for visualsAudioContext→createMediaStreamDestination()for audioMediaRecorderfor recordingThere are no UI changes. The feature is opt-in and intended for maintainer/dev testing and validation.
Motivation
Addresses the long-standing request in #1673 to enable exporting:
This PR provides a minimal, low-risk prototype to validate feasibility and browser behavior before any UI or production-facing export workflow is considered.
What’s included
js/recorder-dev-only.jswindow.__startExportRecording()window.__stopExportRecording()AudioContextWhat’s NOT included
Browser & policy notes
(e.g., clicking Run) and resuming the AudioContext:
Testing instructions (for reviewers)
Demos verified (Chrome)
Notes