about summary refs log tree commit diff
path: root/modules
diff options
context:
space:
mode:
authorHailey <me@haileyok.com>2024-08-12 20:08:51 -0700
committerGitHub <noreply@github.com>2024-08-12 20:08:51 -0700
commit1fce7a793d6fc67b58f0fccff327930cc0e062b0 (patch)
tree8ef1194927fb46e3267d6658bd68909f9235f75e /modules
parent3c04d9bd84b2836b3438a659c99cb16009f3af67 (diff)
downloadvoidsky-1fce7a793d6fc67b58f0fccff327930cc0e062b0.tar.zst
[Video] Audio duck off main thread (#4926)
Diffstat (limited to 'modules')
-rw-r--r--modules/expo-bluesky-swiss-army/ios/PlatformInfo/ExpoPlatformInfoModule.swift23
1 files changed, 15 insertions, 8 deletions
diff --git a/modules/expo-bluesky-swiss-army/ios/PlatformInfo/ExpoPlatformInfoModule.swift b/modules/expo-bluesky-swiss-army/ios/PlatformInfo/ExpoPlatformInfoModule.swift
index b61066bed..cae4b983d 100644
--- a/modules/expo-bluesky-swiss-army/ios/PlatformInfo/ExpoPlatformInfoModule.swift
+++ b/modules/expo-bluesky-swiss-army/ios/PlatformInfo/ExpoPlatformInfoModule.swift
@@ -10,19 +10,26 @@ public class ExpoPlatformInfoModule: Module {
 
     Function("setAudioCategory") { (audioCategoryString: String) in
       let audioCategory = AVAudioSession.Category(rawValue: audioCategoryString)
-      try? AVAudioSession.sharedInstance().setCategory(audioCategory)
+
+      DispatchQueue.global(qos: .background).async {
+        try? AVAudioSession.sharedInstance().setCategory(audioCategory)
+      }
     }
 
     Function("setAudioActive") { (active: Bool) in
       if active {
-        try? AVAudioSession.sharedInstance().setActive(true)
+        DispatchQueue.global(qos: .background).async {
+          try? AVAudioSession.sharedInstance().setActive(true)
+        }
       } else {
-        try? AVAudioSession
-          .sharedInstance()
-          .setActive(
-            false,
-            options: [.notifyOthersOnDeactivation]
-          )
+        DispatchQueue.global(qos: .background).async {
+          try? AVAudioSession
+            .sharedInstance()
+            .setActive(
+              false,
+              options: [.notifyOthersOnDeactivation]
+            )
+        }
       }
     }
   }