Skip to content

Commit

Permalink
[video_player] Removed AudioSession configuration on iOS (#1)
Browse files Browse the repository at this point in the history
* [video_player] Removed AudioSession configuration on iOS

We have a custom AudioSession configuration, so it shouldn't be set
on video_player.

* Updated readme

* updated readme
  • Loading branch information
helielson committed Oct 6, 2022
1 parent d4db207 commit f937e32
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# :warning: It's a fork of flutter/plugins
The following changes were necessary to adapt the code to our needs:

- [video_player] [98e0ca1](https://github.com/indaband/flutter_plugins/commit/98e0ca1fa4282a6b6c4277edf5ecb7ed6391f807): Removed AudioSession configuration on iOS.

# Flutter plugins

[![Build Status](https://api.cirrus-ci.com/github/flutter/plugins.svg)](https://cirrus-ci.com/github/flutter/plugins/main)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -553,8 +553,10 @@ - (FLTTextureMessage *)onPlayerSetup:(FLTVideoPlayer *)player
}

- (void)initialize:(FlutterError *__autoreleasing *)error {
// WE HAVE A CUSTOM AUDIO SESSION CONFIGURATION, SO IT SHOULDN'T BE CONFIGURED HERE.
//
// Allow audio playback when the Ring/Silent switch is set to silent
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
// [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];

[self.playersByTextureId
enumerateKeysAndObjectsUsingBlock:^(NSNumber *textureId, FLTVideoPlayer *player, BOOL *stop) {
Expand Down Expand Up @@ -649,13 +651,15 @@ - (void)pause:(FLTTextureMessage *)input error:(FlutterError **)error {

- (void)setMixWithOthers:(FLTMixWithOthersMessage *)input
error:(FlutterError *_Nullable __autoreleasing *)error {
if (input.mixWithOthers.boolValue) {
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback
withOptions:AVAudioSessionCategoryOptionMixWithOthers
error:nil];
} else {
[[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
}
// WE HAVE A CUSTOM AUDIO SESSION CONFIGURATION, SO IT SHOULDN'T BE CONFIGURED HERE.
//
// if (input.mixWithOthers.boolValue) {
// [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback
// withOptions:AVAudioSessionCategoryOptionMixWithOthers
// error:nil];
// } else {
// [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];
// }
}

@end

0 comments on commit f937e32

Please sign in to comment.