only react to source prop updates
This commit is contained in:
parent
7c8383f2dc
commit
68ae2d571f
1 changed files with 6 additions and 4 deletions
|
@ -404,11 +404,13 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
if (player) {
|
if (player) {
|
||||||
player.dispose();
|
player.dispose();
|
||||||
window.player = undefined;
|
window.player = undefined;
|
||||||
|
|
||||||
|
console.log(`Disposed of video.js instance (unmounted)`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
// Update video player settings and reload it when props change
|
// Update video player and reload when source URL changes
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// For some reason the video player is responsible for detecting content type this way
|
// For some reason the video player is responsible for detecting content type this way
|
||||||
fetch(source, { method: 'HEAD' }).then(response => {
|
fetch(source, { method: 'HEAD' }).then(response => {
|
||||||
|
@ -443,9 +445,9 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
console.log('Guess we could clean up something here if needed');
|
console.log('Cleanup after source update.');
|
||||||
};
|
}
|
||||||
});
|
}, [source]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
reload && (
|
reload && (
|
||||||
|
|
Loading…
Add table
Reference in a new issue