Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
react-sound
Advanced tools
Readme
Sound component to play audio in your web apps. Backed by the mighty soundmanager2 library.
// In your React component:
render() {
return (
<Sound
url="cool_sound.mp3"
playStatus={Sound.status.PLAYING}
playFromPosition={300 /* in milliseconds */}
onLoading={this.handleSongLoading}
onPlaying={this.handleSongPlaying}
onFinishedPlaying={this.handleSongFinishedPlaying}
/>
);
}
Yes! It's really easy to use sounds in your app as part of the component tree in your React app.
PLAYING
status.npm install react-sound --save
var React = require('react');
var Sound = require('react-sound').default;
// ... or using import:
import React from 'react';
import Sound from 'react-sound';
class MyComponentWithSound extends React.Component {
render() {
return <Sound {...props} />; // Check props in next section
}
}
Note: By default, a restriction on mobile prevent you from playing multiple sounds. To avoid this, you need to set the ignoreMobileRestrictions
property to true
when setting up soundManager2.
playStatus
is not PLAYING
). Use this prop to seek to different positions in the sound, but not use it as a controlled component. You should use either this prop or position
, but not both.onPlaying
callback. You should use either this prop or playFromPosition
, but not both.false
).false
).errorCode
and description
with details about the error.bytesLoaded
, bytesTotal
and duration
.loaded
, a boolean set to true if the sound has finished loading successfully.position
and duration
.position
and duration
.position
and duration
.position
and duration
.Feel free to fork and send PRs or issues, be it for features, bug fixes, or documentation!
FAQs
React Sound component using soundmanager2
The npm package react-sound receives a total of 6,389 weekly downloads. As such, react-sound popularity was classified as popular.
We found that react-sound 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.