Skip to content

Latest commit

 

History

History

react-user-media

react-user-media

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

Hooks

  • useMedia('user')

  • useMedia('display')

  • useMediaTracks(...)

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

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

Components

  • AudioPlayer
  • VideoPlayer

Utility functions

  • getSupportedConstraints()
  • closeMedia(...)

Contributing

Please feel free to open any issues or PRs!

Building locally

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.

License

Dual-licensed under Apache 2.0 + MIT.