From aeda19df0b7431f5823ca8b88960ec3b0bf4cbc7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wojciech=20Tyczy=C5=84ski?= Date: Tue, 15 Aug 2023 17:49:04 +0200 Subject: [PATCH] fix: Default language to 'und' for native tracks (#5464) Set default language to `und` for native audio/text tracks if missing. --- lib/util/stream_utils.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/util/stream_utils.js b/lib/util/stream_utils.js index bbbfd35ddf..af1ae26f77 100644 --- a/lib/util/stream_utils.js +++ b/lib/util/stream_utils.js @@ -1325,13 +1325,15 @@ shaka.util.StreamUtils = class { * @private */ static html5TrackToGenericShakaTrack_(html5Track) { + const language = html5Track.language; + /** @type {shaka.extern.Track} */ const track = { id: shaka.util.StreamUtils.html5TrackId(html5Track), active: false, type: '', bandwidth: 0, - language: shaka.util.LanguageUtils.normalize(html5Track.language), + language: shaka.util.LanguageUtils.normalize(language || 'und'), label: html5Track.label, kind: html5Track.kind, width: null, @@ -1361,6 +1363,7 @@ shaka.util.StreamUtils = class { originalAudioId: null, originalTextId: null, originalImageId: null, + originalLanguage: language, }; return track;