From 4318e3c9d1b7e5415e281a1be66f339158a7f67f Mon Sep 17 00:00:00 2001 From: CMK Date: Wed, 30 Jun 2021 18:02:01 +0800 Subject: [PATCH] fix: audio session not deactivate after enter background issue --- Mastodon/Supporting Files/AppDelegate.swift | 2 +- Mastodon/Supporting Files/SceneDelegate.swift | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Mastodon/Supporting Files/AppDelegate.swift b/Mastodon/Supporting Files/AppDelegate.swift index 83dffc34..70d259ca 100644 --- a/Mastodon/Supporting Files/AppDelegate.swift +++ b/Mastodon/Supporting Files/AppDelegate.swift @@ -9,6 +9,7 @@ import os.log import UIKit import UserNotifications import AppShared +import AVFoundation #if ASDK import AsyncDisplayKit @@ -55,7 +56,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate { // Use this method to release any resources that were specific to the discarded scenes, as they will not return. } - } extension AppDelegate { diff --git a/Mastodon/Supporting Files/SceneDelegate.swift b/Mastodon/Supporting Files/SceneDelegate.swift index 7c961dbd..697e9065 100644 --- a/Mastodon/Supporting Files/SceneDelegate.swift +++ b/Mastodon/Supporting Files/SceneDelegate.swift @@ -83,6 +83,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { // Called as the scene transitions from the foreground to the background. // Use this method to save data, release shared resources, and store enough scene-specific state information // to restore the scene back to its current state. + AppContext.shared.audioPlaybackService.pauseIfNeed() }