feat: profile hls playback

This commit is contained in:
2026-06-16 01:34:42 +02:00
committed by Milas Holsting
parent c70ec383c5
commit c3b3c606db
2 changed files with 120 additions and 0 deletions

View File

@@ -1,10 +1,14 @@
import Hls from "hls.js";
import { attachHLSProfile } from "./hls_profile";
import { state } from "./state";
import { absoluteTimeFromDisplay, displayTimeFromAbsolute, invalidateBounds } from "./timeline";
let hls: Hls | null = null;
let stopHLSProfile: (() => void) | null = null;
const destroyHLS = (): void => {
stopHLSProfile?.();
stopHLSProfile = null;
hls?.destroy();
hls = null;
};
@@ -44,6 +48,7 @@ export const loadVideoSource = (url: string, type?: string): void => {
if (shouldUseHLS(type, url) && Hls.isSupported()) {
hls = new Hls();
stopHLSProfile = attachHLSProfile(hls, state.video);
hls.loadSource(url);
hls.attachMedia(state.video);
} else {