out promises
Signed-off-by: ale <ale@manalejandro.com>
This commit is contained in:
parent
7e8467faae
commit
479c394c50
12
src/App.js
12
src/App.js
@ -32,20 +32,12 @@ const App = () => {
|
||||
},
|
||||
play = () => {
|
||||
if (audioElmRef.current) {
|
||||
audioElmRef.current.play().then(() => {
|
||||
setPlayPause(true)
|
||||
}).catch(err => {
|
||||
console.error('Error playing audio: ' + err.message)
|
||||
})
|
||||
audioElmRef.current.play()
|
||||
}
|
||||
},
|
||||
pause = () => {
|
||||
if (audioElmRef.current) {
|
||||
audioElmRef.current.pause().then(() => {
|
||||
setPlayPause(false)
|
||||
}).catch(err => {
|
||||
console.error('Error pausing audio: ' + err.message)
|
||||
})
|
||||
audioElmRef.current.pause()
|
||||
}
|
||||
},
|
||||
loadData = () => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user