From 858cdd197cb2bb1e1d7a7285966cb56043ad8961 Mon Sep 17 00:00:00 2001
From: absidue <48293849+absidue@users.noreply.github.com>
Date: Mon, 1 Jul 2024 04:05:08 +0200
Subject: [PATCH] feat(toDash): Add the "dub" role to translated captions
(#677)
---
src/utils/DashManifest.tsx | 12 ++++++++----
src/utils/StreamingInfo.ts | 8 ++++++++
2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/src/utils/DashManifest.tsx b/src/utils/DashManifest.tsx
index 5c0620450..155c58c99 100644
--- a/src/utils/DashManifest.tsx
+++ b/src/utils/DashManifest.tsx
@@ -241,10 +241,14 @@ async function DashManifest({
lang={set.language}
contentType="text"
>
-
+ {
+ set.track_roles.map((role) => (
+
+ ))
+ }
diff --git a/src/utils/StreamingInfo.ts b/src/utils/StreamingInfo.ts
index a56785c61..5f09cdd1b 100644
--- a/src/utils/StreamingInfo.ts
+++ b/src/utils/StreamingInfo.ts
@@ -128,6 +128,7 @@ export interface TextSet {
mime_type: string;
language: string;
track_name: string;
+ track_roles: ('caption' | 'dub')[];
representation: TextRepresentation;
}
@@ -760,10 +761,17 @@ function getTextSets(
const url = new URL(caption_track.base_url);
url.searchParams.set('fmt', format);
+ const track_roles: ('caption' | 'dub')[] = [ 'caption' ];
+
+ if (url.searchParams.has('tlang')) {
+ track_roles.push('dub');
+ }
+
return {
mime_type,
language: caption_track.language_code,
track_name: caption_track.name.toString(),
+ track_roles,
representation: {
uid: `text-${caption_track.vss_id}`,
base_url: transform_url(url).toString()