Fix outdated qualites menu when hls instance changes

This commit is contained in:
Zoe Roux 2024-05-12 16:58:16 +02:00
parent 5de584d6e3
commit 7e10a9162c
No known key found for this signature in database

View File

@ -393,6 +393,8 @@ export const QualitiesMenu = (props: ComponentProps<typeof Menu>) => {
// biome-ignore lint/correctness/useExhaustiveDependencies: Inculde hls in dependency array
useEffect(() => {
if (!hls) return;
// Also rerender when hls instance changes
rerender();
hls.on(Hls.Events.LEVEL_SWITCHED, rerender);
return () => hls?.off(Hls.Events.LEVEL_SWITCHED, rerender);
}, [hls]);