From adcea4467d05a737d0fad734e34b4e69778409e8 Mon Sep 17 00:00:00 2001 From: gnattu Date: Wed, 29 May 2024 00:20:10 +0800 Subject: [PATCH] Fix HLS stream check The TranscodingSubProtocol is no longer nullable on the server side and direct playing media will have a value of http. Check container type when TranscodingSubProtocol is not HLS --- src/utils/mediaSource.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/utils/mediaSource.ts b/src/utils/mediaSource.ts index ef196db60f..2ee56bfc03 100644 --- a/src/utils/mediaSource.ts +++ b/src/utils/mediaSource.ts @@ -6,6 +6,9 @@ import type { MediaSourceInfo } from '@jellyfin/sdk/lib/generated-client'; * @returns _true_ if the media source is an HLS stream, _false_ otherwise. */ export function isHls(mediaSource: MediaSourceInfo|null|undefined): boolean { - const protocol = mediaSource?.TranscodingSubProtocol || mediaSource?.Container; - return protocol?.toUpperCase() === 'HLS'; + if (mediaSource?.TranscodingSubProtocol?.toUpperCase() === 'HLS') { + return true; + } + + return mediaSource?.Container?.toUpperCase() === 'HLS'; }