Skip to content

Update hook to allow supporting custom mime-types/config options for MediaRecorder #38

@jasonpraful

Description

@jasonpraful

Currently, the library creates a MediaRecorder instance with browser defaults, which limits users ability to control specific recording parameters.

While this works in most cases, it may not work for all use cases, especially ones where a shared backend is used for app and web - for instance:

  • iOS doesn't support for webm within apps without using something like MediaVLCKit from VLC
  • Some applications require specific formats for compatibility.
  • Server-side conversion may be needed to convert from webm to universally supported formats with something like ffmpeg which raises another bottleneck for low compute instances

Proposed Solution

Add support for configuring the MediaRecorder defaults:

useVoiceVisualizer({
  mediaRecorderOptions: {
    mimeType: 'audio/mp4', // or other supported types
    // ... other MediaRecorder optiosn
    bitsPerSecond: 128000,
  }
})

This would give users the flexibility to choose their preferred mime type - if that mime type isn't supported by the browser (for instance firefox doesn't support audio/mp4 and Safari recently added support for audio/webm) the hook throws an error.

The current implementation would still be the default scenario if no options are provided.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions