-
Notifications
You must be signed in to change notification settings - Fork 3.5k
feat(video_player): add audio track management support to platform interface #10171
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
base: main
Are you sure you want to change the base?
feat(video_player): add audio track management support to platform interface #10171
Conversation
It looks like this pull request may not have tests. Please make sure to add tests or get an explicit test exemption before merging. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. If you believe this PR qualifies for a test exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request introduces audio track management capabilities to the video_player
platform interface. It adds a new VideoAudioTrack
model to represent audio track metadata, and new methods getAudioTracks()
, selectAudioTrack()
, and isAudioTrackSupportAvailable()
to the VideoPlayerPlatform
abstract class. The changes are well-structured and additive. My review includes a suggestion to add tests for the new platform interface methods and a minor improvement to the changelog entry for completeness.
## NEXT | ||
## 6.5.0 | ||
|
||
* Adds `VideoAudioTrack` class and `getAudioTracks()`, `selectAudioTrack()` methods to platform interface for audio track management. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The changelog entry is great! For completeness, you might also want to include the isAudioTrackSupportAvailable()
method, as it's part of the new functionality added in this PR.
* Adds `VideoAudioTrack` class and `getAudioTracks()`, `selectAudioTrack()` methods to platform interface for audio track management. | |
* Adds `VideoAudioTrack` class and `getAudioTracks()`, `selectAudioTrack()`, `isAudioTrackSupportAvailable()` methods to platform interface for audio track management. |
/// Gets the available audio tracks for the video. | ||
Future<List<VideoAudioTrack>> getAudioTracks(int playerId) { | ||
throw UnimplementedError('getAudioTracks() has not been implemented.'); | ||
} | ||
|
||
/// Selects an audio track by its ID. | ||
Future<void> selectAudioTrack(int playerId, String trackId) { | ||
throw UnimplementedError('selectAudioTrack() has not been implemented.'); | ||
} | ||
|
||
/// Returns whether audio track selection is supported on this platform. | ||
/// | ||
/// This method allows developers to query at runtime whether the current | ||
/// platform supports audio track selection functionality. This is useful | ||
/// for platforms like web where audio track selection may not be available. | ||
/// | ||
/// Returns `true` if [getAudioTracks] and [selectAudioTrack] are supported, | ||
/// `false` otherwise. | ||
Future<bool> isAudioTrackSupportAvailable() { | ||
throw UnimplementedError( | ||
'isAudioTrackSupportAvailable() has not been implemented.', | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These new methods are correctly defined with default UnimplementedError
implementations. However, the corresponding tests are missing in test/video_player_platform_interface_test.dart
. Please add tests to verify that calling these methods on the default VideoPlayerPlatform
instance throws an UnimplementedError
, similar to existing tests in that file. This is important for maintaining test coverage and ensuring platform implementations correctly override them.
Description
platform interface pr for #9925
Core Features
VideoAudioTrack
model with comprehensive metadata fields:id
,label
,language
,isSelected
,bitrate
,sampleRate
,channelCount
,codec
Breaking Changes
None - all changes are additive and backward compatible.
Pre-Review Checklist
[video_player]
pubspec.yaml
with an appropriate new version according to the [pub versioning philosophy], or I have commented below to indicate which [version change exemption] this PR falls under[^1].CHANGELOG.md
to add a description of the change, [following repository CHANGELOG style], or I have commented below to indicate which [CHANGELOG exemption] this PR falls under[^1].///
).