Skip to content

Commit 08e20d3

Browse files
committed
fix(video_player_avfoundation): update audio track selection for macOS compatibility
- Added macOS 10.13 availability check alongside iOS 11.0 - Updated to use currentMediaSelection property instead of deprecated selectedMediaOptionInMediaSelectionGroup method
1 parent 77a28bb commit 08e20d3

File tree

1 file changed

+3
-2
lines changed
  • packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation

1 file changed

+3
-2
lines changed

packages/video_player/video_player_avfoundation/darwin/video_player_avfoundation/Sources/video_player_avfoundation/FVPVideoPlayer.m

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -489,8 +489,9 @@ - (nullable FVPNativeAudioTrackData *)getAudioTracks:(FlutterError *_Nullable *_
489489
NSMutableArray<FVPMediaSelectionAudioTrackData *> *mediaSelectionTracks =
490490
[[NSMutableArray alloc] init];
491491
AVMediaSelectionOption *currentSelection = nil;
492-
if (@available(iOS 11.0, *)) {
493-
currentSelection = [currentItem selectedMediaOptionInMediaSelectionGroup:audioGroup];
492+
if (@available(iOS 11.0, macOS 10.13, *)) {
493+
AVMediaSelection *mediaSelection = currentItem.currentMediaSelection;
494+
currentSelection = [mediaSelection selectedMediaOptionInMediaSelectionGroup:audioGroup];
494495
} else {
495496
#pragma clang diagnostic push
496497
#pragma clang diagnostic ignored "-Wdeprecated-declarations"

0 commit comments

Comments
 (0)