vjs: Fix 'Video showing previous audio clip's thumbnail instead'

## Issue
5450: Video showing previous audio clip's thumbnail instead

## Notes
`createVideoPlayerDOM` depends on `isAudio`
This commit is contained in:
infiinte-persistence 2021-02-17 23:32:25 +08:00 committed by Jeremy Kauffman
parent 9ce6ecc923
commit 09c1cfeb8f

View file

@ -452,7 +452,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
return vjs;
}
// This lifecycle hook is only called once (on mount)
// This lifecycle hook is only called once (on mount), or when `isAudio` changes.
useEffect(() => {
const vjsElement = createVideoPlayerDOM(containerRef.current);
const vjsPlayer = initializeVideoPlayer(vjsElement);
@ -476,7 +476,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
player.dispose();
}
};
}, []);
}, [isAudio]);
// Update video player and reload when source URL changes
useEffect(() => {