@capgo/native-audio 8.3.2 → 8.3.4

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.
@@ -12,7 +12,7 @@ enum MyError: Error {
12
12
  @objc(NativeAudio)
13
13
  // swiftlint:disable:next type_body_length
14
14
  public class NativeAudio: CAPPlugin, AVAudioPlayerDelegate, CAPBridgedPlugin {
15
- private let pluginVersion: String = "8.3.2"
15
+ private let pluginVersion: String = "8.3.4"
16
16
  public let identifier = "NativeAudio"
17
17
  public let jsName = "NativeAudio"
18
18
  public let pluginMethods: [CAPPluginMethod] = [
@@ -628,9 +628,21 @@ public class NativeAudio: CAPPlugin, AVAudioPlayerDelegate, CAPBridgedPlugin {
628
628
  }
629
629
  }
630
630
 
631
- // Only deactivate if no assets are playing AND no other audio is active
632
- // This prevents interfering with VoIP calls or other audio sessions
633
- if !hasPlayingAssets && !session.isOtherAudioPlaying && session.secondaryAudioShouldBeSilencedHint == false {
631
+ // Only deactivate if no assets are playing AND no other audio is active,
632
+ // and only when we're not in a record-capable mode (e.g. usage with CameraPreview plugin).
633
+ let isRecordCapableCategory: Bool = {
634
+ switch session.category {
635
+ case .record, .playAndRecord, .multiRoute:
636
+ return true
637
+ default:
638
+ return false
639
+ }
640
+ }()
641
+
642
+ if !hasPlayingAssets &&
643
+ !session.isOtherAudioPlaying &&
644
+ session.secondaryAudioShouldBeSilencedHint == false &&
645
+ !isRecordCapableCategory {
634
646
  try self.session.setActive(false, options: .notifyOthersOnDeactivation)
635
647
  }
636
648
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capgo/native-audio",
3
- "version": "8.3.2",
3
+ "version": "8.3.4",
4
4
  "description": "A native plugin for native audio engine",
5
5
  "license": "MPL-2.0",
6
6
  "main": "dist/plugin.cjs.js",