Skip to content

Conversation

nateshmbhat
Copy link

Description

platform interface pr for #9925

Core Features

  • Added VideoAudioTrack model with comprehensive metadata fields: id, label, language, isSelected, bitrate, sampleRate, channelCount, codec
  • Added getAudioTracks() method to retrieve all available audio tracks with real metadata
  • Added selectAudioTrack() method to switch between audio tracks during playback

Breaking Changes

None - all changes are additive and backward compatible.

Pre-Review Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran [the auto-formatter].
  • I signed the [CLA].
  • The title of the PR starts with the name of the package surrounded by square brackets, e.g. [video_player]
  • I [linked to at least one issue that this PR fixes] in the description above.
  • I updated 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].
  • I updated 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].
  • I updated/added any relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or I have commented below to indicate which [test exemption] this PR falls under[^1].
  • All existing and new tests are passing.

@flutter-dashboard
Copy link

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.

Copy link

@gemini-code-assist gemini-code-assist bot left a 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.

Choose a reason for hiding this comment

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

medium

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.

Suggested change
* 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.

Comment on lines +125 to +147
/// 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.',
);
}

Choose a reason for hiding this comment

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

medium

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.

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.

1 participant