react-soundplayer alternatives and similar libraries
Based on the "Audio / Video" category.
Alternatively, view react-soundplayer alternatives based on common mentions on social networks and blogs.
-
react-player
A React component for playing a variety of URLs, including file paths, YouTube, Facebook, Twitch, SoundCloud, Streamable, Vimeo, Wistia and DailyMotion
InfluxDB - Purpose built for real-time analytics at any scale.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of react-soundplayer or a related project?
README
react-soundplayer
Create highly-customizable SoundCloud (or any audio) players with React.js.
Documentation
Install
npm install react-soundplayer --save
Examples
There are several examples on the website. Here is the basic one to get you started:
import React from 'react';
import ReactDOM from 'react-dom';
import { PlayButton, Timer } from 'react-soundplayer/components';
import { withSoundCloudAudio } from 'react-soundplayer/addons';
const clientId = 'YOUR CLIENT ID';
const resolveUrl = 'https://soundcloud.com/ksmtk/chronemics';
const Player = withSoundCloudAudio(props => {
let { track, currentTime } = props;
return (
<div className="custom-player">
<PlayButton
className="custom-player-btn"
onPlayClick={() => {
console.log('play button clicked!');
}}
{...props} />
<h2 className="custom-player-title">
{track ? track.title : 'Loading...'}
</h2>
<Timer
className="custom-player-timer"
duration={track ? track.duration / 1000 : 0}
currentTime={currentTime}
{...props} />
</div>
);
});
const App = () => {
return (
<Player
clientId={clientId}
resolveUrl={resolveUrl}
onReady={() => console.log('track is loaded!')} />
);
};
ReactDOM.render(
<App />,
document.getElementById('#app')
);
Custom Audio Example
It is also easy to built players without using SoundCloud API. You just need to pass audio source via streamUrl
and all other necessary track meta information can be passed as custom props. Also you can choose preloadType
, according to https://developer.mozilla.org/en-US/docs/Web/HTML/Element/audio#Attributes, by default this property is equal to 'auto'.
import React from 'react';
import ReactDOM from 'react-dom';
import { PlayButton, Timer } from 'react-soundplayer/components';
// it's just an alias for `withSoundCloudAudio` but makes code clearer
import { withCustomAudio } from 'react-soundplayer/addons';
// audio source
const streamUrl = 'https://example.org/path/to/file.mp3';
// some track meta information
const trackTitle = 'Great song by random artist';
const AWSSoundPlayer = withCustomAudio(props => {
const { trackTitle } = props;
return (
<div>
<PlayButton {...props} />
<h2>{trackTitle}</h2>
<Timer {...props} />
</div>
);
});
class App extends React.Component {
render() {
return (
<AWSSoundPlayer
streamUrl={streamUrl}
trackTitle={trackTitle}
preloadType="auto" />
);
}
}
ReactDOM.render(<App />, document.getElementById('app'));
References
- simply the best CSS modular toolkit on the web - BASSCSS
- easy management of HTML5 Audio API by SoundCloudAudio.js
- inspired by Plangular
- we all :heart: SoundCloud API!
- generate standalone "copy-paste" version with [Soundplayer.js](labs.voronianski.dev/get-soundplayer)
- follow updates on Twitter
MIT Licensed
*Note that all licence references and agreements mentioned in the react-soundplayer README section above
are relevant to that project's source code only.