
Research
Malicious npm Package Brand-Squats TanStack to Exfiltrate Environment Variables
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.
apm-react-audio-player
Advanced tools
This is a light react audio player that is wrapped around a HTML5 audio tag, created for use on American Public Media and Minnesota Public Radio's websites.
This is a light react audio player that is wrapped around a HTML5 audio tag, created for use on American Public Media and Minnesota Public Radio's websites.
The library was designed to add a audio player to a body of a story which will not trigger the static audio player.

As of version 1.0.0, this library has no dependencies for usage.
There are several ways to install APM Player on your site.
npm install apm-react-audio-player
or to use yarn:
yarn add apm-react-audio-player
The easiest way to include this in modern javascript, assuming you are using something like and Babel, is to use an import statement.
The library uses named exports for all modules.
To import the player module:
import { ReactAudioPlayerInner, useAudioPlayer } from 'apm-react-audio-player';
See the audio tag documentation for detailed explanations of these attributes.
| Prop | Type | Default | Notes |
|---|---|---|---|
title | String | empty string | The title of the audio track |
audioSrc | String or Array | empty string | String: Single audio source URL Array: Multiple source URLs for progressive enhancement (e.g., ['stream.m3u8', 'audio.aac', 'audio.mp3']) |
description | String | empty string | The description of the audio track |
audioPlayerRef | Object | empty object | A ref object for the audio player |
progressBarRef | Object | empty object | A ref object for the progress bar |
onLoadedMetadata | Function | --- | A function to handle the loadedmetadata event |
togglePlaying | Function | --- | A function to toggle the playing state |
isPlaying | Boolean | false | Whether the audio is currently playing |
isMuted | Boolean | false | Whether the audio is currently muted |
toggleMute | Function | --- | A function to toggle the mute state |
volumeCtrl | Boolean | false | Whether to show volume controls |
volumeControl | Function | --- | A function to handle volume changes |
currentTime | Number | null | The current time of the audio track |
duration | Number | null | The duration of the audio track |
rewindControl | Function | --- | A function to rewind the audio track |
forwardControl | Function | --- | A function to fast forward the audio track |
changePlayerCurrentTime | Function | --- | A function to change the current time of the audio track |
calculateTime | Function | --- | A function to calculate the time for the audio track |
formatCalculateTime | Function | --- | A function to format the calculated time |
playBtnClass | String | empty string | The CSS class for the play button |
customStyles | Object | --- | Custom styles for the audio player |
customHtml | JSX.Element | <></> | Custom HTML to be rendered inside the player |
import { ReactAudioPlayerInner, useAudioPlayer } from 'apm-react-audio-player';
const Example = () => {
const audioPlayerRef = React.useRef();
const progressBarRef = React.useRef();
const {
onLoadedMetadata,
calculateTime,
volumeControl,
togglePlaying,
toggleMute,
isMuted,
changePlayerCurrentTime,
play,
isPlaying,
isFinishedPlaying,
currentTime,
duration,
formatCalculateTime,
rewindControl,
forwardControl
} = useAudioPlayer(audioPlayerRef, progressBarRef);
return (
<ReactAudioPlayerInner
title={'MPR NEWS'}
audioSrc={'https://play.publicradio.org/web/o/minnesota/podcasts/art_hounds/2024/06/26/arthounds_art-hounds-franconia_20240626_64.mp3'}
description={'description'}
playBtnClass="player-btn player-btn-playpause js-player-play"
audioPlayerRef={audioPlayerRef}
progressBarRef={progressBarRef}
onLoadedMetadata={onLoadedMetadata}
play={play}
isPlaying={isPlaying}
togglePlaying={togglePlaying}
isMuted={isMuted}
currentTime={currentTime}
duration={duration}
isAudioFinished={isFinishedPlaying}
toggleMute={toggleMute}
volumeCtrl={true}
volumeControl={volumeControl}
changePlayerCurrentTime={changePlayerCurrentTime}
rewindControl={rewindControl}
forwardControl={forwardControl}
calculateTime={calculateTime}
formatCalculateTime={formatCalculateTime}
customHtml={<></>}
/>
)
}
Removed isLive prop: The isLive prop has been removed from ReactAudioPlayerInner. Live stream detection is now automatic based on the HTML5 audio duration property.
isLive={true} for live streamsduration === InfinityMigration:
// ❌ Old - Remove the isLive prop
<ReactAudioPlayerInner
audioSrc="https://example.com/live.m3u8"
isLive={true} // <-- Remove this
// ... other props
/>
// âś… New - Detection is automatic
<ReactAudioPlayerInner
audioSrc="https://example.com/live.m3u8"
// ... other props
/>
The UI will automatically adapt based on the audio metadata - no manual configuration needed.
The audio player now supports HLS (HTTP Live Streaming) for both live streams and pre-recorded content using native browser support. The player uses HTML5 <source> tags for progressive enhancement, allowing browsers to fall back to alternate formats if HLS is not supported.
| Browser | HLS Support | Fallback Behavior |
|---|---|---|
| Safari 11+ | Native âś“ | N/A |
| iOS Safari | Native âś“ | N/A |
| Chrome 142+ | Native âś“ | N/A |
| Edge 142+ | Native âś“ | N/A |
| Mobile Chrome/Android | Native âś“ | N/A |
| Chrome <142 | None | Automatically uses AAC/MP3 |
| Firefox | None | Automatically uses AAC/MP3 |
| Edge <142 | None | Automatically uses AAC/MP3 |
| Safari <11 | None | Automatically uses AAC/MP3 |
Note: Chrome and Edge added native HLS support in version 142 (December 2024). Older versions will automatically skip HLS sources and use alternative formats.
See examples/hls-example.jsx for a complete working example with multiple HLS scenarios.
Provide multiple source formats to ensure compatibility across all browsers:
<ReactAudioPlayerInner
title="Podcast Episode"
audioSrc={[
'https://example.com/episode.m3u8',
'https://example.com/episode.aac',
'https://example.com/episode.mp3'
]}
// ... other props
/>
Browsers will try sources in order:
<ReactAudioPlayerInner
title="Live Radio"
audioSrc={['https://stream.example.com/live.m3u8']}
// ... other props
/>
The player maintains backward compatibility with the original single-source API:
<ReactAudioPlayerInner
title="Audio Track"
audioSrc="https://example.com/audio.mp3"
// ... other props
/>
The player automatically detects live streams using the HTML5 audio duration property:
Live streams: duration === Infinity
Pre-recorded audio: duration is a finite number
No additional props are needed - the player automatically adapts its UI based on whether the content is live or pre-recorded.
The player automatically detects MIME types from file extensions:
| Extension | MIME Type |
|---|---|
.m3u8 | application/x-mpegURL |
.mp3 | audio/mpeg |
.aac | audio/aac |
.ogg | audio/ogg |
.wav | audio/wav |
The examples/ directory contains working demonstrations of the audio player with HLS support.
Option 1: Using the serve script (recommended)
# Start local server and open examples in browser
yarn serve:examples
# Or using npm
npm run serve:examples
This will start a local server on port 8000 and automatically open the examples page in your browser.
Option 2: Open HTML file directly
examples/index.html in a web browserThe examples use a pre-built bundle (examples/bundle.js). If you modify the source code and want to rebuild the examples:
# Rebuild the examples bundle
yarn build:examples
# Or using npm
npm run build:examples
Files:
examples/index.html - Main example page with CSS and layoutexamples/hls-example.jsx - React components demonstrating HLS featuresexamples/bundle.js - Compiled bundle (auto-generated, don't edit directly)examples/hls-test.html - Additional test page for developmentapm-react-audio-player should always come with an updated version (ex. 1.0.17 to 1.0.18) in the package.json.git pull mainyarn run build or npm run buildyarn publish or npm publishMIT © Phanx091
FAQs
This is a light react audio player that is wrapped around a HTML5 audio tag, created for use on American Public Media and Minnesota Public Radio's websites.
The npm package apm-react-audio-player receives a total of 56 weekly downloads. As such, apm-react-audio-player popularity was classified as not popular.
We found that apm-react-audio-player demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 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
A brand-squatted TanStack npm package used postinstall scripts to steal .env files and exfiltrate developer secrets to an attacker-controlled endpoint.

Research
Compromised SAP CAP npm packages download and execute unverified binaries, creating urgent supply chain risk for affected developers and CI/CD environments.

Company News
Socket has acquired Secure Annex to expand extension security across browsers, IDEs, and AI tools.