capacitor-voice-recorder-wav-stereo 7.0.5 → 7.0.7
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 +39 -22
- package/package.json +1 -1
|
@@ -106,31 +106,48 @@ public class VoiceRecorder: CAPPlugin {
|
|
|
106
106
|
let audioSession = AVAudioSession.sharedInstance()
|
|
107
107
|
var devices = [[String: Any]]()
|
|
108
108
|
|
|
109
|
-
//
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
"groupId": NSNull()
|
|
117
|
-
])
|
|
118
|
-
}
|
|
109
|
+
// 現在の設定をログ出力
|
|
110
|
+
print("Current Category: \(audioSession.category.rawValue)")
|
|
111
|
+
print("Current Mode: \(audioSession.mode.rawValue)")
|
|
112
|
+
print("Current Route: \(audioSession.currentRoute)")
|
|
113
|
+
|
|
114
|
+
// 変更前のルートを保持
|
|
115
|
+
let originalRoute = audioSession.currentRoute
|
|
119
116
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
117
|
+
do {
|
|
118
|
+
// セッションを変更せずにデバイス情報を取得
|
|
119
|
+
let availableInputs = audioSession.availableInputs ?? []
|
|
120
|
+
for port in availableInputs {
|
|
121
|
+
devices.append([
|
|
122
|
+
"deviceId": port.uid,
|
|
123
|
+
"kind": "audioinput",
|
|
124
|
+
"label": port.portName,
|
|
125
|
+
"groupId": NSNull()
|
|
126
|
+
])
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
let currentOutputs = audioSession.currentRoute.outputs
|
|
130
|
+
for port in currentOutputs {
|
|
131
|
+
devices.append([
|
|
132
|
+
"deviceId": port.uid,
|
|
133
|
+
"kind": "audiooutput",
|
|
134
|
+
"label": port.portName,
|
|
135
|
+
"groupId": NSNull()
|
|
136
|
+
])
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
// ルートが変更されたか確認
|
|
140
|
+
if audioSession.currentRoute != originalRoute {
|
|
141
|
+
print("Route changed during operation!")
|
|
142
|
+
print("New Route: \(audioSession.currentRoute)")
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
} catch {
|
|
146
|
+
call.reject("Failed to get audio devices: \(error.localizedDescription)")
|
|
147
|
+
return
|
|
129
148
|
}
|
|
130
149
|
|
|
131
|
-
call.resolve([
|
|
132
|
-
"devices": devices
|
|
133
|
-
])
|
|
150
|
+
call.resolve(["devices": devices])
|
|
134
151
|
}
|
|
135
152
|
|
|
136
153
|
func doesUserGaveAudioRecordingPermission() -> Bool {
|