capacitor-voice-recorder-wav-stereo 7.0.6 → 7.0.8
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 +10 -10
- package/package.json +1 -1
|
@@ -106,19 +106,20 @@ public class VoiceRecorder: CAPPlugin {
|
|
|
106
106
|
let audioSession = AVAudioSession.sharedInstance()
|
|
107
107
|
var devices = [[String: Any]]()
|
|
108
108
|
|
|
109
|
-
//
|
|
109
|
+
// カテゴリ変更を防ぐためのフラグ
|
|
110
|
+
var didChangeCategory = false
|
|
110
111
|
let originalCategory = audioSession.category
|
|
111
112
|
let originalMode = audioSession.mode
|
|
112
|
-
var didActivate = false
|
|
113
113
|
|
|
114
114
|
do {
|
|
115
|
-
//
|
|
116
|
-
if
|
|
117
|
-
try audioSession.
|
|
118
|
-
|
|
115
|
+
// カテゴリがPlayAndRecordの場合のみ変更
|
|
116
|
+
if audioSession.category == .playAndRecord {
|
|
117
|
+
try audioSession.setCategory(.ambient, mode: .default)
|
|
118
|
+
try audioSession.setActive(true, options: .notifyOthersOnDeactivation)
|
|
119
|
+
didChangeCategory = true
|
|
119
120
|
}
|
|
120
121
|
|
|
121
|
-
//
|
|
122
|
+
// デバイス情報取得
|
|
122
123
|
let availableInputs = audioSession.availableInputs ?? []
|
|
123
124
|
for port in availableInputs {
|
|
124
125
|
devices.append([
|
|
@@ -129,7 +130,6 @@ public class VoiceRecorder: CAPPlugin {
|
|
|
129
130
|
])
|
|
130
131
|
}
|
|
131
132
|
|
|
132
|
-
// 出力デバイス(現在のルートから取得)
|
|
133
133
|
let currentOutputs = audioSession.currentRoute.outputs
|
|
134
134
|
for port in currentOutputs {
|
|
135
135
|
devices.append([
|
|
@@ -140,8 +140,8 @@ public class VoiceRecorder: CAPPlugin {
|
|
|
140
140
|
])
|
|
141
141
|
}
|
|
142
142
|
|
|
143
|
-
//
|
|
144
|
-
if
|
|
143
|
+
// 元のカテゴリに戻す
|
|
144
|
+
if didChangeCategory {
|
|
145
145
|
try audioSession.setCategory(originalCategory, mode: originalMode)
|
|
146
146
|
try audioSession.setActive(true)
|
|
147
147
|
}
|