useAudio
About
A hook to control and manage audio elements in your React application.
Examples
Basic example
Arguments
Argument value | Type | Description | Default |
---|---|---|---|
options | Object | See table below |
Options value | Type | Description | Default |
---|---|---|---|
autoPlay | Boolean | Indicates if the audio should start playing automatically | false |
isMuted | Boolean | Indicates if the audio should be muted by default | false |
Returns
Return value | Type | Description | Default |
---|---|---|---|
state | Object | An object containing isPlaying and isMuted properties | |
ref | Callback Ref | A ref that should be used on the audio element you want to control | undefined |