Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

fix(remote-desktop): 退出播放时释放 iOS 音频会话

Dash4fe42113eea4
diff --git a/apps/mobile/modules/cindy-remote-presentation/ios/CindyRemotePresentationModule.swift b/apps/mobile/modules/cindy-remote-presentation/ios/CindyRemotePresentationModule.swift
index 7e23db8cb4..637d4307de 100644
--- a/apps/mobile/modules/cindy-remote-presentation/ios/CindyRemotePresentationModule.swift
+++ b/apps/mobile/modules/cindy-remote-presentation/ios/CindyRemotePresentationModule.swift
@@ -38,11 +38,14 @@ public class CindyRemotePresentationModule: Module {
try session.setCategory(.playback, mode: .moviePlayback, options: [.mixWithOthers])
try session.setActive(true)
} else if let previous = self.previousAudio {
- self.previousAudio = nil
// Do not overwrite a newer voice/audio owner's category.
- if session.category == .playback && session.mode == .moviePlayback {
+ if session.category == .playback && session.mode == .moviePlayback
+ && session.categoryOptions == [.mixWithOthers] {
+ // Release playback before restoring a potentially non-mixing category.
+ try session.setActive(false, options: .notifyOthersOnDeactivation)
try session.setCategory(previous.0, mode: previous.1, options: previous.2)
}
+ self.previousAudio = nil
}
}.runOnQueue(.main)
}