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:
;;;; const clientId = 'YOUR CLIENT ID';const resolveUrl = 'https://soundcloud.com/ksmtk/chronemics'; const Player = ; const App = { return <Player clientId=clientId resolveUrl=resolveUrl onReady= console /> ;}; ReactDOM;
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'.
;;; // it's just an alias for `withSoundCloudAudio` but makes code clearer; // audio sourceconst streamUrl = 'https://example.org/path/to/file.mp3'; // some track meta informationconst trackTitle = 'Great song by random artist'; const AWSSoundPlayer = ; Component { return <AWSSoundPlayer streamUrl=streamUrl trackTitle=trackTitle preloadType="auto" /> ; } ReactDOM;
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 ❤️ SoundCloud API!
- generate standalone "copy-paste" version with Soundplayer.js
- follow updates on Twitter
MIT Licensed