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() mixWithOthers boolean does not work #815

Open
3 of 8 tasks
kyrstencarlson opened this issue Jan 19, 2023 · 3 comments
Open
3 of 8 tasks

setCategory() mixWithOthers boolean does not work #815

kyrstencarlson opened this issue Jan 19, 2023 · 3 comments
Labels

Comments

@kyrstencarlson
Copy link

kyrstencarlson commented Jan 19, 2023

🪲 Description

The mix with others option on setCategory('Playback', true) does not work. It does not at all mix with sounds and causes all music playing in background (like spotify, apple music, etc) to completely stop when opening the app or the sounds from inside the app begin to play.

🪲 What is the observed behavior?

see above

🪲 What is the expected behavior?

sound plays over anything else playing, ie. mixing with others

🪲 Please post your code:

Sound.setCategory('Playback', true);
Sound.setActive(true);
Sound.setMode('Default');

const finalBeep = new Sound('beep_single.mp3', Sound.MAIN_BUNDLE, error => {
    if (error) {
        return;
    }
});

//play function takes a boolean if the user marked sound being ON to return the sound being played.
play(finalBeep, context.isSoundOn);

💡 Does the problem have a test case?

💡 Possible solution

💡 Is there a workaround?

💡 If the bug is confirmed, would you be willing to create a pull request?

Is your issue with...

  • iOS
  • Android
  • Windows

Are you using...

  • React Native CLI (e.g. react-native run-android)
  • Expo
  • Other: (please specify)

Which versions are you using?

  • React Native Sound: 0.11.2
  • React Native: 0.69
  • iOS: 16.2
  • Android:
  • Windows:

Does the problem occur on...

  • Simulator
  • Device

If your problem is happening on a device, which device?

  • Device: iPhone 14 Pro
@amberv0
Copy link

amberv0 commented Jan 22, 2023

I'm facing the same issue (spent like 2 hours trying to find issue in react-native-video to finally realize that problem is not there).
I'd like to add that playing the sound is not necessary to reproduce the issue, what causes the background music to stop is the new Sound(...) call.

@amberv0
Copy link

amberv0 commented Jan 22, 2023

Well, this issue seems to be a duplicate of this one, and the workaround provided there does work for me.
One thing I noticed is that it's important to call Sound.setCategory('Playback', true); BEFORE new Sound(...). It was not the case for my app, and so I thought that the workaround didn't work.

@BraveEvidence
Copy link

This will help https://www.youtube.com/watch?v=vVI7ZAZq5e0

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

No branches or pull requests

3 participants