Gathering detailed insights and metrics for rippleberry-camera-recorder
Gathering detailed insights and metrics for rippleberry-camera-recorder
Gathering detailed insights and metrics for rippleberry-camera-recorder
Gathering detailed insights and metrics for rippleberry-camera-recorder
npm install rippleberry-camera-recorder
Typescript
Module System
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
1 Stars
9 Commits
1 Branches
1 Contributors
Updated on Mar 03, 2025
Latest Version
1.0.7
Package Id
rippleberry-camera-recorder@1.0.7
Unpacked Size
42.82 kB
Size
11.85 kB
File Count
7
NPM Version
10.5.0
Node Version
20.12.2
Published on
Sep 23, 2024
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
1
1
RippleBerry Camera Recorder is a powerful, yet easy-to-use JavaScript library that allows developers to capture video and audio from connected media devices. Built on top of the native MediaRecorder API, this package simplifies the process of recording media streams in modern web applications.
webm
blobs, ensuring accurate recording length.RippleBerry Camera Recorder works across all modern browsers and platforms, ensuring seamless functionality on:
Check out the demo application at Demo Link.
Install the package using npm or yarn:
1npm install rippleberry-camera-recorder 2# or 3yarn add rippleberry-camera-recorder
Start by importing the necessary components from the package:
1import RBCameraRecorder, { 2 getConnectedDevices, 3 getSupportedVideosOptions, 4 getSupportedAudiosOptions, 5 checkPermission, 6 requestPermission, 7} from "rippleberry-camera-recorder"
You can initialize the recorder with or without options, depending on your use case.
You can customize the recorder's behavior by passing an options object when initializing:
Keep in mind that some options may not be supported by all devices. so it's recommended to use the default options.
1const options = { 2 video: { 3 width: 1280, // Optional 4 height: 720, // Optional 5 deviceId: "your-video-device-id", // Optional 6 }, 7 audio: { 8 deviceId: "your-audio-device-id", // Optional 9 }, 10 mimeType: "video/webm", // Optional 11 audioBitsPerSecond: 128000, // Optional 12 videoBitsPerSecond: 2500000, // Optional 13} 14 15const recorder = new RBCameraRecorder(options)
You can initialize the recorder without passing any specific options. This will use the default media devices and settings:
1const recorder = new RBCameraRecorder()
Before accessing the camera or microphone, ensure permissions are granted. RippleBerry makes it simple:
1const permissions = await checkPermission() 2if (!permissions.camera || !permissions.microphone) { 3 await requestPermission() 4}
To display or list all available audio and video devices:
1const { videoDevices, audioDevices } = await getConnectedDevices()
You can preview the video stream before starting the recording. Simply attach the stream to a video element:
1const previewStream = await recorder.getPreviewStream() 2videoElement.srcObject = previewStream 3videoElement.play()
To start recording:
1const stream = await recorder.start() 2// Optionally, use the stream to show the live video
To stop recording:
1const videoBlob = await recorder.stop() 2// You now have a Blob containing the recorded media (e.g., for download or further processing)
Switch Video Device:
1await recorder.changeVideoDevice(newDeviceId)
Switch Audio Device:
1await recorder.changeAudioDevice(newDeviceId)
Get Supported Video Options:
Retrieve all supported video settings like resolution, frame rate, etc.:
1const supportedVideoOptions = await getSupportedVideosOptions() 2console.log(supportedVideoOptions)
Get Supported Audio Options:
Retrieve all supported audio settings such as bit rate, sample rate, etc.:
1const supportedAudioOptions = await getSupportedAudiosOptions() 2console.log(supportedAudioOptions)
Here’s a simple React example showing how to use the RippleBerry Camera Recorder:
1import React, { useRef, useState } from "react" 2import RBCameraRecorder, { 3 checkPermission, 4 requestPermission, 5} from "rippleberry-camera-recorder" 6 7const App = () => { 8 const [recorder, setRecorder] = useState(null) 9 const [isRecording, setIsRecording] = useState(false) 10 const videoRef = useRef(null) 11 12 const startRecording = async () => { 13 if (!recorder) { 14 const options = { 15 /* your custom options */ 16 } 17 const newRecorder = new RBCameraRecorder(options) 18 setRecorder(newRecorder) 19 } 20 21 const stream = await recorder.start() 22 videoRef.current.srcObject = stream 23 setIsRecording(true) 24 } 25 26 const stopRecording = async () => { 27 const blob = await recorder.stop() 28 const url = URL.createObjectURL(blob) 29 // Optionally download or save the video 30 setIsRecording(false) 31 } 32 33 return ( 34 <div> 35 <video ref={videoRef} controls /> 36 {!isRecording ? ( 37 <button onClick={startRecording}>Start Recording</button> 38 ) : ( 39 <button onClick={stopRecording}>Stop Recording</button> 40 )} 41 </div> 42 ) 43} 44 45export default App
RBCameraRecorder
RBCameraRecorder(options?: IOptions)
Creates a new instance of the recorder with specified configuration options.
isSupported(): boolean
Checks if the provided mime type is supported by the browser.
getPreviewStream(): Promise<MediaStream>
Returns a media stream for previewing before recording starts.
start(): Promise<MediaStream>
Starts the recording process and returns the media stream.
stop(): Promise<Blob>
Stops the recording and returns the captured media as a Blob
.
reset(): void
Resets the recorder to its initial state.
changeVideoDevice(deviceId: string): Promise<void>
Switches to a different video input device.
changeAudioDevice(deviceId: string): Promise<void>
Switches to a different audio input device.
getSupportedVideosOptions(): Promise<VideoOptions[]>
Retrieves a list of supported video configuration options.
getSupportedAudiosOptions(): Promise<AudioOptions[]>
Retrieves a list of supported audio configuration options.
This project is licensed under the MIT License.
Contributions are welcome! For issues, suggestions, or contributions, feel free to open an issue or submit a pull request in the repository!
For any inquiries or support, please contact [dev@rippleberry.net].
No vulnerabilities found.
No security vulnerabilities found.