Skip to content

Add canvas + audio recording feature with Start/Stop buttons #4698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Sauve9119
Copy link

@Sauve9119 Sauve9119 commented May 28, 2025

fix #1673

This PR adds a new feature to record the Music Blocks canvas animation along with audio as a video (.webm). This helps users, especially students, to export their mouse artwork and music performance as a downloadable video file.

What was added?

  • Added two new buttons:
    • 🎥 "Start Recording"
    • ⏹️ "Stop Recording"
  • Used canvas.captureStream() and audioContext.destination.stream to create a combined media stream.
  • Used MediaRecorder to capture and save the output as a downloadable .webm video file.

Files Modified

  • js/activity.js

Motivation

This solves [Issue #1673 ] which requested the ability to record the canvas drawing and music together into a video format (e.g., MP4/WebM) for easy sharing or documentation.

Demo

You can test the feature by:

  1. Opening Music Blocks in browser (http://127.0.0.1:3000/)
  2. Creating some music + mouse animations
  3. Clicking "Start Recording", then "Stop Recording"
  4. A .webm file will automatically download

Let me know if any improvements are needed. I'm happy to make further changes.

Copy link

✅ All Jest tests passed! This PR is ready to merge.

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.

Suggested feature: Export mouse animation and music together
1 participant