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.
@@ -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 !audioSession.isOtherAudioPlaying {
117
- try audioSession.setActive(false)
118
- didActivate = true
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 didActivate {
143
+ // 元のカテゴリに戻す
144
+ if didChangeCategory {
145
145
  try audioSession.setCategory(originalCategory, mode: originalMode)
146
146
  try audioSession.setActive(true)
147
147
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "capacitor-voice-recorder-wav-stereo",
3
- "version": "7.0.6",
3
+ "version": "7.0.8",
4
4
  "description": "Capacitor plugin for voice recording in wav format",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",