You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Due to how video.js mutates the DOM, integrating video.js with React can be a bit tricky. Especially if you want to support video.js component updates and correctly dispose of any old player.
4
+
5
+
React Hooks helps us package this quite nicely, and all you have to do to use this package is:
const Player = useVideoJS({ sources: [{ src: videoUrl }] });
14
+
return (
15
+
<div className="App">
16
+
<Player />
17
+
</div>
18
+
);
19
+
};
20
+
```
21
+
22
+
`useVideoJS` takes a single options argument, and passes it without modifications to video.js. See their [options reference](https://docs.videojs.com/tutorial-options.html) for further information.
23
+
24
+
Many thanks to Dan Abramov for helping me figure out some issues related to `useLayoutEffect` and video.js DOM manipulation.
0 commit comments