Gathering detailed insights and metrics for @addpipe/react-pipe-media-recorder
Gathering detailed insights and metrics for @addpipe/react-pipe-media-recorder
Gathering detailed insights and metrics for @addpipe/react-pipe-media-recorder
Gathering detailed insights and metrics for @addpipe/react-pipe-media-recorder
A React custom hook that integrates the addpipe.com recording client
npm install @addpipe/react-pipe-media-recorder
Typescript
Module System
Node Version
NPM Version
68.1
Supply Chain
98.7
Quality
90.2
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
378
Last Day
6
Last Week
8
Last Month
43
Last Year
378
15 Commits
2 Watching
1 Branches
1 Contributors
Minified
Minified + Gzipped
Latest Version
1.0.5
Package Id
@addpipe/react-pipe-media-recorder@1.0.5
Unpacked Size
13.47 kB
Size
4.31 kB
File Count
4
NPM Version
10.9.0
Node Version
23.1.0
Publised On
22 Nov 2024
Cumulative downloads
Total Downloads
Last day
500%
6
Compared to previous day
Last week
-50%
8
Compared to previous week
Last month
-87.2%
43
Compared to previous month
Last year
0%
378
Compared to previous year
@addpipe/react-pipe-media-recorder
provides a fully typed React hook for both TypeScript and JavaScript integrations that introduces the Pipe Platform into your React projects. This package allows video, audio, and screen + camera recording. It's ideal for applications that need to capture user-generated content such as video feedback, messages, resumes, or testimonials. The recorder is easy to set up and ensures cross-platform compatibility, working on both desktop and mobile devices.
With @addpipe/react-pipe-media-recorder
, you can:
Note: You will need a free trial or paid account with Addpipe to use this package.
Install the package using npm:
1npm install @addpipe/react-pipe-media-recorder
👉 Working Demo: You can find a working demo here. The demo is available in both JavaScript and TypeScript React. Find more about it here.
In this example, we insert a single Pipe recorder into the page and control it using the recorder's API (record()
and stopVideo()
).
1import { useState } from "react"; 2import usePipeSDK from "@addpipe/react-pipe-media-recorder"; // Importing the Pipe recorder npm package 3 4// Inserting a single Pipe recorder into the page 5const SingleRecorder = () => { 6 // Storing the generated recorder inside of a state - optional 7 const [recorder, setRecorder] = useState(null); 8 9 // Using the Pipe recorder custom hook 10 const { isLoaded } = usePipeSDK((PipeSDK) => { 11 // Check to make sure the code below is only executed on the initial load 12 if (isLoaded) return; 13 14 // Prepare the parameters needed to generate a new recorder 15 const pipeParams = { size: { width: 640, height: 390 }, qualityurl: "avq/360p.xml", accountHash: "YOUR_ACCOUNT_HASH", eid: "YOUR_ENV_CODE", mrt: 600, avrec: 1 }; 16 17 // Inserting a new recorder into the page 18 PipeSDK.insert("custom-id", pipeParams, (pipeRecorder) => { 19 setRecorder(pipeRecorder); // Store the recorder instance for later use 20 }); 21 }); 22 23 // Function to start a new recording using the recorder's API 24 const startRecording = () => { 25 if (!recorder) return; 26 recorder.record(); // Call to start recording 27 }; 28 29 // Function to stop a recording using the recorder's API 30 const stopRecording = () => { 31 if (!recorder) return; 32 recorder.stopVideo(); // Call to stop recording 33 }; 34 35 return ( 36 <div> 37 {!isLoaded && <div>Loading the Pipe recorder</div>} 38 <div id="custom-id"></div> {/* Placeholder for where the new recorder should be inserted */} 39 {isLoaded && recorder && ( 40 <> 41 {/* Buttons to control the recorder - Only display them after all prerequisites have loaded */} 42 <button onClick={startRecording}>Record</button> 43 <button onClick={stopRecording}>Stop</button> 44 </> 45 )} 46 </div> 47 ); 48}; 49 50export default SingleRecorder;
This example demonstrates how to insert multiple Pipe recorders into the page and also load Pipe from our S1 client delivery servers, rather than our CDN.
1import { useState } from "react"; 2import usePipeSDK from "@addpipe/react-pipe-media-recorder"; // Importing the Pipe recorder npm package 3 4// Inserting multiple Pipe recorders into the page 5const MultipleRecorders = () => { 6 // Storing the global PipeSDK into a state 7 const [pipeSdk, setPipeSdk] = useState(null); 8 9 // Custom IDs for the recorders 10 const CUSTOM_IDS = ["custom-id-1", "custom-id-2", "custom-id-3"]; 11 12 // Using the Pipe recorder custom hook 13 const { isLoaded } = usePipeSDK((PipeSDK) => { 14 // Check to make sure the code below is only executed on the initial load 15 if (isLoaded) return; 16 17 // Prepare the parameters needed to generate new recorders 18 const pipeParams = { size: { width: 640, height: 390 }, qualityurl: "avq/360p.xml", accountHash: "YOUR_ACCOUNT_HASH", eid: "YOUR_ENV_CODE", mrt: 600, avrec: 1 }; 19 20 // Inserting new recorders into the page 21 CUSTOM_IDS.forEach((id) => PipeSDK.insert(id, pipeParams, () => {})); 22 23 // Store PipeSDK into a state for controlling the recorders later 24 setPipeSdk(PipeSDK); 25 }, true); // Adding "true" will make it so that Pipe is loaded from our S1 client delivery servers 26 27 // Function to start a new recording using PipeSDK 28 const startRecording = (recorderId) => { 29 if (!pipeSdk) return; 30 pipeSdk.getRecorderById(recorderId).record(); // Call to start recording for a specific recorder 31 }; 32 33 // Function to stop a recording using PipeSDK 34 const stopRecording = (recorderId) => { 35 if (!pipeSdk) return; 36 pipeSdk.getRecorderById(recorderId).stopVideo(); // Call to stop recording for a specific recorder 37 }; 38 39 return ( 40 <> 41 {CUSTOM_IDS.map((id, index) => ( 42 <div key={index}> 43 <div id={id}></div> {/* Placeholder for where the new recorder should be inserted */} 44 {/* Buttons to control the recorder - Only display them after all prerequisites have loaded */} 45 {isLoaded && ( 46 <> 47 <button onClick={() => startRecording(id)}>Record</button> 48 <button onClick={() => stopRecording(id)}>Stop</button> 49 </> 50 )} 51 </div> 52 ))} 53 </> 54 ); 55}; 56 57export default MultipleRecorders;
To control the recorders, you can use the API control methods, such as:
record()
: Starts a new recording.stopVideo()
: Stops the recording.A full list of the recorder's API control methods can be found in the official Pipe API Documentation.
The pipeParams
object is used to configure the Pipe recorder. Here’s an example of its structure:
1const pipeParams = { 2 size: { width: 640, height: 390 }, 3 qualityurl: "avq/360p.xml", 4 accountHash: "YOUR_ACCOUNT_HASH", 5 eid: "YOUR_ENV_CODE", 6 mrt: 600, 7 avrec: 1, 8 // Additional options available in the official documentation 9};
For more detailed embed code options, refer to the Addpipe Embed Code Options.
No vulnerabilities found.
No security vulnerabilities found.