capacitor-voice-recorder-wav-stereo 7.0.7 → 7.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/Plugin/VoiceRecorder.swift +14 -13
- package/package.json +1 -1
|
@@ -106,16 +106,16 @@ public class VoiceRecorder: CAPPlugin {
|
|
|
106
106
|
let audioSession = AVAudioSession.sharedInstance()
|
|
107
107
|
var devices = [[String: Any]]()
|
|
108
108
|
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
print("Current Route: \(audioSession.currentRoute)")
|
|
113
|
-
|
|
114
|
-
// 変更前のルートを保持
|
|
115
|
-
let originalRoute = audioSession.currentRoute
|
|
109
|
+
// ロックを取得して状態変更を防ぐ
|
|
110
|
+
objc_sync_enter(audioSession)
|
|
111
|
+
defer { objc_sync_exit(audioSession) }
|
|
116
112
|
|
|
117
113
|
do {
|
|
118
|
-
//
|
|
114
|
+
// 現在のルートを強制保持
|
|
115
|
+
let originalRoute = audioSession.currentRoute
|
|
116
|
+
print("Original Route: \(originalRoute)")
|
|
117
|
+
|
|
118
|
+
// カテゴリ変更を完全に排除
|
|
119
119
|
let availableInputs = audioSession.availableInputs ?? []
|
|
120
120
|
for port in availableInputs {
|
|
121
121
|
devices.append([
|
|
@@ -126,8 +126,8 @@ public class VoiceRecorder: CAPPlugin {
|
|
|
126
126
|
])
|
|
127
127
|
}
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
for port in
|
|
129
|
+
// 出力デバイスは現在のルートから取得(変更なし)
|
|
130
|
+
for port in originalRoute.outputs {
|
|
131
131
|
devices.append([
|
|
132
132
|
"deviceId": port.uid,
|
|
133
133
|
"kind": "audiooutput",
|
|
@@ -136,14 +136,15 @@ public class VoiceRecorder: CAPPlugin {
|
|
|
136
136
|
])
|
|
137
137
|
}
|
|
138
138
|
|
|
139
|
-
//
|
|
139
|
+
// ルート変更検知
|
|
140
140
|
if audioSession.currentRoute != originalRoute {
|
|
141
|
-
print("Route changed
|
|
141
|
+
print("Route changed unexpectedly!")
|
|
142
142
|
print("New Route: \(audioSession.currentRoute)")
|
|
143
|
+
throw NSError(domain: "AudioSessionError", code: 1, userInfo: nil)
|
|
143
144
|
}
|
|
144
145
|
|
|
145
146
|
} catch {
|
|
146
|
-
call.reject("
|
|
147
|
+
call.reject("Audio session conflict: \(error.localizedDescription)")
|
|
147
148
|
return
|
|
148
149
|
}
|
|
149
150
|
|