mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-06-03 21:54:49 -04:00
Use a longer hls timeout delay
This commit is contained in:
parent
e79e568a4c
commit
1dd3e37a37
@ -34,7 +34,7 @@ import { useAtomValue, useSetAtom, useAtom } from "jotai";
|
|||||||
import { useYoshiki } from "yoshiki";
|
import { useYoshiki } from "yoshiki";
|
||||||
import SubtitleOctopus from "libass-wasm";
|
import SubtitleOctopus from "libass-wasm";
|
||||||
import { playAtom, PlayMode, playModeAtom, subtitleAtom } from "./state";
|
import { playAtom, PlayMode, playModeAtom, subtitleAtom } from "./state";
|
||||||
import Hls, { Level } from "hls.js";
|
import Hls, { Level, LoadPolicy } from "hls.js";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { Menu } from "@kyoo/primitives";
|
import { Menu } from "@kyoo/primitives";
|
||||||
import toVttBlob from "srt-webvtt";
|
import toVttBlob from "srt-webvtt";
|
||||||
@ -54,6 +54,23 @@ let client_id = typeof window === "undefined" ? "ssr" : uuidv4();
|
|||||||
const initHls = async (): Promise<Hls> => {
|
const initHls = async (): Promise<Hls> => {
|
||||||
if (hls !== null) return hls;
|
if (hls !== null) return hls;
|
||||||
const token = await getToken();
|
const token = await getToken();
|
||||||
|
|
||||||
|
const loadPolicy: LoadPolicy = {
|
||||||
|
default: {
|
||||||
|
maxTimeToFirstByteMs: Infinity,
|
||||||
|
maxLoadTimeMs: 60_000,
|
||||||
|
timeoutRetry: {
|
||||||
|
maxNumRetry: 2,
|
||||||
|
retryDelayMs: 0,
|
||||||
|
maxRetryDelayMs: 0,
|
||||||
|
},
|
||||||
|
errorRetry: {
|
||||||
|
maxNumRetry: 1,
|
||||||
|
retryDelayMs: 0,
|
||||||
|
maxRetryDelayMs: 0,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
};
|
||||||
hls = new Hls({
|
hls = new Hls({
|
||||||
xhrSetup: (xhr) => {
|
xhrSetup: (xhr) => {
|
||||||
if (token) xhr.setRequestHeader("Authorization", `Bearer: ${token}`);
|
if (token) xhr.setRequestHeader("Authorization", `Bearer: ${token}`);
|
||||||
@ -62,6 +79,12 @@ const initHls = async (): Promise<Hls> => {
|
|||||||
autoStartLoad: false,
|
autoStartLoad: false,
|
||||||
// debug: true,
|
// debug: true,
|
||||||
startPosition: 0,
|
startPosition: 0,
|
||||||
|
fragLoadPolicy: loadPolicy,
|
||||||
|
keyLoadPolicy: loadPolicy,
|
||||||
|
certLoadPolicy: loadPolicy,
|
||||||
|
playlistLoadPolicy: loadPolicy,
|
||||||
|
manifestLoadPolicy: loadPolicy,
|
||||||
|
steeringManifestLoadPolicy: loadPolicy,
|
||||||
});
|
});
|
||||||
// hls.currentLevel = hls.startLevel;
|
// hls.currentLevel = hls.startLevel;
|
||||||
return hls;
|
return hls;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user