Skip to content

Add useMicrophone hook #2676

Description

@lizozom

Is your feature request related to a problem? Please describe.
Accessing the microphone in React requires verbose boilerplate — handling permissions, creating MediaStream, managing cleanup, and dealing with browser quirks.

Describe the solution you'd like
Add a useMicrophone hook:

const { stream, granted, error, start, stop } = useMicrophone({
  constraints: { audio: true },
});

start() requests permission and begins capture.
stop() stops and releases the mic.
stream is the live MediaStream.

Automatically cleans up on unmount.

Describe alternatives you've considered
Manual getUserMedia usage or small third-party hooks — both repetitive and less reliable.

I would love to implement the hook if you believe it's a good fit for the library.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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