packages icon indicating copy to clipboard operation
packages copied to clipboard

[video_player] Adding support for preferred audio language

Open frontyard opened this issue 11 months ago • 11 comments

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 https://github.com/flutter/flutter/issues/166411

Pre-Review Checklist

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

[^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.

frontyard avatar Apr 02 '25 11:04 frontyard

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.

camsim99 avatar Apr 14 '25 17:04 camsim99

@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.

frontyard avatar Apr 14 '25 18:04 frontyard

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.

stuartmorgan-g avatar Apr 15 '25 15:04 stuartmorgan-g

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

frontyard avatar Apr 16 '25 13:04 frontyard

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.

stuartmorgan-g avatar Apr 16 '25 18:04 stuartmorgan-g

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

nateshmbhat avatar May 29 '25 15:05 nateshmbhat

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

frontyard avatar May 29 '25 19:05 frontyard

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

nateshmbhat avatar May 30 '25 09:05 nateshmbhat

@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.

frontyard avatar May 30 '25 10:05 frontyard

@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 avatar May 31 '25 07:05 nateshmbhat

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.

nateshmbhat avatar May 31 '25 14:05 nateshmbhat

@frontyard Are you still planning on working on this PR? There are a number of failures in the tests run by CI that need to be addressed.

stuartmorgan-g avatar Jul 09 '25 15:07 stuartmorgan-g

Thank you for your contribution. Since there are outstanding comments but the PR hasn’t been updated in several months, I’m going to close it so that our PR queue reflects active PRs. Please don't hesitate to submit a new PR if you have the time to address the review comments. Thanks!

stuartmorgan-g avatar Aug 19 '25 18:08 stuartmorgan-g