Fix audio session
This commit is contained in:
parent
796f451f3a
commit
28230ba184
|
@ -270,7 +270,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
|
|||
func application(_: UIApplication,
|
||||
didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool
|
||||
{
|
||||
try? AVAudioSession.sharedInstance().setCategory(.ambient, options: .mixWithOthers)
|
||||
try? AVAudioSession.sharedInstance().setCategory(.ambient)
|
||||
PushNotificationsService.shared.setAccounts(accounts: AppAccountsManager.shared.pushAccounts)
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -22,6 +22,8 @@ public class SoundEffectManager {
|
|||
public func playSound(of type: SoundEffect) {
|
||||
guard userPreferences.soundEffectEnabled else { return }
|
||||
if let url = Bundle.main.url(forResource: type.rawValue, withExtension: "wav") {
|
||||
try? AVAudioSession.sharedInstance().setCategory(.ambient)
|
||||
try? AVAudioSession.sharedInstance().setActive(true)
|
||||
currentPlayer = try? .init(contentsOf: url)
|
||||
currentPlayer?.prepareToPlay()
|
||||
currentPlayer?.play()
|
||||
|
|
Loading…
Reference in New Issue