hack-y solution to losing player context
use a global window variable to store the reference to the current video.js instance.
This commit is contained in:
parent
68ae2d571f
commit
d8564cda5a
1 changed files with 3 additions and 1 deletions
|
@ -170,7 +170,7 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
|||
type: sourceType,
|
||||
},
|
||||
],
|
||||
autoplay: false,
|
||||
autoplay: true,
|
||||
poster: poster, // thumb looks bad in app, and if autoplay, flashing poster is annoying
|
||||
plugins: {
|
||||
eventTracking: true,
|
||||
|
@ -414,6 +414,8 @@ export default React.memo<Props>(function VideoJs(props: Props) {
|
|||
useEffect(() => {
|
||||
// For some reason the video player is responsible for detecting content type this way
|
||||
fetch(source, { method: 'HEAD' }).then(response => {
|
||||
const player = window.player;
|
||||
|
||||
if (!player) {
|
||||
console.log(`Our player was disposed, we should disregard the fetch result.`);
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue