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

Sounds playing when iPhone is in silent mode and setCategory('Ambient') #810

Open
4 of 8 tasks
DanStevensonDev opened this issue Dec 14, 2022 · 3 comments
Open
4 of 8 tasks
Labels

Comments

@DanStevensonDev
Copy link

DanStevensonDev commented Dec 14, 2022

🪲 Description

I am trying to play ambient sounds, where they should be muted if the device is in silent mode.

🪲 What have you tried?

react-native-sounds config is set to below code

🪲 Please post your code:

import Sound from 'react-native-sound'

const start_final = new Sound('start_final.mp3', Sound.MAIN_BUNDLE)

Sound.setActive(true)
Sound.setCategory('Ambient')
Sound.setMode("Default")

const playStart = () => {
  start_final.play()
}

💡 Possible solution

Unknown

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.64.3
  • iOS: 15.6.1
  • Android: N/A
  • Windows: N/A

Does the problem occur on...

  • Simulator
  • Device

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

  • Device:
    iPhone 12
@shubhammalvedev
Copy link

shubhammalvedev commented Dec 16, 2022

You can handle this by lowering volume :

start_final.setVolume(0)

like above statement rest thing u can handle by fetching details of device if its mute or not handle this accordingly....

@danbjork
Copy link

I'm wondering if it is still possible to play sounds when you are on silent mode on iOS? Seems like some features have been deprecated? 🤔

The signature '(value: AVAudioSessionCategory): void' of 'MySound.setCategory' is deprecated.

@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

4 participants