@untemps/user-media-utils
v1.0.3
Published
Collection of utility functions to manage user media permissions
Downloads
3
Maintainers
Readme
@untemps/user-media-utils
Collection of utility functions to manage user media permissions.
Installation
yarn add @untemps/user-media-utils
Utils
getUserMediaStream:
Returns a promise resolved when the media is authorized and the stream is retrieved
import { getUserMediaStream } from '@untemps/user-media-utils'
const init = async () => {
try {
const stream = await getUserMediaStream('microphone', { audio: true })
if(!!stream) {
const audioContext = new AudioContext()
const streamNode = audioContext.createMediaStreamSource(stream)
...
} else {
console.error('Stream is not available')
}
} catch (error) {
console.error(error)
}
}
Todos
- Rewrite with TypeScript
- Add commitlint to ensure commit logs are valid