@siteed/expo-audio-studio 2.12.1 → 2.12.2

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/CHANGELOG.md CHANGED
@@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [Unreleased]
9
9
 
10
10
 
11
+ ## [2.12.2] - 2025-06-07
12
+ ### Changed
13
+ - fix: audio focus strategy implementation for Android background recording (#267) ([5b7b7ed](https://github.com/deeeed/expo-audio-stream/commit/5b7b7eda86bbd65becbe6bab44a44cdf6a1fb17d))
11
14
  ## [2.12.1] - 2025-06-07
12
15
  ### Changed
13
16
  - feat(playground): implement agent validation framework and enhance testing capabilities (#266) ([e7937e0](https://github.com/deeeed/expo-audio-stream/commit/e7937e0268f54f85ea2e0171b221f7ef29cc6248))
@@ -297,7 +300,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
297
300
  - Feature: Audio features extraction during recording.
298
301
  - Feature: Consistent WAV PCM recording format across all platforms.
299
302
 
300
- [unreleased]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.12.1...HEAD
303
+ [unreleased]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.12.2...HEAD
304
+ [2.12.2]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.12.1...@siteed/expo-audio-studio@2.12.2
301
305
  [2.12.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.12.0...@siteed/expo-audio-studio@2.12.1
302
306
  [2.12.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.11.0...@siteed/expo-audio-studio@2.12.0
303
307
  [2.11.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.10.6...@siteed/expo-audio-studio@2.11.0
@@ -469,49 +469,6 @@ class AudioRecorderManager(
469
469
  }
470
470
  }
471
471
 
472
- @RequiresApi(Build.VERSION_CODES.O)
473
- private val audioFocusCallback = object : AudioManager.OnAudioFocusChangeListener {
474
- override fun onAudioFocusChange(focusChange: Int) {
475
- when (focusChange) {
476
- AudioManager.AUDIOFOCUS_LOSS,
477
- AudioManager.AUDIOFOCUS_LOSS_TRANSIENT -> {
478
- if (_isRecording.get() && !isPaused.get()) {
479
- mainHandler.post {
480
- pauseRecording(object : Promise {
481
- override fun resolve(value: Any?) {
482
- eventSender.sendExpoEvent(Constants.RECORDING_INTERRUPTED_EVENT_NAME, bundleOf(
483
- "reason" to "audioFocusLoss",
484
- "isPaused" to true
485
- ))
486
- }
487
- override fun reject(code: String, message: String?, cause: Throwable?) {
488
- LogUtils.e(CLASS_NAME, "Failed to pause recording on audio focus loss")
489
- }
490
- })
491
- }
492
- }
493
- }
494
- AudioManager.AUDIOFOCUS_GAIN -> {
495
- val autoResume = if (::recordingConfig.isInitialized) recordingConfig.autoResumeAfterInterruption else false
496
- if (_isRecording.get() && isPaused.get() && autoResume) {
497
- mainHandler.post {
498
- resumeRecording(object : Promise {
499
- override fun resolve(value: Any?) {
500
- eventSender.sendExpoEvent(Constants.RECORDING_INTERRUPTED_EVENT_NAME, bundleOf(
501
- "reason" to "audioFocusGain",
502
- "isPaused" to false
503
- ))
504
- }
505
- override fun reject(code: String, message: String?, cause: Throwable?) {
506
- LogUtils.e(CLASS_NAME, "Failed to resume recording on audio focus gain")
507
- }
508
- })
509
- }
510
- }
511
- }
512
- }
513
- }
514
- }
515
472
 
516
473
  @RequiresApi(Build.VERSION_CODES.R)
517
474
  fun startRecording(options: Map<String, Any?>, promise: Promise) {
@@ -1753,17 +1710,23 @@ class AudioRecorderManager(
1753
1710
  private fun getAudioFocusStrategy(): String {
1754
1711
  // Use explicit strategy if provided
1755
1712
  if (::recordingConfig.isInitialized) {
1756
- recordingConfig.audioFocusStrategy?.let { return it }
1713
+ recordingConfig.audioFocusStrategy?.let {
1714
+ LogUtils.d(CLASS_NAME, "Using explicit audio focus strategy: $it")
1715
+ return it
1716
+ }
1757
1717
 
1758
1718
  // Smart defaults based on other config
1759
- return if (recordingConfig.keepAwake && enableBackgroundAudio) {
1719
+ val defaultStrategy = if (recordingConfig.keepAwake && enableBackgroundAudio) {
1760
1720
  "background"
1761
1721
  } else {
1762
1722
  "interactive"
1763
1723
  }
1724
+ LogUtils.d(CLASS_NAME, "Using default audio focus strategy: $defaultStrategy (keepAwake=${recordingConfig.keepAwake}, enableBackgroundAudio=$enableBackgroundAudio)")
1725
+ return defaultStrategy
1764
1726
  }
1765
1727
 
1766
1728
  // Default strategy if recordingConfig is not initialized
1729
+ LogUtils.d(CLASS_NAME, "Using fallback audio focus strategy: interactive")
1767
1730
  return "interactive"
1768
1731
  }
1769
1732
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siteed/expo-audio-studio",
3
- "version": "2.12.1",
3
+ "version": "2.12.2",
4
4
  "description": "Comprehensive audio processing library for React Native and Expo with recording, analysis, visualization, and streaming capabilities across iOS, Android, and web",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",