mirror of
https://github.com/Dimillian/IceCubesApp.git
synced 2025-06-05 13:28:50 +00:00
Fix audio session
This commit is contained in:
parent
796f451f3a
commit
28230ba184
2 changed files with 3 additions and 1 deletions
|
@ -270,7 +270,7 @@ class AppDelegate: NSObject, UIApplicationDelegate {
|
||||||
func application(_: UIApplication,
|
func application(_: UIApplication,
|
||||||
didFinishLaunchingWithOptions _: [UIApplication.LaunchOptionsKey: Any]? = nil) -> Bool
|
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)
|
PushNotificationsService.shared.setAccounts(accounts: AppAccountsManager.shared.pushAccounts)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@ public class SoundEffectManager {
|
||||||
public func playSound(of type: SoundEffect) {
|
public func playSound(of type: SoundEffect) {
|
||||||
guard userPreferences.soundEffectEnabled else { return }
|
guard userPreferences.soundEffectEnabled else { return }
|
||||||
if let url = Bundle.main.url(forResource: type.rawValue, withExtension: "wav") {
|
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 = try? .init(contentsOf: url)
|
||||||
currentPlayer?.prepareToPlay()
|
currentPlayer?.prepareToPlay()
|
||||||
currentPlayer?.play()
|
currentPlayer?.play()
|
||||||
|
|
Loading…
Reference in a new issue