Gathering detailed insights and metrics for react-moskaj-audio-player
Gathering detailed insights and metrics for react-moskaj-audio-player
Gathering detailed insights and metrics for react-moskaj-audio-player
Gathering detailed insights and metrics for react-moskaj-audio-player
npm install react-moskaj-audio-player
Typescript
Module System
Node Version
NPM Version
61.3
Supply Chain
93.9
Quality
75.5
Maintenance
100
Vulnerability
100
License
Cumulative downloads
Total Downloads
Last day
200%
3
Compared to previous day
Last week
-40%
6
Compared to previous week
Last month
500%
36
Compared to previous month
Last year
-8.1%
318
Compared to previous year
2
3
21
Supported browsers: Chrome, Firefox, Safari, Opera, Edge, IE (≥10)
$ npm i react-moskaj-audio-player
Or
$ yarn add react-moskaj-audio-player
1import AudioPlayer from 'react-moskaj-audio-player'; 2import 'react-moskaj-audio-player/lib/styles.css'; 3 4const Player = () => ( 5 <AudioPlayer 6 autoPlay 7 src="http://example.com/audio.mp3" 8 onPlay={e => console.log("onPlay")} 9 // other props here 10 /> 11);
Props | Type | Default | Note |
---|---|---|---|
src | String | '' | |
preload | String | 'auto' | |
autoPlay | Boolean | false | Won't work on mobile |
loop | Boolean | false | |
muted | Boolean | false | |
loop | Boolean | false | |
volume | Number | 1.0 | Won't work on mobile |
crossOrigin | String | undefined | |
mediaGroup | String | undefined |
More native attributes detail: MDN Audio element
The controls
attribute defaults to false
and should never be changed to true
because this library is already providing UI.
Show volume bar and mute button
Show loop toggle button
Show previous/Next buttons
Show Rewind/Forward buttons
Called when click Previous button
Called when click Next button
Called when there's error clicking play button
Indicates the jump step when clicking rewind/forward button or left/right arrow key
Indicates the jump step when pressing up/down arrow key
Indicates the interval that the progress bar UI updates.
Indicates how often to call the onListened
prop during playback, in milliseconds.
Called when unloading the audio player, like when switching to a different src file. Passed the event.
Called when enough of the file has been downloaded to be able to start playing.
Called when playback has finished to the end of the file. Passed the event.
Called when the audio tag encounters an error. Passed the event.
Called every listenInterval
milliseconds during playback.
Called when the user pauses playback. Passed the event.
Called when the user taps play.
React moskaj Audio Player provides built-in class names and SASS/LESS variables for developers to overwrite.
For LESS variables, just replace $
with @
.
You can get direct access to the underlying audio element. First get a ref to ReactAudioPlayer:
1<ReactAudioPlayer ref={c => (this.player = c)} /> // Use `createRef` also works
Then you can access the audio element like this:
this.player.audio
css
or scss
manuallyhidePlayer
- Use parent logic to hide playeronDragStart
, onDragMove
, onDragEnd
- V2 isn't using drag events anymoreIn 1.x, we use prop-types
package instead of using it directly in React. Thus we dropped support under react@15.5.0
. The usage will remain the same.
Issues and PR's are welcome.
No vulnerabilities found.
No security vulnerabilities found.