Skip to content

[video_player] Adding support for preferred audio language #8980

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

Open
wants to merge 13 commits into
base: main
Choose a base branch
from

Conversation

frontyard
Copy link

Added support for preferred audio language to video_player on Android. If underlaying stream/video supports it this will communicate to exoplayer that audio stream for sepcific language should be used if available.

To use this feature developer should pass preferredAudioLanguage as a 2 character ISO langauge code to VideoPlayerOptions when initializing VideoPlayerController. This code should match one of the language specified in the stream, for example (HLS):
#EXT-X-MEDIA:TYPE=AUDIO,GROUP-ID="audio",NAME="Italian",LANGUAGE="it",DEFAULT=NO,AUTOSELECT=YES,URI="audio/italian.m3u8"

Platforms that don't have implementation yet will silently ignore this.

This PR implements flutter/flutter#166411

Pre-Review Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Footnotes

  1. Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling. 2 3

@camsim99
Copy link
Contributor

Hi, thank you for your contribution! This looks like a great feature to support, but it looks like the tests are failing. Before we review the PR, please see what you can do to resolve the test failures. If you are unsure how to proceed, please reach out for help on the #hackers-new channel.

@frontyard
Copy link
Author

@camsim99 sorry about that, my first packages PR, still wrapping my head around it. I've updated the code and fixed the tests, flutter test is now passing in all the submodules.

@stuartmorgan-g
Copy link
Contributor

Please see step 1 of the instructions for multi-package PRs for the instructions on how to make this PR something that the CI can run tests on without failing all of the checks.

@frontyard
Copy link
Author

@stuartmorgan-g followed the instructions and updated pubspecs to use local path dependencies.

@stuartmorgan-g
Copy link
Contributor

Thanks; it looks like CI is now flagging a number of real failures caused by the PR (analysis, Android lint, macOS native tests). The "View details" links for the failing tests will lead to the stdout of the failures.

@nateshmbhat
Copy link

@frontyard , any update on this ? did you get a chance to look at the failing tests to resolve them ?

@frontyard
Copy link
Author

@nateshmbhat I had family emergency and wasn't able to work for couple of weeks. I'll get this sorted asap 🙏

@nateshmbhat
Copy link

do you also plan to add ios implementation also ? @frontyard

@frontyard
Copy link
Author

@nateshmbhat I have zero experience with ios. I believe the change I made will fail gracefully on platforms not supporting this feature (yet). I'll see if I can figure out how to make it work on ios but it won't be in the initial PR.

A sidenote, I also made a change to video_player_web_hls which I plan to open a PR for once platform change is in.

@nateshmbhat
Copy link

@frontyard i can also help out with ios implementation. i'm not fully familiiar with ios syntax but with all the recent ai tools, i'm sure i can help out in a some way.

@nateshmbhat
Copy link

I ran the video_player_avfoundation example project from iphone simulator from the frontyard:preferred-audio-language branch and it crashed during the app launch.

It works fine when i run the app on flutter's branch though.

Copy link
Contributor

@mdebbar mdebbar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for web.

Copy link
Contributor

@hellohuanlin hellohuanlin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems to be no-op on iOS since it's not supported? If so we are good on iOS part.

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

Successfully merging this pull request may close these issues.

6 participants