1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

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
This commit is contained in:
gnattu 2024-05-29 00:20:10 +08:00
parent 20e29b81b5
commit adcea4467d

View file

@ -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. * @returns _true_ if the media source is an HLS stream, _false_ otherwise.
*/ */
export function isHls(mediaSource: MediaSourceInfo|null|undefined): boolean { export function isHls(mediaSource: MediaSourceInfo|null|undefined): boolean {
const protocol = mediaSource?.TranscodingSubProtocol || mediaSource?.Container; if (mediaSource?.TranscodingSubProtocol?.toUpperCase() === 'HLS') {
return protocol?.toUpperCase() === 'HLS'; return true;
}
return mediaSource?.Container?.toUpperCase() === 'HLS';
} }