Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
## 7.0.0

* **BREAKING CHANGE**: Refactors audio track identification system:
* `VideoAudioTrack.id` (String) replaced with separate `groupIndex` (int) and `trackIndex` (int) properties.
* `selectAudioTrack(int playerId, String trackId)` changed to `selectAudioTrack(int playerId, VideoAudioTrack track)` - now accepts the full track object instead of separate parameters.

Choose a reason for hiding this comment

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

medium

For improved clarity in the release notes, consider rephrasing this point. The playerId is still a separate parameter, so stating it accepts the full track object 'instead of separate parameters' is slightly inaccurate. The main change is replacing the trackId string with the VideoAudioTrack object.

Suggested change
* `selectAudioTrack(int playerId, String trackId)` changed to `selectAudioTrack(int playerId, VideoAudioTrack track)` - now accepts the full track object instead of separate parameters.
* `selectAudioTrack(int playerId, String trackId)` changed to `selectAudioTrack(int playerId, VideoAudioTrack track)` - now accepts the full track object instead of a separate track ID.

* This change provides better type safety and a more intuitive API for audio track selection.

## 6.6.0

* Adds `VideoAudioTrack` class and `getAudioTracks()`, `selectAudioTrack()`, `isAudioTrackSupportAvailable()` methods for audio track management.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,11 @@ abstract class VideoPlayerPlatform extends PlatformInterface {
throw UnimplementedError('getAudioTracks() has not been implemented.');
}

/// Selects which audio track is chosen for playback from its [trackId]
Future<void> selectAudioTrack(int playerId, String trackId) {
/// Selects which audio track is chosen for playback.
///
/// The [track] parameter should be one of the tracks returned by [getAudioTracks].
/// Platform implementations will extract the necessary indices from the track object.
Future<void> selectAudioTrack(int playerId, VideoAudioTrack track) {
throw UnimplementedError('selectAudioTrack() has not been implemented.');
}

Expand Down Expand Up @@ -567,7 +570,8 @@ class VideoCreationOptions {
class VideoAudioTrack {
/// Constructs an instance of [VideoAudioTrack].
const VideoAudioTrack({
required this.id,
required this.groupIndex,
required this.trackIndex,
required this.label,
required this.language,
required this.isSelected,
Expand All @@ -577,8 +581,11 @@ class VideoAudioTrack {
this.codec,
});

/// Unique identifier for the audio track.
final String id;
/// The group index of the audio track.
final int groupIndex;

/// The track index within the group.
final int trackIndex;

/// Human-readable label for the track.
///
Expand Down Expand Up @@ -618,7 +625,8 @@ class VideoAudioTrack {
return identical(this, other) ||
other is VideoAudioTrack &&
runtimeType == other.runtimeType &&
id == other.id &&
groupIndex == other.groupIndex &&
trackIndex == other.trackIndex &&
label == other.label &&
language == other.language &&
isSelected == other.isSelected &&
Expand All @@ -630,7 +638,8 @@ class VideoAudioTrack {

@override
int get hashCode => Object.hash(
id,
groupIndex,
trackIndex,
label,
language,
isSelected,
Expand All @@ -643,7 +652,8 @@ class VideoAudioTrack {
@override
String toString() =>
'VideoAudioTrack('
'id: $id, '
'groupIndex: $groupIndex, '
'trackIndex: $trackIndex, '
'label: $label, '
'language: $language, '
'isSelected: $isSelected, '
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repository: https://github.com/flutter/packages/tree/main/packages/video_player/
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+video_player%22
# NOTE: We strongly prefer non-breaking changes, even at the expense of a
# less-clean API. See https://flutter.dev/go/platform-interface-breaking-changes
version: 6.6.0
version: 7.0.0

environment:
sdk: ^3.7.0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,15 @@ void main() {
test(
'default implementation selectAudioTrack throws unimplemented',
() async {
const VideoAudioTrack track = VideoAudioTrack(
groupIndex: 0,
trackIndex: 0,
label: 'Test',
language: 'en',
isSelected: false,
);
await expectLater(
() => initialInstance.selectAudioTrack(1, 'trackId'),
() => initialInstance.selectAudioTrack(1, track),
throwsUnimplementedError,
);
},
Expand Down