1.0.2 • Published 2 years ago
@sswahn/camera v1.0.2
Camera ·

Camera provides a set of methods for managing video and audio streams from a device's camera and microphone. This library offers functionalities like starting/stopping the camera, toggling the light, muting audio, capturing photos, and recording videos.
Features
- Start and stop the device's camera with custom constraints.
- Capture still photos from the video stream.
- Record video clips.
- Toggle camera light (if supported by the device).
- Mute and unmute audio.
Installation
Using npm.
npm install @sswahn/cameraUsage
Here's a brief overview of the functionalities provided:
Import Camera
import camera from '@sswahn/camera'Turn The Camera On
const stream = await camera.on(optionalConstraints)Display The Stream
videoRef.current.srcObject = stream
...
<video ref={videoRef} autoPlay muted></video>Take Photos
const videoElement = videoRef.current
const blob = await camera.takePhoto(videoElement)Start Recording
const frames = []
const recorder = camera.startRecording(stream, frames)Stop Recording
const blob = await camera.stopRecording(recorder, frames)Turn The Camera Off
camera.off(stream)Turn On Light
camera.light(stream)Turn Off Light
camera.dark(stream)Mute Audio
camera.mute(stream)Unmute Audio
camera.unmute(stream)License
Camera is MIT Licensed
1.0.2
2 years ago
1.0.1
2 years ago
1.0.0
2 years ago
1.0.0-beta.4
2 years ago
1.0.0-beta.3
2 years ago
1.0.0-beta.2
2 years ago
1.0.0-beta.1
2 years ago
1.0.0-beta.0
2 years ago