Skip to content
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

setCategory no longer working #124

Closed
anshul-kai opened this issue Mar 2, 2017 · 4 comments
Closed

setCategory no longer working #124

anshul-kai opened this issue Mar 2, 2017 · 4 comments

Comments

@anshul-kai
Copy link

anshul-kai commented Mar 2, 2017

Both the static and non-static Sound.setCategory methods are no longer working after upgrading RN from 0.39.2 to 0.42.0 and RNS from github:zmxv/react-native-sound to 0.9.0.

I've resolved to fixing this by adding the following snippet to the end of didFinishLaunchingWithOptions method under AppDelegate.m.

  AVAudioSession *audioSession = [AVAudioSession sharedInstance];
  NSError *setCategoryError = nil;
  BOOL success = [audioSession setCategory:AVAudioSessionCategoryPlayback error:&setCategoryError];
  if (!success) { /* handle the error condition */ }
  NSError *activationError = nil;
  success = [audioSession setActive:YES error:&activationError];
  if (!success) { /* handle the error condition */ }
@ronangaillard
Copy link

ronangaillard commented Mar 2, 2017

I have the same issue. Without using Sound.setCategory it works perfectly, but if I use it I get this :
simulator screen shot 2 mar 2017 23 39 49

(On iOS simulator, and using react-native-sound version 0.9.0 )

I did not manage to fix it using @a-koka 's hot fix.

@benvium
Copy link
Collaborator

benvium commented Mar 3, 2017

@a-koka Thanks, I'll take a look at this one now.

@benvium
Copy link
Collaborator

benvium commented Mar 3, 2017

I can reproduce this one - seems that the native side isn't dealing with leaving off a value for the 'mixWithOthers' parameter to setCategory. I can fix this.

@benvium
Copy link
Collaborator

benvium commented Mar 3, 2017

@a-koka @ronangaillard Fixed.

EDIT: I've pushed 0.9.1 to npm.

Thanks for the bug report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants