Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Audio Language Switching for Tracks with the Same Language and Role #5222

Closed
grushetsky opened this issue May 10, 2023 · 1 comment · Fixed by #5223
Closed

Audio Language Switching for Tracks with the Same Language and Role #5222

grushetsky opened this issue May 10, 2023 · 1 comment · Fixed by #5223
Labels
priority: P3 Useful but not urgent status: archived Archived and locked; will not be updated type: enhancement New feature or request
Milestone

Comments

@grushetsky
Copy link
Contributor

Is your feature request related to a problem? Please describe.
There's no way to effectively use selectAudioLanguage method if a DASH stream includes multiple audio tracks with the same language, role and channels count.

For example, if Shaka returns the following audio tracks, I cannot set the correct track via selectAudioLanguage:

[
  {
    "language": "en-US",
    "role": "main",
    "…": ""
  },
  {
    "language": "en-US",
    "role": "alternate",
    "…": ""
  },
  {
    "language": "en-US",
    "role": "alternate",
    "…": ""
  }
]

It's not possible to set the second audio track with alternate role via selectAudioLanguage(language, role, channelsCount) as there's no way to distinguish between two tracks with the same language, role and audio channels count.

Describe the solution you'd like
I would like to add support for language tags that are (more) compliant with RFC 5646. The values of lang attribute from DASH AdaptationSet are restricted by RFC 5646. This RFC allows to add a "private use tag" (privateuse) to the language tag (e.g., en-GB-x-one, en-US-x-1).

With the support of private use tag it is now possible to use selectAudioLanguage for the following tracks:

[
  {
    "language": "en-US",
    "role": "main",
    "…": ""
  },
  {
    "language": "en-US-x-1",
    "role": "alternate",
    "…": ""
  },
  {
    "language": "en-US-x-2",
    "role": "alternate",
    "…": ""
  }
]

Now I can use selectAudioLanguage('en-US-x-2') to select the second alternate audio track!

Describe alternatives you've considered
The first idea that came to mind was using language and role pair as a key for a given audio track. But it's not possible, because according to DASH specification roles aren't unique.

I also considered using selectVariantsByLabel, but this method assumes that the label uniquely identifies an audio stream. And it also works across the combination of video and audio tracks. Thus, if I change a variant by label and then switch the video quality I need to track that the correct audio is selected. Using selectAudioLanguage is much less cumbersome.

Additional context
The same problem exists for HLS streams.

@grushetsky grushetsky added the type: enhancement New feature or request label May 10, 2023
@github-actions github-actions bot added this to the Backlog milestone May 10, 2023
@grushetsky
Copy link
Contributor Author

@joeyparrish, could you, please, consider adding this feature into 4.4? 🙏🏻 The PR is ready for review.

@avelad avelad added the priority: P3 Useful but not urgent label May 11, 2023
avelad pushed a commit that referenced this issue May 11, 2023
Resolves #5222.

It also opens the way for improving the compliance with [RFC
5646](https://datatracker.ietf.org/doc/html/rfc5646) in the future.
@github-actions github-actions bot added the status: archived Archived and locked; will not be updated label Jul 10, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 10, 2023
@avelad avelad modified the milestones: Backlog, v4.4 Aug 28, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority: P3 Useful but not urgent status: archived Archived and locked; will not be updated type: enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants