From d2460f561f4f028505db6b9a2882fba509a3d662 Mon Sep 17 00:00:00 2001 From: JonathanTGold Date: Sun, 31 Oct 2021 16:42:38 +0200 Subject: [PATCH 1/2] fix:(FEC-11655): V3 - External captions - VTT - HLS: System highlights 2 options (captions) after clicking the "Change media" button on Safari --- src/engines/html5/media-source/adapters/native-adapter.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/engines/html5/media-source/adapters/native-adapter.js b/src/engines/html5/media-source/adapters/native-adapter.js index 35c0424b8..f1b43faf4 100644 --- a/src/engines/html5/media-source/adapters/native-adapter.js +++ b/src/engines/html5/media-source/adapters/native-adapter.js @@ -698,6 +698,7 @@ export default class NativeAdapter extends BaseMediaSourceAdapter { const captionsTextTrackLanguageCodes = [this._config.captionsTextTrack1LanguageCode, this._config.captionsTextTrack2LanguageCode]; const textTracks = this._videoElement.textTracks; const parsedTracks = []; + let index = 0; if (textTracks) { for (let i = 0; i < textTracks.length; i++) { if (!PKTextTrack.isExternalTrack(textTracks[i])) { @@ -707,7 +708,7 @@ export default class NativeAdapter extends BaseMediaSourceAdapter { label: textTracks[i].label, language: textTracks[i].language, available: true, - index: i + index: index++ }; if (settings.kind === PKTextTrack.KIND.SUBTITLES) { parsedTracks.push(new PKTextTrack(settings)); From 1ada310cce2c9e21a6fc4ec205428398f604c924 Mon Sep 17 00:00:00 2001 From: JonathanTGold Date: Mon, 1 Nov 2021 10:48:24 +0200 Subject: [PATCH 2/2] change to more readable name (yuval suggestion) --- src/engines/html5/media-source/adapters/native-adapter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/engines/html5/media-source/adapters/native-adapter.js b/src/engines/html5/media-source/adapters/native-adapter.js index f1b43faf4..4f439c2d4 100644 --- a/src/engines/html5/media-source/adapters/native-adapter.js +++ b/src/engines/html5/media-source/adapters/native-adapter.js @@ -698,7 +698,7 @@ export default class NativeAdapter extends BaseMediaSourceAdapter { const captionsTextTrackLanguageCodes = [this._config.captionsTextTrack1LanguageCode, this._config.captionsTextTrack2LanguageCode]; const textTracks = this._videoElement.textTracks; const parsedTracks = []; - let index = 0; + let internalTrackIndex = 0; if (textTracks) { for (let i = 0; i < textTracks.length; i++) { if (!PKTextTrack.isExternalTrack(textTracks[i])) { @@ -708,7 +708,7 @@ export default class NativeAdapter extends BaseMediaSourceAdapter { label: textTracks[i].label, language: textTracks[i].language, available: true, - index: index++ + index: internalTrackIndex++ }; if (settings.kind === PKTextTrack.KIND.SUBTITLES) { parsedTracks.push(new PKTextTrack(settings));