@bengreenier/react-user-media

react-user-media

A collection of hooks and components for easier access to getUserMedia, getDisplayMedia, and enumerateDevices in React.

  • useMedia('user')

  • useMedia('display')

  • useMediaTracks(...)

    • useMediaAudioTracks(...)
    • useMediaVideoTracks(...)
    • useTrackMuteState(...)
  • useMediaDevices()

    • useMediaAudioInputDevices()
    • useMediaAudioOutputDevices()
    • useMediaVideoDevices()
  • useMediaRecorder()

  • AudioPlayer
  • VideoPlayer
  • getSupportedConstraints()
  • closeMedia(...)

Please feel free to open any issues or PRs!

This project uses pnpm for dependency management, and expects a local Node.js installation for dev and testing.

Then just pnpm run:

  • build - builds the project
  • dev - starts hosting the examples for local development.
  • test - runs tests.
  • lint - runs the linter.

Dual-licensed under Apache 2.0 + MIT.