@solid-primitives/stream
v0.6.14
Published
Primitive that gets a user media stream from microphone, camera or screen
Downloads
5,459
Readme
@solid-primitives/stream
Creates primitives to work with media streams from microphones, cameras or the screen.
Installation
npm install @solid-primitives/stream
# or
yarn add @solid-primitives/stream
How to use it
const [stream, { mutate, refetch, stop } = createStream(constraints: MediaDeviceInfo | MediaStreamConstraints);
stream: Accessor<MediaStream | undefined> & { loading: boolean, error: any }
mutate: (stream: MediaStream | undefined) => void // overwrite the stream
refetch: () => void // refetch the stream without changing the constraints
stop: () => void // stop the current stream
const [amplitude, { mutate, refetch, stop } = createAmplitudeStream(device: MediaDeviceInfo);
amplitude: Accessor<number> & { loading: boolean, error: any }
// otherwise like createStream
createMediaPermissionRequest(target?: 'audio' | 'video' | MediaStreamConstraints);
// use the createPermission primitive to watch the permissions.
Demo
https://primitives.solidjs.community/playground/stream
Changelog
See CHANGELOG.md