From b5d02f56063cabd2194d1f52a74652b77a268238 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81lvaro=20Velad=20Galv=C3=A1n?= Date: Fri, 27 Oct 2023 18:22:53 +0200 Subject: [PATCH] fix(HLS): Fix kind detection for 'captions' text tracks (#5819) Related to https://github.com/shaka-project/shaka-player/issues/5810 --- 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.