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

Make language matching robust against variants #3976

Closed
wschidol opened this issue Jul 1, 2022 · 5 comments
Closed

Make language matching robust against variants #3976

wschidol opened this issue Jul 1, 2022 · 5 comments

Comments

@wschidol
Copy link

wschidol commented Jul 1, 2022

dash.js provides the setInitialMediaSettings API to select an AdaptationSet by language.

The implementation compares the string provided in value.lang against the string read from the @lang attribute in the MPD for the respective AdaptationSet. This comparison is implemented using the String:Prototyp:match() function which also supports regular expressions (see /src/streaming/controllers/MediaController.js ).

However, language tags provided both via the MPD and through the API may use both 2 and 3-letter versions as well as extended language tags for the same language regularly. An example is an MPD using @lang=“spa” while the API is called with lang=”es-US”, both requesting the Spanish language. Consequently, they should match (see BCP-47/RFC 5646) but there appears no straightforward way to achieve this using the current API and RegEx patterns.

We would suggest to enable dash.js with a configurable "language matcher" that can be supplied by the caller if more robust matching is necessary or desired. npm/bcp47-match might be a good candidate.

Alternatively, npm/bcp47-match could be hard-baked into dash.js but that would increase the footprint (not by much, but still) for all users.

@dsilhavy
Copy link
Collaborator

dsilhavy commented Jul 4, 2022

@wschidol Thank you for sharing this. If npm/bcp47-match does the mapping dash.js would benefit from this. In this case, it should not be an external library that the app needs to add manually, but we should use and include it directly in dash.js. I don't consider the increase in the bundle size by 18kb a blocker.

Having said this, is this something you can provide as a PR to dash.js?

@wschidol
Copy link
Author

wschidol commented Jul 4, 2022

Having said this, is this something you can provide as a PR to dash.js?

We will follow up with a PR, yes.

@wschidol
Copy link
Author

wschidol commented Aug 4, 2022

Work on this item progresses in #4015 .

@dsilhavy
Copy link
Collaborator

@wschidol Can we close this with the changes from #4015?

@stschr
Copy link
Contributor

stschr commented Feb 27, 2023

@dsilhavy : Yes, can be closed
If discussions at MPEG turns out that additional enhancements are needed or beneficial, I'll open a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants