mirror of
https://github.com/Stremio/stremio-web.git
synced 2026-01-11 22:40:31 +00:00
Merge pull request #1057 from Stremio/fix/trailer-player-crashes
Some checks failed
Build / build (push) Has been cancelled
Some checks failed
Build / build (push) Has been cancelled
Player: prevent crash when destroying null video
This commit is contained in:
commit
c3f1f6c911
1 changed files with 9 additions and 1 deletions
|
|
@ -152,7 +152,15 @@ const useVideo = () => {
|
|||
video.current.on('extraSubtitlesTrackLoaded', onExtraSubtitlesTrackLoaded);
|
||||
video.current.on('extraSubtitlesTrackAdded', onExtraSubtitlesTrackAdded);
|
||||
|
||||
return () => video.current.destroy();
|
||||
return () => {
|
||||
if (video.current) {
|
||||
try {
|
||||
video.current.destroy();
|
||||
} catch (err) {
|
||||
console.error('Error destroying video:', err);
|
||||
}
|
||||
}
|
||||
};
|
||||
}, []);
|
||||
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in a new issue