Skip to content

Commit

Permalink
feat(toDash): Add the "dub" role to translated captions (#677)
Browse files Browse the repository at this point in the history
  • Loading branch information
absidue committed Jul 1, 2024
1 parent 5a8fd3a commit 858cdd1
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/utils/DashManifest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -241,10 +241,14 @@ async function DashManifest({
lang={set.language}
contentType="text"
>
<role
schemeIdUri="urn:mpeg:dash:role:2011"
value="caption"
/>
{
set.track_roles.map((role) => (
<role
schemeIdUri="urn:mpeg:dash:role:2011"
value={role}
/>
))
}
<label id={index + audio_sets.length}>
{set.track_name}
</label>
Expand Down
8 changes: 8 additions & 0 deletions src/utils/StreamingInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ export interface TextSet {
mime_type: string;
language: string;
track_name: string;
track_roles: ('caption' | 'dub')[];
representation: TextRepresentation;
}

Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 858cdd1

Please sign in to comment.