refactor: update vjs onRequst to onRequest

This commit is contained in:
unclebinary1001 2024-10-05 23:09:14 -05:00
parent cf237c2923
commit d43227d2de

View File

@ -36,9 +36,9 @@ export const VideoJS: FC<VideoJSProps> = ({ options, onReady }) => {
) {
(
videojs.getPlayer(videoRef.current).tech({ IWillNotUseThisInPlugins: true }) as any
).vhs.xhr.beforeRequest = o => {
).vhs.xhr.onRequest = o => {
if (o.uri.match('m3u8')) {
const cachebuster = Math.random().toString(16).substr(2, 8);
const cachebuster = Math.random().toString(16).slice(2, 8);
// eslint-disable-next-line no-param-reassign
o.uri = `${o.uri}?cachebust=${cachebuster}`;
}