
Research
5 Malicious Chrome Extensions Enable Session Hijacking in Enterprise HR and ERP Systems
Five coordinated Chrome extensions enable session hijacking and block security controls across enterprise HR and ERP platforms.
@wavesurfer/react
Advanced tools
A React component and hook for wavesurfer.js.
It makes it easy to use wavesurfer from React. All of the familiar wavesurfer options become React props.
You can subscribe to various wavesurfer events also via props. Just prepend an event name with on, e.g. ready -> onReady. Each event callback receives a wavesurfer instance as the first argument.
With yarn:
yarn add wavesurfer.js @wavesurfer/react
With npm:
npm install wavesurfer.js @wavesurfer/react
As a component:
import WavesurferPlayer from '@wavesurfer/react'
const App = () => {
const [wavesurfer, setWavesurfer] = useState(null)
const [isPlaying, setIsPlaying] = useState(false)
const onReady = (ws) => {
setWavesurfer(ws)
setIsPlaying(false)
}
const onPlayPause = () => {
wavesurfer && wavesurfer.playPause()
}
return (
<>
<WavesurferPlayer
height={100}
waveColor="violet"
url="/my-server/audio.wav"
onReady={onReady}
onPlay={() => setIsPlaying(true)}
onPause={() => setIsPlaying(false)}
/>
<button onClick={onPlayPause}>
{isPlaying ? 'Pause' : 'Play'}
</button>
</>
)
}
Alternatively, as a hook:
import { useRef } from 'react'
import { useWavesurfer } from '@wavesurfer/react'
const App = () => {
const containerRef = useRef(null)
const { wavesurfer, isReady, isPlaying, currentTime } = useWavesurfer({
container: containerRef,
url: '/my-server/audio.ogg',
waveColor: 'purple',
height: 100,
})
const onPlayPause = () => {
wavesurfer && wavesurfer.playPause()
}
return (
<>
<div ref={containerRef} />
<button onClick={onPlayPause}>
{isPlaying ? 'Pause' : 'Play'}
</button>
</>
)
}
Wavesurfer plugins can be passed in the plugins option.
Important: The plugins array must be memoized using useMemo or defined outside the component. This is because wavesurfer.js mutates plugin instances during initialization, and passing a new array on every render will cause errors.
import { useMemo } from 'react'
import WavesurferPlayer from '@wavesurfer/react'
import Timeline from 'wavesurfer.js/dist/plugins/timeline.esm.js'
const App = () => {
const plugins = useMemo(() => {
return [
Timeline.create({
container: '#timeline',
}),
]
}, [])
return (
<>
<WavesurferPlayer
height={100}
waveColor="violet"
url="/audio.wav"
plugins={plugins}
/>
<div id="timeline" />
</>
)
}
import { useMemo } from 'react'
import WavesurferPlayer from '@wavesurfer/react'
import Timeline from 'wavesurfer.js/dist/plugins/timeline.esm.js'
import Regions from 'wavesurfer.js/dist/plugins/regions.esm.js'
const App = () => {
const plugins = useMemo(() => {
return [
Timeline.create({
container: '#timeline',
}),
Regions.create(),
]
}, [])
return (
<>
<WavesurferPlayer
height={100}
waveColor="violet"
url="/audio.wav"
plugins={plugins}
/>
<div id="timeline" />
</>
)
}
If your plugins don't depend on component props or state, you can define them outside:
import WavesurferPlayer from '@wavesurfer/react'
import Timeline from 'wavesurfer.js/dist/plugins/timeline.esm.js'
// Define plugins outside the component
const plugins = [
Timeline.create({
container: '#timeline',
}),
]
const App = () => {
return (
<>
<WavesurferPlayer
height={100}
waveColor="violet"
url="/audio.wav"
plugins={plugins}
/>
<div id="timeline" />
</>
)
}
FAQs
React component and hook for wavesurfer.js
The npm package @wavesurfer/react receives a total of 61,374 weekly downloads. As such, @wavesurfer/react popularity was classified as popular.
We found that @wavesurfer/react demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Five coordinated Chrome extensions enable session hijacking and block security controls across enterprise HR and ERP platforms.

Research
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.

Research
/Security News
A malicious Chrome extension steals newly created MEXC API keys, exfiltrates them to Telegram, and enables full account takeover with trading and withdrawal rights.