audio load
Signed-off-by: ale <ale@manalejandro.com>
This commit is contained in:
parent
0ff53b190d
commit
51b6250760
11
src/App.js
11
src/App.js
@ -50,7 +50,11 @@ const App = () => {
|
||||
}).catch(err => {
|
||||
console.error('Error fetching data: ' + err.message)
|
||||
})
|
||||
}
|
||||
},
|
||||
play = useCallback(async () => {
|
||||
setMuted(false)
|
||||
await audioElmRef.current?.play()
|
||||
}, [audioElmRef.current])
|
||||
useEffect(() => {
|
||||
if (json?.media?.track[0] && bounce.search(json?.media?.track[0].Title) === -1) {
|
||||
setBounce('Now Playing: ')
|
||||
@ -102,10 +106,7 @@ const App = () => {
|
||||
<div>
|
||||
<h2>Audio Controls</h2>
|
||||
{audioElmRef.current?.paused ?
|
||||
<button onClick={useCallback(async () => {
|
||||
setMuted(false)
|
||||
await audioElmRef.current?.play()
|
||||
}, [audioElmRef.current])}>Play ⏯️</button> :
|
||||
<button onClick={() => play()}>Play ⏯️</button> :
|
||||
<button onClick={() => audioElmRef.current?.pause()}>Pause ⏯️</button>
|
||||
}
|
||||
<br /><br />
|
||||
|
Loading…
x
Reference in New Issue
Block a user