react-audio
Declerative Audio component for React
Installation
simply run npm install react-audio --save
or clone the repository git clone https://github.com/farskid/react-audio.git
.
Usage
import Audio
into your component and use it.
import React, {Component} from 'react'
import Audio from 'react-audio'
export default class MyComponent extends Component {
render() {
return (
<Audio source="example/audio/path" loop={true} />
)
}
}
Usefull props
The only required prop is source
. There are also other helper props:
- loop ==> Boolean ==> indicates whether the audio should be played infinite loop or not (It will pause during pause condition)
- pause ==> statement which when gets true the audio will pause and will resume or play when it changes to false.