@untemps/user-media-utils

1.0.3 • Public • Published

@untemps/user-media-utils

Collection of utility functions to manage user media permissions.

.github/workflows/index.yml

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

Dependents (0)

Package Sidebar

Install

npm i @untemps/user-media-utils

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

29.5 kB

Total Files

16

Last publish

Collaborators

  • untemps