Browse Source

fix(player): fix vjs throwing warning about accessing tech

pull/2997/head
Gabe Kangas 2 years ago
parent
commit
933656c3a7
No known key found for this signature in database
GPG Key ID: 4345B2060657F330
  1. 8
      web/components/video/VideoJS/VideoJS.tsx

8
web/components/video/VideoJS/VideoJS.tsx

@ -31,8 +31,12 @@ export const VideoJS: FC<VideoJSProps> = ({ options, onReady }) => { @@ -31,8 +31,12 @@ export const VideoJS: FC<VideoJSProps> = ({ options, onReady }) => {
}
// Add a cachebuster param to playlist URLs.
if ((videojs.getPlayer(videoRef.current).tech() as any)?.vhs) {
(videojs.getPlayer(videoRef.current).tech() as any).vhs.xhr.beforeRequest = o => {
if (
(videojs.getPlayer(videoRef.current).tech({ IWillNotUseThisInPlugins: true }) as any)?.vhs
) {
(
videojs.getPlayer(videoRef.current).tech({ IWillNotUseThisInPlugins: true }) 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

Loading…
Cancel
Save