#root
View Compiled
const {useRef} = React;
const {render} = ReactDOM;
function CustomAudio(props) {
const forward = () => {
audioRef.current.currentTime += 10;
}
return <audio src="https://www.bensound.com/bensound-music/bensound-happyrock.mp3" />
}
function Player() {
const customAudioRef = useRef();
const play = () => {
customAudioRef.current.play()
}
const forward = () => {
customAudioRef.current.forward();
}
return (
<>
<CustomAudio ref={customAudioRef} />
<button onClick={play}> Play </button>
<button onClick={forward}> +10 sec </button>
</>
)
}
render(<Player />, document.getElementById('root'))
View Compiled
This Pen doesn't use any external CSS resources.