Ionic react hooks by Ethan Olsen
npm install @ethanol/ionic-react-hooks> Ionic react hooks by Ethan Olsen
_This library is not still being developed and is not to be used in applications till done._
 
``bash`
npm install --save @ethanol/ionic-react-hooks
#### useAudioPlayer
`tsx
import React from 'react'
import { useAudioPlayer } from '@ethanol/ionic-react-hooks'
interface Props {
audioUrl: string
}
export const AudioComponent = ({ audioUrl }: Props) => {
// ---- hooks ----
// > refs
const progressRef = useRef
// > player
const {
curTime,
duration,
isLoading,
isPaused,
seekTo,
skip,
togglePlayPause
} = useAudioPlayer({
audioUrl: audioUrl,
progressRef: progressRef
})
return (
{curTime}/{duration}
MIT © o2dependent