If someone's here looking for react hooks for media / camera / microphone
This project has some nice ones:
https://github.com/dcollien/react-media-hooks
There's a lot of nuance to user media including:
- handling permissions asynchronously
- handling stream creation asynchronously from getUserMedia
- closing streams properly so the "recording" icon on the tab goes away
- handling stream interruptions (e.g. when a device changes mid recording)
- ensuring interaction has occurred before instantiating WebAudio contexts
etc.
The hooks here seem to have covered these use cases