chore(deps): update video.js to the 8.x release
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import React, { FC, useContext, useEffect } from 'react';
|
||||
import { useRecoilState, useRecoilValue } from 'recoil';
|
||||
import { useHotkeys } from 'react-hotkeys-hook';
|
||||
import { VideoJsPlayerOptions } from 'video.js';
|
||||
import classNames from 'classnames';
|
||||
import { ErrorBoundary } from 'react-error-boundary';
|
||||
import { VideoJS } from '../VideoJS/VideoJS';
|
||||
@@ -244,7 +243,7 @@ export const OwncastPlayer: FC<OwncastPlayerProps> = ({
|
||||
type: 'application/x-mpegURL',
|
||||
},
|
||||
],
|
||||
} satisfies VideoJsPlayerOptions;
|
||||
};
|
||||
|
||||
const handlePlayerReady = (player, videojs) => {
|
||||
playerRef.current = player;
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
import React, { FC } from 'react';
|
||||
import videojs, { VideoJsPlayer, VideoJsPlayerOptions } from 'video.js';
|
||||
import videojs from 'video.js';
|
||||
import type VideoJsPlayer from 'video.js/dist/types/player';
|
||||
|
||||
import styles from './VideoJS.module.scss';
|
||||
|
||||
require('video.js/dist/video-js.css');
|
||||
|
||||
export type VideoJSProps = {
|
||||
options: VideoJsPlayerOptions;
|
||||
onReady: (player: videojs.Player, vjsInstance: typeof videojs) => void;
|
||||
options: any;
|
||||
onReady: (player: VideoJsPlayer, vjsInstance: typeof videojs) => void;
|
||||
};
|
||||
|
||||
export const VideoJS: FC<VideoJSProps> = ({ options, onReady }) => {
|
||||
@@ -29,15 +31,17 @@ export const VideoJS: FC<VideoJSProps> = ({ options, onReady }) => {
|
||||
}
|
||||
|
||||
// Add a cachebuster param to playlist URLs.
|
||||
videojs.Vhs.xhr.beforeRequest = o => {
|
||||
if (o.uri.match('m3u8')) {
|
||||
const cachebuster = Math.random().toString(16).substr(2, 8);
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
o.uri = `${o.uri}?cachebust=${cachebuster}`;
|
||||
}
|
||||
if ((videojs.getPlayer(videoRef.current).tech() as any)?.vhs) {
|
||||
(videojs.getPlayer(videoRef.current).tech() as any).vhs.xhr.beforeRequest = o => {
|
||||
if (o.uri.match('m3u8')) {
|
||||
const cachebuster = Math.random().toString(16).substr(2, 8);
|
||||
// eslint-disable-next-line no-param-reassign
|
||||
o.uri = `${o.uri}?cachebust=${cachebuster}`;
|
||||
}
|
||||
|
||||
return o;
|
||||
};
|
||||
return o;
|
||||
};
|
||||
}
|
||||
}, [options, videoRef]);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user