Skip to content
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

Audio Block: Add live recording feature #69183

Open
wants to merge 3 commits into
base: trunk
Choose a base branch
from

Conversation

dhruvikpatel18
Copy link
Contributor

Closes #38632

What?

Adds a live audio recording feature to the Audio Block, allowing users to record audio directly within the editor and automatically upload it to the media library.

Why?

This enhancement addresses the challenge of adding audio content to websites, especially on mobile devices. Currently, users need to pre-record audio using external apps and then upload files, which can be cumbersome and sometimes leads to compatibility issues. This feature streamlines the process by providing direct recording capabilities within the block editor.

How?

  • Added a new AudioRecorder component with recording controls
  • Implemented browser's MediaRecorder API for audio capture
  • Integrated with WordPress media upload system
  • Added recording status indicators and timer
  • Implemented proper error handling for permissions and upload issues
  • Supports both WebM and MP4 audio formats based on browser compatibility

Testing Instructions

  1. Open the block editor and add an Audio Block
  2. Look for the "Record Audio" button in the block placeholder
  3. Click the button and accept microphone permissions when prompted
  4. Record some audio (you should see a timer)
  5. Click "Stop Recording"
  6. Verify that the audio is uploaded to the media library
  7. Verify that the recorded audio plays correctly in the block
  8. Try replacing existing audio using the recording feature from the toolbar

Screenshots or screencast

Before

Screen.Recording.2025-02-13.at.3.07.33.PM.mov

After

Screen.Recording.2025-02-13.at.3.08.27.PM.mov

@dhruvikpatel18 dhruvikpatel18 marked this pull request as ready for review February 13, 2025 11:05
Copy link

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: dhruvikpatel18 <[email protected]>
Co-authored-by: mrfoxtalbot <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

@t-hamano t-hamano added [Type] Enhancement A suggestion for improvement. [Block] Audio Affects the Audio Block labels Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Block] Audio Affects the Audio Block [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Audio Block: Add a "live recording" feature.
2 participants