
Research
npm Malware Targets Telegram Bot Developers with Persistent SSH Backdoors
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
@clxrity/react-audio
Advanced tools
A react audio player component library.
npm i @clxrity/react-audio
pnpm add @clxrity/react-audio
yarn add @clxrity/react-audio
Component | Controls | Customizable | Display Track Info |
---|---|---|---|
<JustPlayer/> | Play/pause | ✅ | ❌ |
<Waveform /> | Play/pause, volume, progress, mute/unmute | ✅ | ❌ |
<AudioPlayer/> | Play/pause, volume, progress, mute/unmute | ✅ | ✅ |
<AudioLibrary/> | Play/pause, volume, progress, mute/unmute, next/previous | ✅ | ✅ |
npm i @clxrity/react-audio --save-optional
Works ONLY with Nextjs App Router
You can generate an image of an audio file's waveform by using the setup-waveform-api
script.
npx setup-waveform-api
app/api/generate-waveform/route.ts
file.
import fluentFfmpeg from 'fluent-ffmpeg';
import path from 'path';
import { NextRequest, NextResponse } from 'next/server';
export async function GET(req: NextRequest) {
const url = new URL(req.url);
const audioUrl = url.searchParams.get('url');
if (!audioUrl) {
return NextResponse.json({ error: 'Missing URL query parameter' }, { status: 400 });
}
const waveformPath = path.join(process.cwd(), 'public', 'waveform.png');
const promise = new Promise((resolve, reject) => {
fluentFfmpeg(audioUrl)
.audioFilters('aformat=channel_layouts=stereo')
.outputOptions('-filter_complex', 'aformat=channel_layouts=stereo,showwavespic=s=600x120')
.output(waveformPath)
.on('end', () => {
resolve(NextResponse.json({ message: `Waveform image at ${waveformPath}` }, { status: 200 }));
})
.on('error', (err) => {
reject(NextResponse.json({ error: err }, { status: 500 }));
})
.run();
});
return promise;
}
fetch()
to handle the API request, make sure to pass the absolute URL of the audio file./**
* In this example, the audio file is within the public/ directory.
* `/public/audio.wav` = `http://localhost:3000/audio.wav`
* @see https://nextjs.org/docs/app/building-your-application/optimizing/static-assets
*/
await fetch('http://localhost:3000/api/generate-waveform?url=http://localhost:3000/audio.wav')
public/
directory. (e.g. public/waveform.png
)<JustPlayer />
'use client'
import { JustPlayer } from '@clxrity/react-audio'
export default function Component() {
return (
<JustPlayer
track={{
src: '/audio.wav',
}}
/>
)
}
<JustPlayer
track={tracks[0]}
size={50} {/* ICON SIZE */}
style={{
backgroundColor: "red",
padding: "1rem",
borderRadius: "1rem",
boxShadow: "0 0 1rem rgba(0, 0, 0, 0.1)",
display: "flex",
alignItems: "center",
justifyContent: "center"
}} {/* REACT CSS PROPERTIES */}
/>
<Waveform />
'use client'
import { type Track, Waveform } from '@clxrity/react-audio'
const track: Track = {
// ...
}
export default function Component() {
return (
<Waveform
track={track}
size={{
width: window.innerWidth,
height: window.innerHeight,
}}
color="#ff0000"
/>
)
}
'use client'
export default function Component() {
return (
<Waveform
track={track}
canvasStyles={{
borderRadius: '0.5rem',
border: '1px solid #333',
}}
size={{
width: 300,
height: 120,
}}
/>
)
}
<AudioPlayer />
'use client'
import { type Track, AudioPlayer } from '@clxrity/react-audio'
const track: Track = {
src: '/audio.wav',
title: 'Track Title',
author: {
name: 'Track Author',
url: 'https://www.someurl.com',
},
thumbnail: './favicon.ico',
}
export default function Component() {
return <AudioPlayer track={track} />
}
<AudioLibrary />
'use client'
import { AudioLibrary } from '@clxrity/react-audio'
import { tracks } from './data'
export default function Component() {
return (
<div>
<AudioLibrary tracks={tracks} />
</div>
)
}
<AudioLibrary
tracks={tracks}
styles={{
backgroundColor: 'transparent',
textColor: 'white',
boxShadow: '10px 5px 5px red',
theme: 'dark',
border: '1px solid white',
}}
/>
If you'd like further customization, import the base components:
import {
LibraryPlayer, // The player component
LibraryTrackItem, // Individual track component
} from '@clxrity/react-audio'
'use client'
import {
type Track,
// ...
} from '@clxrity/react-audio'
import { useState } from 'react'
const tracks: Track[] = [
// ...
]
export default function Component() {
const [currentTrackIndex, setCurrentTrackIndex] = useState(-1)
const currentTrack = tracks[currentTrackIndex]
return (
<div>
<h1>My songs</h1>
<ul>
{tracks.map((track, index) => (
<LibraryTrackItem
key={index}
selected={index === currentTrackIndex}
track={track}
trackNumberLabel={index}
onClick={() => setCurrentTrackIndex(index)}
/>
))}
</ul>
<LibraryPlayer
key={currentTrackIndex}
currentTrack={currentTrack}
trackIndex={current}
trackCount={tracks.length}
onNext={() => setCurrentTrackIndex((i) => i + 1)}
onPrev={() => setCurrentTrackIndex((i) => i - 1)}
/>
</div>
)
}
Example from clxrity.xyz
1.6.0
FAQs
A simple audio player for React
The npm package @clxrity/react-audio receives a total of 10 weekly downloads. As such, @clxrity/react-audio popularity was classified as not popular.
We found that @clxrity/react-audio demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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
Malicious npm packages posing as Telegram bot libraries install SSH backdoors and exfiltrate data from Linux developer machines.
Security News
pip, PDM, pip-audit, and the packaging library are already adding support for Python’s new lock file format.
Product
Socket's Go support is now generally available, bringing automatic scanning and deep code analysis to all users with Go projects.