We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b97be4d commit fdb87d8Copy full SHA for fdb87d8
docs/guides/react.md
@@ -31,17 +31,19 @@ export const VideoJS = ( props ) => {
31
// player.autoplay(options.autoplay);
32
// player.src(options.sources);
33
}
34
- }, [options]);
+ }, [options, videoRef]);
35
36
// Dispose the Video.js player when the functional component unmounts
37
React.useEffect(() => {
38
+ const player = playerRef.current;
39
+
40
return () => {
- if (playerRef.current) {
- playerRef.current.dispose();
41
+ if (player) {
42
+ player.dispose();
43
playerRef.current = null;
44
45
};
- }, []);
46
+ }, [playerRef]);
47
48
return (
49
<div data-vjs-player>
0 commit comments