From a8b507ee65ccd8edc9aea2aef8a908fa272bb23c Mon Sep 17 00:00:00 2001 From: absidue <48293849+absidue@users.noreply.github.com> Date: Wed, 22 Mar 2023 21:48:09 +0100 Subject: [PATCH] fix(toDash): Generate unique Representation ids (#366) --- src/utils/FormatUtils.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/utils/FormatUtils.ts b/src/utils/FormatUtils.ts index 4500109dc..adc9773b1 100644 --- a/src/utils/FormatUtils.ts +++ b/src/utils/FormatUtils.ts @@ -428,8 +428,15 @@ class FormatUtils { const url = new URL(format.decipher(player)); url.searchParams.set('cpn', cpn || ''); + let id; + if (format.audio_track) { + id = `${format.itag?.toString()}-${format.audio_track.id}`; + } else { + id = format.itag?.toString(); + } + const representation = this.#el(document, 'Representation', { - id: format.itag?.toString(), + id, codecs, bandwidth: format.bitrate?.toString(), audioSamplingRate: format.audio_sample_rate?.toString()