From e631ecaadea94276bb5e2a5a49aa6a684c76ea3c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?A=CC=81lvaro=20Velad=20Galva=CC=81n?= Date: Fri, 27 Oct 2023 09:02:12 +0200 Subject: [PATCH] fix(HLS): Fix kind detection for 'captions' text tracks --- lib/hls/hls_parser.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/hls/hls_parser.js b/lib/hls/hls_parser.js index 63a62a8a3b..059a5fead2 100644 --- a/lib/hls/hls_parser.js +++ b/lib/hls/hls_parser.js @@ -2360,8 +2360,15 @@ shaka.hls.HlsParser = class { } } - const kind = (type == shaka.util.ManifestParserUtils.ContentType.TEXT) ? - shaka.util.ManifestParserUtils.TextStreamKind.SUBTITLE : undefined; + let kind = undefined; + if (type == shaka.util.ManifestParserUtils.ContentType.TEXT) { + if (roles.includes('public.accessibility.transcribes-spoken-dialog') && + roles.includes('public.accessibility.describes-music-and-sound')) { + kind = shaka.util.ManifestParserUtils.TextStreamKind.CLOSED_CAPTION; + } else { + kind = shaka.util.ManifestParserUtils.TextStreamKind.SUBTITLE; + } + } // If there are no roles, and we have defaulted to the subtitle "kind" for // this track, add the implied subtitle role.