fix(player): fix vjs throwing warning about accessing tech
This commit is contained in:
@@ -31,8 +31,12 @@ export const VideoJS: FC<VideoJSProps> = ({ options, onReady }) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add a cachebuster param to playlist URLs.
|
// Add a cachebuster param to playlist URLs.
|
||||||
if ((videojs.getPlayer(videoRef.current).tech() as any)?.vhs) {
|
if (
|
||||||
(videojs.getPlayer(videoRef.current).tech() as any).vhs.xhr.beforeRequest = o => {
|
(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')) {
|
if (o.uri.match('m3u8')) {
|
||||||
const cachebuster = Math.random().toString(16).substr(2, 8);
|
const cachebuster = Math.random().toString(16).substr(2, 8);
|
||||||
// eslint-disable-next-line no-param-reassign
|
// eslint-disable-next-line no-param-reassign
|
||||||
|
|||||||
Reference in New Issue
Block a user