
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
react-voicemail-player
Advanced tools
React component for rendering voice messages in chat-based apps
The audio player control for React that displays the audio's amplitude peaks. Loads and decodes the audio data in memory, so best suited for small audio files, like voicemail, hence the name. The use case I had in mind is chat-based apps where users can send voice messages. Inspired by audio player in the Telegram messenger.
Note, this is neither a powerful audio visualization library, nor a powerful audio player. If you need rich visualizations, I suggest wavesurfer.js. If you look for a general-purpose audio player, check out react-audio-player-pro.
Check out the demo app.
Requires react
to be already installed in your project. Minimum supported version of React is 18 because this component uses useSyncExternalStore
hook. There is a shim for that, so it might be added in the future to support earlier versions of react
if needed.
npm i react-voicemail-player
# or
yarn add react-voicemail-player
First you need to make sure the component's CSS is included on your web page. How you do this depends on your environment. Most probably you can import the stylesheet directly in your JavaScript or your CSS files:
// App.tsx
import 'react-voicemail-player/dist/react-voicemail-player.css';
// styles.css
@import url('react-voicemail-player/dist/react-voicemail-player.css')
Then, you import and render the component as you normally would. It accepts a function as children
(render prop) that renders an <audio>
element. The function will be called with a RefCallback
as an argument that you need to set as ref
on the rendered <audio>
element.
import VoicemailPlayer from "react-voicemail-player";
function YourComponent() {
return (
<VoicemailPlayer>
{(ref) => <audio ref={ref} src="https://example.com/audio.mp3" />}
</VoicemailPlayer>
);
}
Since you have full control over the <audio>
element, you can implement whatever functionality is missing from this player yourself by setting attributes/properties or calling methods on the element. Relevant changes to the <audio>
element will be automatically reflected in the player's state. See examples setting the mute
attribute dynamically and controlling the playback rate in ./example/App.tsx;
Currently, the component only accepts two props:
children: (ref: React.RefCallback<HTMLAudioElement>) => React.ReactElement
- A function that renders the <audio>
element and sets its ref
propclassName: string
- A CSS class name to give to the component's root elementSee the full API Reference.
Please consult the component's stylesheet and source code as necessary to determine which classes and properties you need to override.
Install dependencies with yarn
:
yarn
Start development server
yarn start
Run tests (with watch mode)
yarn test
E2E tests are run against the pre-compiled library files, make sure you've run
yarn build
before running e2e tests locally
Run once:
yarn test:e2e
Run in UI mode:
yarn test:e2e:ui
Update screenshots:
yarn test:e2e --update-snapshots
Update snapshots on Linux (for CI):
docker run --rm --network host -v $(pwd):/work/ -w /work/ -it mcr.microsoft.com/playwright:v1.37.0-jammy /bin/bash
yarn install
yarn test:e2e --update-snapshots
FAQs
React component for rendering voice messages in chat-based apps
The npm package react-voicemail-player receives a total of 40 weekly downloads. As such, react-voicemail-player popularity was classified as not popular.
We found that react-voicemail-player demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
/Security News
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.