[Video] Throw error when playback fails (#5132)

zio/stable
Hailey 2024-09-04 08:06:58 -07:00 committed by GitHub
parent dee28f378a
commit d94ff2695d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 9 additions and 0 deletions

View File

@ -101,9 +101,18 @@ function VideoControls({
setTimeRemaining(secondsRemaining)
},
)
const statusSub = player.addListener(
'statusChange',
(status, _oldStatus, error) => {
if (status === 'error') {
throw error
}
},
)
return () => {
volumeSub.remove()
timeSub.remove()
statusSub.remove()
}
}, [player])