expo-audio 1.0.6 → 1.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.
Files changed (60) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/audio/AudioModule.kt +1 -1
  4. package/build/Audio.types.d.ts +13 -0
  5. package/build/Audio.types.d.ts.map +1 -1
  6. package/build/Audio.types.js.map +1 -1
  7. package/build/AudioModule.types.d.ts +1 -1
  8. package/build/AudioModule.types.d.ts.map +1 -1
  9. package/build/AudioModule.types.js.map +1 -1
  10. package/build/ExpoAudio.js +4 -4
  11. package/build/ExpoAudio.js.map +1 -1
  12. package/expo-module.config.json +1 -1
  13. package/ios/AudioModule.swift +8 -3
  14. package/ios/AudioPlayer.swift +1 -0
  15. package/local-maven-repo/expo/modules/audio/expo.modules.audio/{1.0.6/expo.modules.audio-1.0.6-sources.jar → 1.0.8/expo.modules.audio-1.0.8-sources.jar} +0 -0
  16. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8-sources.jar.md5 +1 -0
  17. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8-sources.jar.sha1 +1 -0
  18. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8-sources.jar.sha256 +1 -0
  19. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8-sources.jar.sha512 +1 -0
  20. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8.aar +0 -0
  21. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8.aar.md5 +1 -0
  22. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8.aar.sha1 +1 -0
  23. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8.aar.sha256 +1 -0
  24. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8.aar.sha512 +1 -0
  25. package/local-maven-repo/expo/modules/audio/expo.modules.audio/{1.0.6/expo.modules.audio-1.0.6.module → 1.0.8/expo.modules.audio-1.0.8.module} +22 -22
  26. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8.module.md5 +1 -0
  27. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8.module.sha1 +1 -0
  28. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8.module.sha256 +1 -0
  29. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8.module.sha512 +1 -0
  30. package/local-maven-repo/expo/modules/audio/expo.modules.audio/{1.0.6/expo.modules.audio-1.0.6.pom → 1.0.8/expo.modules.audio-1.0.8.pom} +1 -1
  31. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8.pom.md5 +1 -0
  32. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8.pom.sha1 +1 -0
  33. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8.pom.sha256 +1 -0
  34. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.8/expo.modules.audio-1.0.8.pom.sha512 +1 -0
  35. package/local-maven-repo/expo/modules/audio/expo.modules.audio/maven-metadata.xml +4 -4
  36. package/local-maven-repo/expo/modules/audio/expo.modules.audio/maven-metadata.xml.md5 +1 -1
  37. package/local-maven-repo/expo/modules/audio/expo.modules.audio/maven-metadata.xml.sha1 +1 -1
  38. package/local-maven-repo/expo/modules/audio/expo.modules.audio/maven-metadata.xml.sha256 +1 -1
  39. package/local-maven-repo/expo/modules/audio/expo.modules.audio/maven-metadata.xml.sha512 +1 -1
  40. package/package.json +3 -3
  41. package/src/Audio.types.ts +13 -0
  42. package/src/AudioModule.types.ts +1 -1
  43. package/src/ExpoAudio.ts +5 -5
  44. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6-sources.jar.md5 +0 -1
  45. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6-sources.jar.sha1 +0 -1
  46. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6-sources.jar.sha256 +0 -1
  47. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6-sources.jar.sha512 +0 -1
  48. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6.aar +0 -0
  49. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6.aar.md5 +0 -1
  50. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6.aar.sha1 +0 -1
  51. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6.aar.sha256 +0 -1
  52. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6.aar.sha512 +0 -1
  53. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6.module.md5 +0 -1
  54. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6.module.sha1 +0 -1
  55. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6.module.sha256 +0 -1
  56. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6.module.sha512 +0 -1
  57. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6.pom.md5 +0 -1
  58. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6.pom.sha1 +0 -1
  59. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6.pom.sha256 +0 -1
  60. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.6/expo.modules.audio-1.0.6.pom.sha512 +0 -1
package/CHANGELOG.md CHANGED
@@ -10,6 +10,16 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 1.0.8 — 2025-09-02
14
+
15
+ _This version does not introduce any user-facing changes._
16
+
17
+ ## 1.0.7 — 2025-08-31
18
+
19
+ ### 🎉 New features
20
+
21
+ - [iOS] Add keepAudioSessionActive option to prevent session deactivation ([#39250](https://github.com/expo/expo/pull/39250) by [@hirbod](https://github.com/hirbod))
22
+
13
23
  ## 1.0.6 — 2025-08-27
14
24
 
15
25
  _This version does not introduce any user-facing changes._
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'expo.modules.audio'
7
- version = '1.0.6'
7
+ version = '1.0.8'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.audio"
11
11
  defaultConfig {
12
12
  versionCode 1
13
- versionName "1.0.6"
13
+ versionName "1.0.8"
14
14
  }
15
15
 
16
16
  compileOptions {
@@ -260,7 +260,7 @@ class AudioModule : Module() {
260
260
  }
261
261
 
262
262
  Class(AudioPlayer::class) {
263
- Constructor { source: AudioSource?, updateInterval: Double ->
263
+ Constructor { source: AudioSource?, updateInterval: Double, keepAudioSessionActive: Boolean ->
264
264
  val mediaSource = createMediaItem(source)
265
265
  runOnMain {
266
266
  val player = AudioPlayer(
@@ -65,6 +65,19 @@ export type AudioPlayerOptions = {
65
65
  * @default undefined
66
66
  */
67
67
  crossOrigin?: 'anonymous' | 'use-credentials';
68
+ /**
69
+ * If set to `true`, the audio session will not be deactivated when this player pauses or finishes playback.
70
+ * This prevents interrupting other audio sources (like videos) when the audio ends.
71
+ *
72
+ * Useful for sound effects that should not interfere with ongoing video playback or other audio.
73
+ * The audio session for this player will not be deactivated automatically when the player finishes playback.
74
+ *
75
+ * > **Note:** If needed, you can manually deactivate the audio session using `setIsAudioActiveAsync(false)`.
76
+ *
77
+ * @platform ios
78
+ * @default false
79
+ */
80
+ keepAudioSessionActive?: boolean;
68
81
  };
69
82
  /**
70
83
  * @deprecated Use `AudioPlayerOptions` instead.
@@ -1 +1 @@
1
- {"version":3,"file":"Audio.types.d.ts","sourceRoot":"","sources":["../src/Audio.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAGrE,MAAM,MAAM,WAAW,GACnB,MAAM,GACN,MAAM,GACN,IAAI,GACJ;IACE;;;OAGG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC,CAAC;AAEN;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;;;;;;;OAOG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;;;;;;;;;;;;;;;;;;;;;;OAuBG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB;;;;;;;;;OASG;IACH,WAAW,CAAC,EAAE,WAAW,GAAG,iBAAiB,CAAC;CAC/C,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAElD;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,qDAAqD;IACrD,IAAI,EAAE,MAAM,CAAC;IACb,wGAAwG;IACxG,IAAI,EAAE,MAAM,CAAC;IACb,qIAAqI;IACrI,GAAG,EAAE,MAAM,CAAC;CACb,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,sBAAsB,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC;AAE/D;;;;;;GAMG;AAC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;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,YAAY,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Audio.types.js","sourceRoot":"","sources":["../src/Audio.types.ts"],"names":[],"mappings":"","sourcesContent":["import { AudioQuality, IOSOutputFormat } from './RecordingConstants';\n\n// @docsMissing\nexport type AudioSource =\n | string\n | number\n | null\n | {\n /**\n * A string representing the resource identifier for the audio,\n * which could be an HTTPS address, a local file path, or the name of a static audio file resource.\n */\n uri?: string;\n /**\n * The asset ID of a local audio asset, acquired with the `require` function.\n * This property is exclusive with the `uri` property. When both are present, the `assetId` will be ignored.\n */\n assetId?: number;\n /**\n * An object representing the HTTP headers to send along with the request for a remote audio source.\n * On web requires the `Access-Control-Allow-Origin` header returned by the server to include the current domain.\n */\n headers?: Record<string, string>;\n };\n\n/**\n * Options for configuring audio player behavior.\n */\nexport type AudioPlayerOptions = {\n /**\n * How often (in milliseconds) to emit playback status updates.\n * @default 500\n *\n * @platform ios\n * @platform android\n * @platform web\n */\n updateInterval?: number;\n /**\n * If set to `true`, the system will attempt to download the resource to the device before loading.\n * This value defaults to `false`.\n *\n * Works with:\n * - Local assets from `require('path/to/file')`\n * - Remote HTTP/HTTPS URLs\n * - Asset objects\n *\n * When enabled, this ensures the audio file is fully downloaded before playback begins.\n * This can improve playback performance and reduce buffering, especially for users\n * managing multiple audio players simultaneously.\n *\n * On Android and iOS, this will download the audio file to the device's tmp directory before playback begins.\n * The system will purge the file at its discretion.\n *\n * On web, this will download the audio file to the user's device memory and make it available for the user to play.\n * The system will usually purge the file from memory after a reload or on memory pressure.\n * On web, CORS restrictions apply to the blob url, so you need to make sure the server returns the `Access-Control-Allow-Origin` header.\n *\n * @platform ios\n * @platform web\n * @platform android\n */\n downloadFirst?: boolean;\n /**\n * Determines the [cross origin policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/crossorigin) used by the underlying native view on web.\n * If `undefined` (default), does not use CORS at all. If set to `'anonymous'`, the audio will be loaded with CORS enabled.\n * Note that some audio may not play if CORS is enabled, depending on the CDN settings.\n * If you encounter issues, consider adjusting the `crossOrigin` property.\n *\n *\n * @platform web\n * @default undefined\n */\n crossOrigin?: 'anonymous' | 'use-credentials';\n};\n\n/**\n * @deprecated Use `AudioPlayerOptions` instead.\n * Options for audio loading behavior.\n */\nexport type AudioLoadOptions = AudioPlayerOptions;\n\n/**\n * Represents an available audio input device for recording.\n *\n * This type describes audio input sources like built-in microphones, external microphones,\n * or other audio input devices that can be used for recording. Each input has an identifying\n * information that can be used to select the preferred recording source.\n */\nexport type RecordingInput = {\n /** Human-readable name of the audio input device. */\n name: string;\n /** Type or category of the input device (for example, 'Built-in Microphone', 'External Microphone'). */\n type: string;\n /** Unique identifier for the input device, used to select the input ('Built-in Microphone', 'External Microphone') for recording. */\n uid: string;\n};\n\n/**\n * Pitch correction quality settings for audio playback rate changes.\n *\n * When changing playback rate, pitch correction can be applied to maintain the original pitch.\n * Different quality levels offer trade-offs between processing power and audio quality.\n *\n * @platform ios\n */\nexport type PitchCorrectionQuality = 'low' | 'medium' | 'high';\n\n/**\n * Comprehensive status information for an `AudioPlayer`.\n *\n * This object contains all the current state information about audio playback,\n * including playback position, duration, loading state, and playback settings.\n * Used by `useAudioPlayerStatus()` to provide real-time status updates.\n */\nexport type AudioStatus = {\n /** Unique identifier for the player instance. */\n id: number;\n /** Current playback position in seconds. */\n currentTime: number;\n /** String representation of the player's internal playback state. */\n playbackState: string;\n /** String representation of the player's time control status (playing/paused/waiting). */\n timeControlStatus: string;\n /** Reason why the player is waiting to play (if applicable). */\n reasonForWaitingToPlay: string;\n /** Whether the player is currently muted. */\n mute: boolean;\n /** Total duration of the audio in seconds, or 0 if not yet determined. */\n duration: number;\n /** Whether the audio is currently playing. */\n playing: boolean;\n /** Whether the audio is set to loop when it reaches the end. */\n loop: boolean;\n /** Whether the audio just finished playing. */\n didJustFinish: boolean;\n /** Whether the player is currently buffering data. */\n isBuffering: boolean;\n /** Whether the audio has finished loading and is ready to play. */\n isLoaded: boolean;\n /** Current playback rate (1.0 = normal speed). */\n playbackRate: number;\n /** Whether pitch correction is enabled for rate changes. */\n shouldCorrectPitch: boolean;\n};\n\n/**\n * Status information for recording operations from the event system.\n *\n * This type represents the status data emitted by `recordingStatusUpdate` events.\n * It contains high-level information about the recording session and any errors.\n * Used internally by the event system. Most users should use `useAudioRecorderState()` instead.\n */\nexport type RecordingStatus = {\n /** Unique identifier for the recording session. */\n id: number;\n /** Whether the recording has finished (stopped). */\n isFinished: boolean;\n /** Whether an error occurred during recording. */\n hasError: boolean;\n /** Error message if an error occurred, `null` otherwise. */\n error: string | null;\n /** File URL of the completed recording, if available. */\n url: string | null;\n};\n\n/**\n * Current state information for an `AudioRecorder`.\n *\n * This object contains detailed information about the recorder's current state,\n * including recording status, duration, and technical details. This is what you get\n * when calling `recorder.getStatus()` or using `useAudioRecorderState()`.\n */\nexport type RecorderState = {\n /** Whether the recorder is ready and able to record. */\n canRecord: boolean;\n /** Whether recording is currently in progress. */\n isRecording: boolean;\n /** Duration of the current recording in milliseconds. */\n durationMillis: number;\n /** Whether the media services have been reset (typically indicates a system interruption). */\n mediaServicesDidReset: boolean;\n /** Current audio level/volume being recorded (if metering is enabled). */\n metering?: number;\n /** File URL where the recording will be saved, if available. */\n url: string | null;\n};\n\n/**\n * Audio output format options for Android recording.\n *\n * Specifies the container format for recorded audio files on Android.\n * Different formats have different compatibility and compression characteristics.\n *\n * @platform android\n */\nexport type AndroidOutputFormat =\n | 'default'\n | '3gp'\n | 'mpeg4'\n | 'amrnb'\n | 'amrwb'\n | 'aac_adts'\n | 'mpeg2ts'\n | 'webm';\n\n/**\n * Audio encoder options for Android recording.\n *\n * Specifies the audio codec used to encode recorded audio on Android.\n * Different encoders offer different quality, compression, and compatibility trade-offs.\n *\n * @platform android\n */\nexport type AndroidAudioEncoder = 'default' | 'amr_nb' | 'amr_wb' | 'aac' | 'he_aac' | 'aac_eld';\n\n/**\n * Bit rate strategies for audio encoding.\n *\n * Determines how the encoder manages bit rate during recording, affecting\n * file size consistency and quality characteristics.\n */\nexport type BitRateStrategy = 'constant' | 'longTermAverage' | 'variableConstrained' | 'variable';\n\n/**\n * Options for controlling how audio recording is started.\n */\nexport type RecordingStartOptions = {\n /**\n * The duration in seconds after which recording should automatically stop.\n * If not provided, recording continues until manually stopped.\n *\n * @platform ios\n * @platform android\n * @platform web\n */\n forDuration?: number;\n /**\n * The time in seconds to wait before starting the recording.\n * If not provided, recording starts immediately.\n *\n * **Platform behavior:**\n * - Android: Ignored, recording starts immediately\n * - iOS: Uses native AVAudioRecorder.record(atTime:) for precise timing.\n * - Web: Ignored, recording starts immediately\n *\n * > **warning** On iOS, the recording process starts immediately (you'll see status updates),\n * but actual audio capture begins after the specified delay. This is not a countdown, since\n * the recorder is active but silent during the delay period.\n *\n * @platform ios\n */\n atTime?: number;\n};\n\nexport type RecordingOptions = {\n /**\n * A boolean that determines whether audio level information will be part of the status object under the \"metering\" key.\n */\n isMeteringEnabled?: boolean;\n /**\n * The desired file extension.\n *\n * @example .caf\n */\n extension: string;\n /**\n * The desired sample rate.\n *\n * @example 44100\n */\n sampleRate: number;\n /**\n * The desired number of channels.\n *\n * @example 2\n */\n numberOfChannels: number;\n /**\n * The desired bit rate.\n *\n * @example 128000\n */\n bitRate: number;\n /**\n * Recording options for the Android platform.\n * @platform android\n */\n android: RecordingOptionsAndroid;\n /**\n * Recording options for the iOS platform.\n * @platform ios\n */\n ios: RecordingOptionsIos;\n /**\n * Recording options for the Web platform.\n * @platform web\n */\n web?: RecordingOptionsWeb;\n};\n\n/**\n * Recording options for the web.\n *\n * Web recording uses the `MediaRecorder` API, which has different capabilities\n * compared to native platforms. These options map directly to `MediaRecorder` settings.\n *\n * @platform web\n */\nexport type RecordingOptionsWeb = {\n /** MIME type for the recording (for example, 'audio/webm', 'audio/mp4'). */\n mimeType?: string;\n /** Target bits per second for the recording. */\n bitsPerSecond?: number;\n};\n\n/**\n * Recording configuration options specific to iOS.\n *\n * iOS recording uses `AVAudioRecorder` with extensive format and quality options.\n * These settings provide fine-grained control over the recording characteristics.\n *\n * @platform ios\n */\nexport type RecordingOptionsIos = {\n /**\n * The desired file extension.\n *\n * @example .caf\n */\n extension?: string;\n /**\n * The desired sample rate.\n *\n * @example 44100\n */\n sampleRate?: number;\n /**\n * The desired file format. See the [`IOSOutputFormat`](#iosoutputformat) enum for all valid values.\n */\n outputFormat?: string | IOSOutputFormat | number;\n /**\n * The desired audio quality. See the [`AudioQuality`](#audioquality) enum for all valid values.\n */\n audioQuality: AudioQuality | number;\n /**\n * The desired bit rate strategy. See the next section for an enumeration of all valid values of `bitRateStrategy`.\n */\n bitRateStrategy?: number;\n /**\n * The desired bit depth hint.\n *\n * @example 16\n */\n bitDepthHint?: number;\n /**\n * The desired PCM bit depth.\n *\n * @example 16\n */\n linearPCMBitDepth?: number;\n /**\n * A boolean describing if the PCM data should be formatted in big endian.\n */\n linearPCMIsBigEndian?: boolean;\n /**\n * A boolean describing if the PCM data should be encoded in floating point or integral values.\n */\n linearPCMIsFloat?: boolean;\n};\n\n/**\n * Recording configuration options specific to Android.\n *\n * Android recording uses `MediaRecorder` with options for format, encoder, and file constraints.\n * These settings control the output format and quality characteristics.\n *\n * @platform android\n */\nexport type RecordingOptionsAndroid = {\n /**\n * The desired file extension.\n *\n * @example .caf\n */\n extension?: string;\n /**\n * The desired sample rate.\n *\n * @example 44100\n */\n sampleRate?: number;\n /**\n * The desired file format. See the [`AndroidOutputFormat`](#androidoutputformat) enum for all valid values.\n */\n outputFormat: AndroidOutputFormat;\n /**\n * The desired audio encoder. See the [`AndroidAudioEncoder`](#androidaudioencoder) enum for all valid values.\n */\n audioEncoder: AndroidAudioEncoder;\n /**\n * The desired maximum file size in bytes, after which the recording will stop (but `stopAndUnloadAsync()` must still\n * be called after this point).\n *\n * @example\n * `65536`\n */\n maxFileSize?: number;\n};\n\nexport type AudioMode = {\n /**\n * Determines if audio playback is allowed when the device is in silent mode.\n *\n * @platform ios\n */\n playsInSilentMode: boolean;\n /**\n * Determines how the audio session interacts with other sessions.\n *\n * @platform ios\n */\n interruptionMode: InterruptionMode;\n /**\n * Determines how the audio session interacts with other sessions on Android.\n *\n * @platform android\n */\n interruptionModeAndroid: InterruptionModeAndroid;\n /**\n * Whether the audio session allows recording.\n *\n * @default false\n * @platform ios\n */\n allowsRecording: boolean;\n /**\n * Whether the audio session stays active when the app moves to the background.\n * @default false\n */\n shouldPlayInBackground: boolean;\n /**\n * Whether the audio should route through the earpiece.\n * @platform android\n */\n shouldRouteThroughEarpiece: boolean;\n};\n\n/**\n * Audio interruption behavior modes for iOS.\n *\n * Controls how your app's audio interacts with other apps' audio when interruptions occur.\n * This affects what happens when phone calls, notifications, or other apps play audio.\n *\n * @platform ios\n */\nexport type InterruptionMode = 'mixWithOthers' | 'doNotMix' | 'duckOthers';\n\n/**\n * Audio interruption behavior modes for Android.\n *\n * Controls how your app's audio interacts with other apps' audio on Android.\n * Note that Android doesn't support 'mixWithOthers' mode; audio focus is more strictly managed.\n *\n * @platform android\n */\nexport type InterruptionModeAndroid = 'doNotMix' | 'duckOthers';\n"]}
1
+ {"version":3,"file":"Audio.types.js","sourceRoot":"","sources":["../src/Audio.types.ts"],"names":[],"mappings":"","sourcesContent":["import { AudioQuality, IOSOutputFormat } from './RecordingConstants';\n\n// @docsMissing\nexport type AudioSource =\n | string\n | number\n | null\n | {\n /**\n * A string representing the resource identifier for the audio,\n * which could be an HTTPS address, a local file path, or the name of a static audio file resource.\n */\n uri?: string;\n /**\n * The asset ID of a local audio asset, acquired with the `require` function.\n * This property is exclusive with the `uri` property. When both are present, the `assetId` will be ignored.\n */\n assetId?: number;\n /**\n * An object representing the HTTP headers to send along with the request for a remote audio source.\n * On web requires the `Access-Control-Allow-Origin` header returned by the server to include the current domain.\n */\n headers?: Record<string, string>;\n };\n\n/**\n * Options for configuring audio player behavior.\n */\nexport type AudioPlayerOptions = {\n /**\n * How often (in milliseconds) to emit playback status updates.\n * @default 500\n *\n * @platform ios\n * @platform android\n * @platform web\n */\n updateInterval?: number;\n /**\n * If set to `true`, the system will attempt to download the resource to the device before loading.\n * This value defaults to `false`.\n *\n * Works with:\n * - Local assets from `require('path/to/file')`\n * - Remote HTTP/HTTPS URLs\n * - Asset objects\n *\n * When enabled, this ensures the audio file is fully downloaded before playback begins.\n * This can improve playback performance and reduce buffering, especially for users\n * managing multiple audio players simultaneously.\n *\n * On Android and iOS, this will download the audio file to the device's tmp directory before playback begins.\n * The system will purge the file at its discretion.\n *\n * On web, this will download the audio file to the user's device memory and make it available for the user to play.\n * The system will usually purge the file from memory after a reload or on memory pressure.\n * On web, CORS restrictions apply to the blob url, so you need to make sure the server returns the `Access-Control-Allow-Origin` header.\n *\n * @platform ios\n * @platform web\n * @platform android\n */\n downloadFirst?: boolean;\n /**\n * Determines the [cross origin policy](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/crossorigin) used by the underlying native view on web.\n * If `undefined` (default), does not use CORS at all. If set to `'anonymous'`, the audio will be loaded with CORS enabled.\n * Note that some audio may not play if CORS is enabled, depending on the CDN settings.\n * If you encounter issues, consider adjusting the `crossOrigin` property.\n *\n *\n * @platform web\n * @default undefined\n */\n crossOrigin?: 'anonymous' | 'use-credentials';\n /**\n * If set to `true`, the audio session will not be deactivated when this player pauses or finishes playback.\n * This prevents interrupting other audio sources (like videos) when the audio ends.\n *\n * Useful for sound effects that should not interfere with ongoing video playback or other audio.\n * The audio session for this player will not be deactivated automatically when the player finishes playback.\n *\n * > **Note:** If needed, you can manually deactivate the audio session using `setIsAudioActiveAsync(false)`.\n *\n * @platform ios\n * @default false\n */\n keepAudioSessionActive?: boolean;\n};\n\n/**\n * @deprecated Use `AudioPlayerOptions` instead.\n * Options for audio loading behavior.\n */\nexport type AudioLoadOptions = AudioPlayerOptions;\n\n/**\n * Represents an available audio input device for recording.\n *\n * This type describes audio input sources like built-in microphones, external microphones,\n * or other audio input devices that can be used for recording. Each input has an identifying\n * information that can be used to select the preferred recording source.\n */\nexport type RecordingInput = {\n /** Human-readable name of the audio input device. */\n name: string;\n /** Type or category of the input device (for example, 'Built-in Microphone', 'External Microphone'). */\n type: string;\n /** Unique identifier for the input device, used to select the input ('Built-in Microphone', 'External Microphone') for recording. */\n uid: string;\n};\n\n/**\n * Pitch correction quality settings for audio playback rate changes.\n *\n * When changing playback rate, pitch correction can be applied to maintain the original pitch.\n * Different quality levels offer trade-offs between processing power and audio quality.\n *\n * @platform ios\n */\nexport type PitchCorrectionQuality = 'low' | 'medium' | 'high';\n\n/**\n * Comprehensive status information for an `AudioPlayer`.\n *\n * This object contains all the current state information about audio playback,\n * including playback position, duration, loading state, and playback settings.\n * Used by `useAudioPlayerStatus()` to provide real-time status updates.\n */\nexport type AudioStatus = {\n /** Unique identifier for the player instance. */\n id: number;\n /** Current playback position in seconds. */\n currentTime: number;\n /** String representation of the player's internal playback state. */\n playbackState: string;\n /** String representation of the player's time control status (playing/paused/waiting). */\n timeControlStatus: string;\n /** Reason why the player is waiting to play (if applicable). */\n reasonForWaitingToPlay: string;\n /** Whether the player is currently muted. */\n mute: boolean;\n /** Total duration of the audio in seconds, or 0 if not yet determined. */\n duration: number;\n /** Whether the audio is currently playing. */\n playing: boolean;\n /** Whether the audio is set to loop when it reaches the end. */\n loop: boolean;\n /** Whether the audio just finished playing. */\n didJustFinish: boolean;\n /** Whether the player is currently buffering data. */\n isBuffering: boolean;\n /** Whether the audio has finished loading and is ready to play. */\n isLoaded: boolean;\n /** Current playback rate (1.0 = normal speed). */\n playbackRate: number;\n /** Whether pitch correction is enabled for rate changes. */\n shouldCorrectPitch: boolean;\n};\n\n/**\n * Status information for recording operations from the event system.\n *\n * This type represents the status data emitted by `recordingStatusUpdate` events.\n * It contains high-level information about the recording session and any errors.\n * Used internally by the event system. Most users should use `useAudioRecorderState()` instead.\n */\nexport type RecordingStatus = {\n /** Unique identifier for the recording session. */\n id: number;\n /** Whether the recording has finished (stopped). */\n isFinished: boolean;\n /** Whether an error occurred during recording. */\n hasError: boolean;\n /** Error message if an error occurred, `null` otherwise. */\n error: string | null;\n /** File URL of the completed recording, if available. */\n url: string | null;\n};\n\n/**\n * Current state information for an `AudioRecorder`.\n *\n * This object contains detailed information about the recorder's current state,\n * including recording status, duration, and technical details. This is what you get\n * when calling `recorder.getStatus()` or using `useAudioRecorderState()`.\n */\nexport type RecorderState = {\n /** Whether the recorder is ready and able to record. */\n canRecord: boolean;\n /** Whether recording is currently in progress. */\n isRecording: boolean;\n /** Duration of the current recording in milliseconds. */\n durationMillis: number;\n /** Whether the media services have been reset (typically indicates a system interruption). */\n mediaServicesDidReset: boolean;\n /** Current audio level/volume being recorded (if metering is enabled). */\n metering?: number;\n /** File URL where the recording will be saved, if available. */\n url: string | null;\n};\n\n/**\n * Audio output format options for Android recording.\n *\n * Specifies the container format for recorded audio files on Android.\n * Different formats have different compatibility and compression characteristics.\n *\n * @platform android\n */\nexport type AndroidOutputFormat =\n | 'default'\n | '3gp'\n | 'mpeg4'\n | 'amrnb'\n | 'amrwb'\n | 'aac_adts'\n | 'mpeg2ts'\n | 'webm';\n\n/**\n * Audio encoder options for Android recording.\n *\n * Specifies the audio codec used to encode recorded audio on Android.\n * Different encoders offer different quality, compression, and compatibility trade-offs.\n *\n * @platform android\n */\nexport type AndroidAudioEncoder = 'default' | 'amr_nb' | 'amr_wb' | 'aac' | 'he_aac' | 'aac_eld';\n\n/**\n * Bit rate strategies for audio encoding.\n *\n * Determines how the encoder manages bit rate during recording, affecting\n * file size consistency and quality characteristics.\n */\nexport type BitRateStrategy = 'constant' | 'longTermAverage' | 'variableConstrained' | 'variable';\n\n/**\n * Options for controlling how audio recording is started.\n */\nexport type RecordingStartOptions = {\n /**\n * The duration in seconds after which recording should automatically stop.\n * If not provided, recording continues until manually stopped.\n *\n * @platform ios\n * @platform android\n * @platform web\n */\n forDuration?: number;\n /**\n * The time in seconds to wait before starting the recording.\n * If not provided, recording starts immediately.\n *\n * **Platform behavior:**\n * - Android: Ignored, recording starts immediately\n * - iOS: Uses native AVAudioRecorder.record(atTime:) for precise timing.\n * - Web: Ignored, recording starts immediately\n *\n * > **warning** On iOS, the recording process starts immediately (you'll see status updates),\n * but actual audio capture begins after the specified delay. This is not a countdown, since\n * the recorder is active but silent during the delay period.\n *\n * @platform ios\n */\n atTime?: number;\n};\n\nexport type RecordingOptions = {\n /**\n * A boolean that determines whether audio level information will be part of the status object under the \"metering\" key.\n */\n isMeteringEnabled?: boolean;\n /**\n * The desired file extension.\n *\n * @example .caf\n */\n extension: string;\n /**\n * The desired sample rate.\n *\n * @example 44100\n */\n sampleRate: number;\n /**\n * The desired number of channels.\n *\n * @example 2\n */\n numberOfChannels: number;\n /**\n * The desired bit rate.\n *\n * @example 128000\n */\n bitRate: number;\n /**\n * Recording options for the Android platform.\n * @platform android\n */\n android: RecordingOptionsAndroid;\n /**\n * Recording options for the iOS platform.\n * @platform ios\n */\n ios: RecordingOptionsIos;\n /**\n * Recording options for the Web platform.\n * @platform web\n */\n web?: RecordingOptionsWeb;\n};\n\n/**\n * Recording options for the web.\n *\n * Web recording uses the `MediaRecorder` API, which has different capabilities\n * compared to native platforms. These options map directly to `MediaRecorder` settings.\n *\n * @platform web\n */\nexport type RecordingOptionsWeb = {\n /** MIME type for the recording (for example, 'audio/webm', 'audio/mp4'). */\n mimeType?: string;\n /** Target bits per second for the recording. */\n bitsPerSecond?: number;\n};\n\n/**\n * Recording configuration options specific to iOS.\n *\n * iOS recording uses `AVAudioRecorder` with extensive format and quality options.\n * These settings provide fine-grained control over the recording characteristics.\n *\n * @platform ios\n */\nexport type RecordingOptionsIos = {\n /**\n * The desired file extension.\n *\n * @example .caf\n */\n extension?: string;\n /**\n * The desired sample rate.\n *\n * @example 44100\n */\n sampleRate?: number;\n /**\n * The desired file format. See the [`IOSOutputFormat`](#iosoutputformat) enum for all valid values.\n */\n outputFormat?: string | IOSOutputFormat | number;\n /**\n * The desired audio quality. See the [`AudioQuality`](#audioquality) enum for all valid values.\n */\n audioQuality: AudioQuality | number;\n /**\n * The desired bit rate strategy. See the next section for an enumeration of all valid values of `bitRateStrategy`.\n */\n bitRateStrategy?: number;\n /**\n * The desired bit depth hint.\n *\n * @example 16\n */\n bitDepthHint?: number;\n /**\n * The desired PCM bit depth.\n *\n * @example 16\n */\n linearPCMBitDepth?: number;\n /**\n * A boolean describing if the PCM data should be formatted in big endian.\n */\n linearPCMIsBigEndian?: boolean;\n /**\n * A boolean describing if the PCM data should be encoded in floating point or integral values.\n */\n linearPCMIsFloat?: boolean;\n};\n\n/**\n * Recording configuration options specific to Android.\n *\n * Android recording uses `MediaRecorder` with options for format, encoder, and file constraints.\n * These settings control the output format and quality characteristics.\n *\n * @platform android\n */\nexport type RecordingOptionsAndroid = {\n /**\n * The desired file extension.\n *\n * @example .caf\n */\n extension?: string;\n /**\n * The desired sample rate.\n *\n * @example 44100\n */\n sampleRate?: number;\n /**\n * The desired file format. See the [`AndroidOutputFormat`](#androidoutputformat) enum for all valid values.\n */\n outputFormat: AndroidOutputFormat;\n /**\n * The desired audio encoder. See the [`AndroidAudioEncoder`](#androidaudioencoder) enum for all valid values.\n */\n audioEncoder: AndroidAudioEncoder;\n /**\n * The desired maximum file size in bytes, after which the recording will stop (but `stopAndUnloadAsync()` must still\n * be called after this point).\n *\n * @example\n * `65536`\n */\n maxFileSize?: number;\n};\n\nexport type AudioMode = {\n /**\n * Determines if audio playback is allowed when the device is in silent mode.\n *\n * @platform ios\n */\n playsInSilentMode: boolean;\n /**\n * Determines how the audio session interacts with other sessions.\n *\n * @platform ios\n */\n interruptionMode: InterruptionMode;\n /**\n * Determines how the audio session interacts with other sessions on Android.\n *\n * @platform android\n */\n interruptionModeAndroid: InterruptionModeAndroid;\n /**\n * Whether the audio session allows recording.\n *\n * @default false\n * @platform ios\n */\n allowsRecording: boolean;\n /**\n * Whether the audio session stays active when the app moves to the background.\n * @default false\n */\n shouldPlayInBackground: boolean;\n /**\n * Whether the audio should route through the earpiece.\n * @platform android\n */\n shouldRouteThroughEarpiece: boolean;\n};\n\n/**\n * Audio interruption behavior modes for iOS.\n *\n * Controls how your app's audio interacts with other apps' audio when interruptions occur.\n * This affects what happens when phone calls, notifications, or other apps play audio.\n *\n * @platform ios\n */\nexport type InterruptionMode = 'mixWithOthers' | 'doNotMix' | 'duckOthers';\n\n/**\n * Audio interruption behavior modes for Android.\n *\n * Controls how your app's audio interacts with other apps' audio on Android.\n * Note that Android doesn't support 'mixWithOthers' mode; audio focus is more strictly managed.\n *\n * @platform android\n */\nexport type InterruptionModeAndroid = 'doNotMix' | 'duckOthers';\n"]}
@@ -16,7 +16,7 @@ export declare class AudioPlayer extends SharedObject<AudioEvents> {
16
16
  * Initializes a new audio player instance with the given source.
17
17
  * @hidden
18
18
  */
19
- constructor(source: AudioSource, updateInterval: number);
19
+ constructor(source: AudioSource, updateInterval: number, keepAudioSessionActive: boolean);
20
20
  /**
21
21
  * Unique identifier for the player object.
22
22
  */
@@ -1 +1 @@
1
- {"version":3,"file":"AudioModule.types.d.ts","sourceRoot":"","sources":["../src/AudioModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEnF,OAAO,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EAChB,MAAM,eAAe,CAAC;AAEvB;;GAEG;AACH,MAAM,CAAC,OAAO,OAAO,iBAAkB,SAAQ,YAAY;IACzD,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IACrD,iBAAiB,CAAC,QAAQ,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAC9D,gCAAgC,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAC/D,4BAA4B,IAAI,OAAO,CAAC,kBAAkB,CAAC;IAE3D,QAAQ,CAAC,W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,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CACzC;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,oFAAoF;IACpF,qBAAqB,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CAC1D,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"AudioModule.types.js","sourceRoot":"","sources":["../src/AudioModule.types.ts"],"names":[],"mappings":"","sourcesContent":["import { NativeModule, PermissionResponse, SharedObject } from 'expo-modules-core';\n\nimport {\n AudioMode,\n AudioSource,\n AudioStatus,\n PitchCorrectionQuality,\n RecorderState,\n RecordingInput,\n RecordingOptions,\n RecordingStartOptions,\n RecordingStatus,\n} from './Audio.types';\n\n/**\n * @hidden\n */\nexport declare class NativeAudioModule extends NativeModule {\n setIsAudioActiveAsync(active: boolean): Promise<void>;\n setAudioModeAsync(category: Partial<AudioMode>): Promise<void>;\n requestRecordingPermissionsAsync(): Promise<PermissionResponse>;\n getRecordingPermissionsAsync(): Promise<PermissionResponse>;\n\n readonly AudioPlayer: typeof AudioPlayer;\n readonly AudioRecorder: typeof AudioRecorder;\n}\n\nexport declare class AudioPlayer extends SharedObject<AudioEvents> {\n /**\n * Initializes a new audio player instance with the given source.\n * @hidden\n */\n constructor(source: AudioSource, updateInterval: number);\n\n /**\n * Unique identifier for the player object.\n */\n id: number;\n\n /**\n * Boolean value indicating whether the player is currently playing.\n */\n playing: boolean;\n\n /**\n * Boolean value indicating whether the player is currently muted.\n */\n muted: boolean;\n\n /**\n * Boolean value indicating whether the player is currently looping.\n */\n loop: boolean;\n\n /**\n * Boolean value indicating whether the player is currently paused.\n */\n paused: boolean;\n\n /**\n * Boolean value indicating whether the player is finished loading.\n */\n isLoaded: boolean;\n\n /**\n * Boolean value indicating whether audio sampling is supported on the platform.\n */\n isAudioSamplingSupported: boolean;\n\n /**\n * Boolean value indicating whether the player is buffering.\n */\n isBuffering: boolean;\n\n /**\n * The current position through the audio item in seconds.\n */\n currentTime: number;\n\n /**\n * The total duration of the audio in seconds.\n */\n duration: number;\n\n /**\n * The current volume of the audio.\n */\n volume: number;\n\n /**\n * The current playback rate of the audio.\n */\n playbackRate: number;\n\n /**\n * A boolean describing if we are correcting the pitch for a changed rate.\n */\n shouldCorrectPitch: boolean;\n\n /**\n * The current status of the audio player.\n * @hidden\n */\n currentStatus: AudioStatus;\n\n /**\n * Start playing audio.\n */\n play(): void;\n\n /**\n * Pauses the player.\n */\n pause(): void;\n\n /**\n * Replaces the current audio source with a new one.\n */\n replace(source: AudioSource): void;\n\n /**\n * Seeks the playback by the given number of seconds.\n * @param seconds The number of seconds to seek by.\n * @param toleranceMillisBefore The tolerance allowed before the requested seek time, in milliseconds. iOS only.\n * @param toleranceMillisAfter The tolerance allowed after the requested seek time, in milliseconds. iOS only.\n */\n seekTo(\n seconds: number,\n toleranceMillisBefore?: number,\n toleranceMillisAfter?: number\n ): Promise<void>;\n\n /**\n * Sets the current playback rate of the audio.\n * @param rate The playback rate of the audio.\n * @param pitchCorrectionQuality The quality of the pitch correction.\n */\n setPlaybackRate(rate: number, pitchCorrectionQuality?: PitchCorrectionQuality): void;\n\n /**\n *\n * @hidden\n */\n setAudioSamplingEnabled(enabled: boolean): void;\n\n /**\n * Remove the player from memory to free up resources.\n */\n remove(): void;\n}\n\n/**\n * Represents a single audio sample containing waveform data from all audio channels.\n *\n * Audio samples are provided in real-time when audio sampling is enabled on an `AudioPlayer`.\n * Each sample contains the raw PCM audio data for all channels (mono has 1 channel, stereo has 2).\n * This data can be used for audio visualization, analysis, or processing.\n */\nexport type AudioSample = {\n /** Array of audio channels, each containing PCM frame data. Stereo audio will have 2 channels (left/right). */\n channels: AudioSampleChannel[];\n /** Timestamp of this sample relative to the audio track's timeline, in seconds. */\n timestamp: number;\n};\n\n/**\n * Represents audio data for a single channel (for example, left or right in stereo audio).\n *\n * Contains the raw PCM (Pulse Code Modulation) audio frames for this channel.\n * Frame values are normalized between -1.0 and 1.0, where 0 represents silence.\n */\nexport type AudioSampleChannel = {\n /** Array of PCM audio frame values, each between -1.0 and 1.0. */\n frames: number[];\n};\n\n/**\n * Event types that an `AudioPlayer` can emit.\n *\n * These events allow you to listen for changes in playback state and receive real-time audio data.\n * Use `player.addListener()` to subscribe to these events.\n */\nexport type AudioEvents = {\n /** Fired when the player's status changes (play/pause/seek/load and so on.). */\n playbackStatusUpdate(status: AudioStatus): void;\n /** Fired when audio sampling is enabled and new sample data is available. */\n audioSampleUpdate(data: AudioSample): void;\n};\n\nexport declare class AudioRecorder extends SharedObject<RecordingEvents> {\n /**\n * Initializes a new audio recorder instance with the given source.\n * @hidden\n */\n constructor(options: Partial<RecordingOptions>);\n\n /**\n * Unique identifier for the recorder object.\n */\n id: number;\n\n /**\n * The current length of the recording, in seconds.\n */\n currentTime: number;\n\n /**\n * Boolean value indicating whether the recording is in progress.\n */\n isRecording: boolean;\n\n /**\n * The uri of the recording.\n */\n uri: string | null;\n\n /**\n * Starts the recording.\n * @param options Optional recording configuration options.\n */\n record(options?: RecordingStartOptions): void;\n\n /**\n * Stop the recording.\n */\n stop(): Promise<void>;\n\n /**\n * Pause the recording.\n */\n pause(): void;\n\n /**\n * Returns a list of available recording inputs. This method can only be called if the `Recording` has been prepared.\n * @return A `Promise` that is fulfilled with an array of `RecordingInput` objects.\n */\n getAvailableInputs(): RecordingInput[];\n\n /**\n * Returns the currently-selected recording input. This method can only be called if the `Recording` has been prepared.\n * @return A `Promise` that is fulfilled with a `RecordingInput` object.\n */\n getCurrentInput(): Promise<RecordingInput>;\n\n /**\n * Sets the current recording input.\n * @param inputUid The uid of a `RecordingInput`.\n * @return A `Promise` that is resolved if successful or rejected if not.\n */\n setInput(inputUid: string): void;\n\n /**\n * Status of the current recording.\n */\n getStatus(): RecorderState;\n\n /**\n * Starts the recording at the given time.\n * @param seconds The time in seconds to start recording at.\n * @deprecated Use `record({ atTime: seconds })` instead.\n */\n startRecordingAtTime(seconds: number): void;\n\n /**\n * Prepares the recording for recording.\n */\n prepareToRecordAsync(options?: Partial<RecordingOptions>): Promise<void>;\n\n /**\n * Stops the recording once the specified time has elapsed.\n * @param seconds The time in seconds to stop recording at.\n * @deprecated Use `record({ forDuration: seconds })` instead.\n */\n recordForDuration(seconds: number): void;\n}\n\n/**\n * Event types that an `AudioRecorder` can emit.\n *\n * These events are used internally by `expo-audio` hooks to provide real-time status updates.\n * Use `useAudioRecorderState()` or the `statusListener` parameter in `useAudioRecorder()` instead of subscribing directly.\n */\nexport type RecordingEvents = {\n /** Fired when the recorder's status changes (start/stop/pause/error, and so on). */\n recordingStatusUpdate: (status: RecordingStatus) => void;\n};\n"]}
1
+ {"version":3,"file":"AudioModule.types.js","sourceRoot":"","sources":["../src/AudioModule.types.ts"],"names":[],"mappings":"","sourcesContent":["import { NativeModule, PermissionResponse, SharedObject } from 'expo-modules-core';\n\nimport {\n AudioMode,\n AudioSource,\n AudioStatus,\n PitchCorrectionQuality,\n RecorderState,\n RecordingInput,\n RecordingOptions,\n RecordingStartOptions,\n RecordingStatus,\n} from './Audio.types';\n\n/**\n * @hidden\n */\nexport declare class NativeAudioModule extends NativeModule {\n setIsAudioActiveAsync(active: boolean): Promise<void>;\n setAudioModeAsync(category: Partial<AudioMode>): Promise<void>;\n requestRecordingPermissionsAsync(): Promise<PermissionResponse>;\n getRecordingPermissionsAsync(): Promise<PermissionResponse>;\n\n readonly AudioPlayer: typeof AudioPlayer;\n readonly AudioRecorder: typeof AudioRecorder;\n}\n\nexport declare class AudioPlayer extends SharedObject<AudioEvents> {\n /**\n * Initializes a new audio player instance with the given source.\n * @hidden\n */\n constructor(source: AudioSource, updateInterval: number, keepAudioSessionActive: boolean);\n\n /**\n * Unique identifier for the player object.\n */\n id: number;\n\n /**\n * Boolean value indicating whether the player is currently playing.\n */\n playing: boolean;\n\n /**\n * Boolean value indicating whether the player is currently muted.\n */\n muted: boolean;\n\n /**\n * Boolean value indicating whether the player is currently looping.\n */\n loop: boolean;\n\n /**\n * Boolean value indicating whether the player is currently paused.\n */\n paused: boolean;\n\n /**\n * Boolean value indicating whether the player is finished loading.\n */\n isLoaded: boolean;\n\n /**\n * Boolean value indicating whether audio sampling is supported on the platform.\n */\n isAudioSamplingSupported: boolean;\n\n /**\n * Boolean value indicating whether the player is buffering.\n */\n isBuffering: boolean;\n\n /**\n * The current position through the audio item in seconds.\n */\n currentTime: number;\n\n /**\n * The total duration of the audio in seconds.\n */\n duration: number;\n\n /**\n * The current volume of the audio.\n */\n volume: number;\n\n /**\n * The current playback rate of the audio.\n */\n playbackRate: number;\n\n /**\n * A boolean describing if we are correcting the pitch for a changed rate.\n */\n shouldCorrectPitch: boolean;\n\n /**\n * The current status of the audio player.\n * @hidden\n */\n currentStatus: AudioStatus;\n\n /**\n * Start playing audio.\n */\n play(): void;\n\n /**\n * Pauses the player.\n */\n pause(): void;\n\n /**\n * Replaces the current audio source with a new one.\n */\n replace(source: AudioSource): void;\n\n /**\n * Seeks the playback by the given number of seconds.\n * @param seconds The number of seconds to seek by.\n * @param toleranceMillisBefore The tolerance allowed before the requested seek time, in milliseconds. iOS only.\n * @param toleranceMillisAfter The tolerance allowed after the requested seek time, in milliseconds. iOS only.\n */\n seekTo(\n seconds: number,\n toleranceMillisBefore?: number,\n toleranceMillisAfter?: number\n ): Promise<void>;\n\n /**\n * Sets the current playback rate of the audio.\n * @param rate The playback rate of the audio.\n * @param pitchCorrectionQuality The quality of the pitch correction.\n */\n setPlaybackRate(rate: number, pitchCorrectionQuality?: PitchCorrectionQuality): void;\n\n /**\n *\n * @hidden\n */\n setAudioSamplingEnabled(enabled: boolean): void;\n\n /**\n * Remove the player from memory to free up resources.\n */\n remove(): void;\n}\n\n/**\n * Represents a single audio sample containing waveform data from all audio channels.\n *\n * Audio samples are provided in real-time when audio sampling is enabled on an `AudioPlayer`.\n * Each sample contains the raw PCM audio data for all channels (mono has 1 channel, stereo has 2).\n * This data can be used for audio visualization, analysis, or processing.\n */\nexport type AudioSample = {\n /** Array of audio channels, each containing PCM frame data. Stereo audio will have 2 channels (left/right). */\n channels: AudioSampleChannel[];\n /** Timestamp of this sample relative to the audio track's timeline, in seconds. */\n timestamp: number;\n};\n\n/**\n * Represents audio data for a single channel (for example, left or right in stereo audio).\n *\n * Contains the raw PCM (Pulse Code Modulation) audio frames for this channel.\n * Frame values are normalized between -1.0 and 1.0, where 0 represents silence.\n */\nexport type AudioSampleChannel = {\n /** Array of PCM audio frame values, each between -1.0 and 1.0. */\n frames: number[];\n};\n\n/**\n * Event types that an `AudioPlayer` can emit.\n *\n * These events allow you to listen for changes in playback state and receive real-time audio data.\n * Use `player.addListener()` to subscribe to these events.\n */\nexport type AudioEvents = {\n /** Fired when the player's status changes (play/pause/seek/load and so on.). */\n playbackStatusUpdate(status: AudioStatus): void;\n /** Fired when audio sampling is enabled and new sample data is available. */\n audioSampleUpdate(data: AudioSample): void;\n};\n\nexport declare class AudioRecorder extends SharedObject<RecordingEvents> {\n /**\n * Initializes a new audio recorder instance with the given source.\n * @hidden\n */\n constructor(options: Partial<RecordingOptions>);\n\n /**\n * Unique identifier for the recorder object.\n */\n id: number;\n\n /**\n * The current length of the recording, in seconds.\n */\n currentTime: number;\n\n /**\n * Boolean value indicating whether the recording is in progress.\n */\n isRecording: boolean;\n\n /**\n * The uri of the recording.\n */\n uri: string | null;\n\n /**\n * Starts the recording.\n * @param options Optional recording configuration options.\n */\n record(options?: RecordingStartOptions): void;\n\n /**\n * Stop the recording.\n */\n stop(): Promise<void>;\n\n /**\n * Pause the recording.\n */\n pause(): void;\n\n /**\n * Returns a list of available recording inputs. This method can only be called if the `Recording` has been prepared.\n * @return A `Promise` that is fulfilled with an array of `RecordingInput` objects.\n */\n getAvailableInputs(): RecordingInput[];\n\n /**\n * Returns the currently-selected recording input. This method can only be called if the `Recording` has been prepared.\n * @return A `Promise` that is fulfilled with a `RecordingInput` object.\n */\n getCurrentInput(): Promise<RecordingInput>;\n\n /**\n * Sets the current recording input.\n * @param inputUid The uid of a `RecordingInput`.\n * @return A `Promise` that is resolved if successful or rejected if not.\n */\n setInput(inputUid: string): void;\n\n /**\n * Status of the current recording.\n */\n getStatus(): RecorderState;\n\n /**\n * Starts the recording at the given time.\n * @param seconds The time in seconds to start recording at.\n * @deprecated Use `record({ atTime: seconds })` instead.\n */\n startRecordingAtTime(seconds: number): void;\n\n /**\n * Prepares the recording for recording.\n */\n prepareToRecordAsync(options?: Partial<RecordingOptions>): Promise<void>;\n\n /**\n * Stops the recording once the specified time has elapsed.\n * @param seconds The time in seconds to stop recording at.\n * @deprecated Use `record({ forDuration: seconds })` instead.\n */\n recordForDuration(seconds: number): void;\n}\n\n/**\n * Event types that an `AudioRecorder` can emit.\n *\n * These events are used internally by `expo-audio` hooks to provide real-time status updates.\n * Use `useAudioRecorderState()` or the `statusListener` parameter in `useAudioRecorder()` instead of subscribing directly.\n */\nexport type RecordingEvents = {\n /** Fired when the recorder's status changes (start/stop/pause/error, and so on). */\n recordingStatusUpdate: (status: RecordingStatus) => void;\n};\n"]}
@@ -72,14 +72,14 @@ if (!Platform.isTV || Platform.OS !== 'ios') {
72
72
  * ```
73
73
  */
74
74
  export function useAudioPlayer(source = null, options = {}) {
75
- const { updateInterval = 500, downloadFirst = false } = options;
75
+ const { updateInterval = 500, downloadFirst = false, keepAudioSessionActive = false } = options;
76
76
  // If downloadFirst is true, we don't need to resolve the source, because it will be resolved in the useEffect below.
77
77
  // If downloadFirst is false, we resolve the source here.
78
78
  // we call .replace() in the useEffect below to replace the source with the downloaded one.
79
79
  const initialSource = useMemo(() => {
80
80
  return downloadFirst ? null : resolveSource(source);
81
81
  }, [JSON.stringify(source), downloadFirst]);
82
- const player = useReleasingSharedObject(() => new AudioModule.AudioPlayer(initialSource, updateInterval), [JSON.stringify(initialSource), updateInterval]);
82
+ const player = useReleasingSharedObject(() => new AudioModule.AudioPlayer(initialSource, updateInterval, keepAudioSessionActive), [JSON.stringify(initialSource), updateInterval, keepAudioSessionActive]);
83
83
  // Handle async source resolution for downloadFirst
84
84
  useEffect(() => {
85
85
  if (!downloadFirst || source === null) {
@@ -283,9 +283,9 @@ export function useAudioRecorderState(recorder, interval = 500) {
283
283
  * @param options Audio player configuration options.
284
284
  */
285
285
  export function createAudioPlayer(source = null, options = {}) {
286
- const { updateInterval = 500, downloadFirst = false } = options;
286
+ const { updateInterval = 500, downloadFirst = false, keepAudioSessionActive = false } = options;
287
287
  const initialSource = downloadFirst ? null : resolveSource(source);
288
- const player = new AudioModule.AudioPlayer(initialSource, updateInterval);
288
+ const player = new AudioModule.AudioPlayer(initialSource, updateInterval, keepAudioSessionActive);
289
289
  if (downloadFirst && source) {
290
290
  resolveSourceWithDownload(source)
291
291
  .then((resolved) => {
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoAudio.js","sourceRoot":"","sources":["../src/ExpoAudio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAsB,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAaxC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEjF,4HAA4H;AAC5H,MAAM,OAAO,GAAG,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC;AAC1D,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,GAAG,UAAU,MAAmB;IACvE,OAAO,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC;AAEF,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QAAQ,EAAE,CAAC;gBACb,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC3B,CAAC;QACH,CAAC,CAAC,CAAC;IACP,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAAe;IACzD,OAAO,MAAM,WAAW,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAwB;IAC9D,MAAM,SAAS,GACb,QAAQ,CAAC,EAAE,KAAK,KAAK;QACnB,CAAC,CAAC,IAAI;QACN,CAAC,CAAC;YACE,sBAAsB,EAAE,IAAI,CAAC,sBAAsB;YACnD,0BAA0B,EAAE,IAAI,CAAC,0BAA0B;YAC3D,gBAAgB,EAAE,IAAI,CAAC,uBAAuB;SAC/C,CAAC;IACR,OAAO,MAAM,WAAW,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC;AACxD,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,MAAM,CAAC,KAAK,UAAU,gCAAgC;IACpD,OAAO,MAAM,WAAW,CAAC,gCAAgC,EAAE,CAAC;AAC9D,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,MAAM,CAAC,KAAK,UAAU,4BAA4B;IAChD,OAAO,MAAM,WAAW,CAAC,4BAA4B,EAAE,CAAC;AAC1D,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { useEvent } from 'expo';\nimport { PermissionResponse, useReleasingSharedObject } from 'expo-modules-core';\nimport { useEffect, useState, useMemo } from 'react';\nimport { Platform } from 'react-native';\n\nimport {\n AudioMode,\n AudioPlayerOptions,\n AudioSource,\n AudioStatus,\n PitchCorrectionQuality,\n RecorderState,\n RecordingOptions,\n RecordingStartOptions,\n RecordingStatus,\n} from './Audio.types';\nimport {\n AUDIO_SAMPLE_UPDATE,\n PLAYBACK_STATUS_UPDATE,\n RECORDING_STATUS_UPDATE,\n} from './AudioEventKeys';\nimport AudioModule from './AudioModule';\nimport { AudioPlayer, AudioRecorder, AudioSample } from './AudioModule.types';\nimport { createRecordingOptions } from './utils/options';\nimport { resolveSource, resolveSourceWithDownload } from './utils/resolveSource';\n\n// TODO: Temporary solution until we develop a way of overriding prototypes that won't break the lazy loading of the module.\nconst replace = AudioModule.AudioPlayer.prototype.replace;\nAudioModule.AudioPlayer.prototype.replace = function (source: AudioSource) {\n return replace.call(this, resolveSource(source));\n};\n\nconst setPlaybackRate = AudioModule.AudioPlayer.prototype.setPlaybackRate;\nAudioModule.AudioPlayer.prototype.setPlaybackRate = function (\n rate: number,\n pitchCorrectionQuality?: PitchCorrectionQuality\n) {\n if (Platform.OS === 'android') {\n return setPlaybackRate.call(this, rate);\n } else {\n return setPlaybackRate.call(this, rate, pitchCorrectionQuality);\n }\n};\n\n// Audio recording prototypes should not be shimmed on tvOS, where they do not exist\nif (!Platform.isTV || Platform.OS !== 'ios') {\n const prepareToRecordAsync = AudioModule.AudioRecorder.prototype.prepareToRecordAsync;\n AudioModule.AudioRecorder.prototype.prepareToRecordAsync = function (options?: RecordingOptions) {\n const processedOptions = options ? createRecordingOptions(options) : undefined;\n return prepareToRecordAsync.call(this, processedOptions);\n };\n\n const record = AudioModule.AudioRecorder.prototype.record;\n AudioModule.AudioRecorder.prototype.record = function (options?: RecordingStartOptions) {\n return record.call(this, options);\n };\n}\n\n/**\n * Creates an `AudioPlayer` instance that automatically releases when the component unmounts.\n *\n * This hook manages the player's lifecycle and ensures it's properly disposed when no longer needed.\n * The player will start loading the audio source immediately upon creation.\n *\n * @param source The audio source to load. Can be a local asset via `require()`, a remote URL, or null for no initial source.\n * @param options Audio player configuration options.\n * @returns An `AudioPlayer` instance that's automatically managed by the component lifecycle.\n *\n * @example\n * ```tsx\n * import { useAudioPlayer } from 'expo-audio';\n *\n * function MyComponent() {\n * const player = useAudioPlayer(require('./sound.mp3'));\n *\n * return (\n * <Button title=\"Play\" onPress={() => player.play()} />\n * );\n * }\n * ```\n *\n * @example Using downloadFirst\n * ```tsx\n * import { useAudioPlayer } from 'expo-audio';\n *\n * function MyComponent() {\n * const player = useAudioPlayer('https://example.com/audio.mp3', {\n * updateInterval: 1000,\n * downloadFirst: true,\n * });\n *\n * return (\n * <Button title=\"Play\" onPress={() => player.play()} />\n * );\n * }\n * ```\n */\nexport function useAudioPlayer(\n source: AudioSource = null,\n options: AudioPlayerOptions = {}\n): AudioPlayer {\n const { updateInterval = 500, downloadFirst = false } = options;\n\n // If downloadFirst is true, we don't need to resolve the source, because it will be resolved in the useEffect below.\n // If downloadFirst is false, we resolve the source here.\n // we call .replace() in the useEffect below to replace the source with the downloaded one.\n const initialSource = useMemo(() => {\n return downloadFirst ? null : resolveSource(source);\n }, [JSON.stringify(source), downloadFirst]);\n\n const player = useReleasingSharedObject(\n () => new AudioModule.AudioPlayer(initialSource, updateInterval),\n [JSON.stringify(initialSource), updateInterval]\n );\n\n // Handle async source resolution for downloadFirst\n useEffect(() => {\n if (!downloadFirst || source === null) {\n return;\n }\n\n let isCancelled = false;\n\n // We resolve the source with expo-asset and replace the player's source with the downloaded one.\n async function resolveAndReplaceSource() {\n try {\n const resolved = await resolveSourceWithDownload(source);\n\n if (\n !isCancelled &&\n resolved &&\n JSON.stringify(resolved) !== JSON.stringify(initialSource)\n ) {\n player.replace(resolved);\n }\n } catch (error) {\n if (!isCancelled) {\n console.warn('expo-audio: Failed to download source, using original:', error);\n }\n }\n }\n\n resolveAndReplaceSource();\n\n return () => {\n isCancelled = true;\n };\n }, [player, JSON.stringify(source), downloadFirst]);\n\n return player;\n}\n\n/**\n * Hook that provides real-time playback status updates for an `AudioPlayer`.\n *\n * This hook automatically subscribes to playback status changes and returns the current status.\n * The status includes information about playback state, current time, duration, loading state, and more.\n *\n * @param player The `AudioPlayer` instance to monitor.\n * @returns The current `AudioStatus` object containing playback information.\n *\n * @example\n * ```tsx\n * import { useAudioPlayer, useAudioPlayerStatus } from 'expo-audio';\n *\n * function PlayerComponent() {\n * const player = useAudioPlayer(require('./sound.mp3'));\n * const status = useAudioPlayerStatus(player);\n *\n * return (\n * <View>\n * <Text>Playing: {status.isPlaying ? 'Yes' : 'No'}</Text>\n * <Text>Current Time: {status.currentTime}s</Text>\n * <Text>Duration: {status.duration}s</Text>\n * </View>\n * );\n * }\n * ```\n */\nexport function useAudioPlayerStatus(player: AudioPlayer): AudioStatus {\n const currentStatus = useMemo(() => player.currentStatus, [player.id]);\n return useEvent(player, PLAYBACK_STATUS_UPDATE, currentStatus);\n}\n\n/**\n * Hook that sets up audio sampling for an `AudioPlayer` and calls a listener with audio data.\n *\n * This hook enables audio sampling on the player (if supported) and subscribes to audio sample updates.\n * Audio sampling provides real-time access to audio waveform data for visualization or analysis.\n *\n * > **Note:** Audio sampling requires `RECORD_AUDIO` permission on Android and is not supported on all platforms.\n *\n * @param player The `AudioPlayer` instance to sample audio from.\n * @param listener Function called with each audio sample containing waveform data.\n *\n * @example\n * ```tsx\n * import { useAudioPlayer, useAudioSampleListener } from 'expo-audio';\n *\n * function AudioVisualizerComponent() {\n * const player = useAudioPlayer(require('./music.mp3'));\n *\n * useAudioSampleListener(player, (sample) => {\n * // Use sample.channels array for audio visualization\n * console.log('Audio sample:', sample.channels[0].frames);\n * });\n *\n * return <AudioWaveform player={player} />;\n * }\n * ```\n */\nexport function useAudioSampleListener(player: AudioPlayer, listener: (data: AudioSample) => void) {\n useEffect(() => {\n if (!player.isAudioSamplingSupported) {\n return;\n }\n player.setAudioSamplingEnabled(true);\n const subscription = player.addListener(AUDIO_SAMPLE_UPDATE, listener);\n return () => subscription.remove();\n }, [player.id]);\n}\n\n/**\n * Hook that creates an `AudioRecorder` instance for recording audio.\n *\n * This hook manages the recorder's lifecycle and ensures it's properly disposed when no longer needed.\n * The recorder is automatically prepared with the provided options and can be used to record audio.\n *\n * @param options Recording configuration options including format, quality, sample rate, etc.\n * @param statusListener Optional callback function that receives recording status updates.\n * @returns An `AudioRecorder` instance that's automatically managed by the component lifecycle.\n *\n * @example\n * ```tsx\n * import { useAudioRecorder, RecordingPresets } from 'expo-audio';\n *\n * function RecorderComponent() {\n * const recorder = useAudioRecorder(\n * RecordingPresets.HIGH_QUALITY,\n * (status) => console.log('Recording status:', status)\n * );\n *\n * const startRecording = async () => {\n * await recorder.prepareToRecordAsync();\n * recorder.record();\n * };\n *\n * return (\n * <Button title=\"Start Recording\" onPress={startRecording} />\n * );\n * }\n * ```\n */\nexport function useAudioRecorder(\n options: RecordingOptions,\n statusListener?: (status: RecordingStatus) => void\n): AudioRecorder {\n const platformOptions = createRecordingOptions(options);\n const recorder = useReleasingSharedObject(() => {\n return new AudioModule.AudioRecorder(platformOptions);\n }, [JSON.stringify(platformOptions)]);\n\n useEffect(() => {\n const subscription = recorder.addListener(RECORDING_STATUS_UPDATE, (status) => {\n statusListener?.(status);\n });\n return () => subscription.remove();\n }, [recorder.id]);\n\n return recorder;\n}\n\n/**\n * Hook that provides real-time recording state updates for an `AudioRecorder`.\n *\n * This hook polls the recorder's status at regular intervals and returns the current recording state.\n * Use this when you need to monitor the recording status without setting up a status listener.\n *\n * @param recorder The `AudioRecorder` instance to monitor.\n * @param interval How often (in milliseconds) to poll the recorder's status. Defaults to 500ms.\n * @returns The current `RecorderState` containing recording information.\n *\n * @example\n * ```tsx\n * import { useAudioRecorder, useAudioRecorderState, RecordingPresets } from 'expo-audio';\n *\n * function RecorderStatusComponent() {\n * const recorder = useAudioRecorder(RecordingPresets.HIGH_QUALITY);\n * const state = useAudioRecorderState(recorder);\n *\n * return (\n * <View>\n * <Text>Recording: {state.isRecording ? 'Yes' : 'No'}</Text>\n * <Text>Duration: {state.currentTime}s</Text>\n * <Text>Can Record: {state.canRecord ? 'Yes' : 'No'}</Text>\n * </View>\n * );\n * }\n * ```\n */\nexport function useAudioRecorderState(recorder: AudioRecorder, interval: number = 500) {\n const [state, setState] = useState<RecorderState>(recorder.getStatus());\n\n useEffect(() => {\n const int = setInterval(() => {\n const newState = recorder.getStatus();\n\n setState((prevState) => {\n const meteringChanged =\n (prevState.metering === undefined) !== (newState.metering === undefined) ||\n (prevState.metering !== undefined &&\n newState.metering !== undefined &&\n Math.abs(prevState.metering - newState.metering) > 0.1);\n\n if (\n prevState.canRecord !== newState.canRecord ||\n prevState.isRecording !== newState.isRecording ||\n prevState.mediaServicesDidReset !== newState.mediaServicesDidReset ||\n prevState.url !== newState.url ||\n Math.abs(prevState.durationMillis - newState.durationMillis) > 50 ||\n meteringChanged\n ) {\n return newState;\n }\n return prevState;\n });\n }, interval);\n\n return () => clearInterval(int);\n }, [recorder.id]);\n\n return state;\n}\n\n/**\n * Creates an instance of an `AudioPlayer` that doesn't release automatically.\n *\n * > **info** For most use cases you should use the [`useAudioPlayer`](#useaudioplayer) hook instead.\n * > See the [Using the `AudioPlayer` directly](#using-the-audioplayer-directly) section for more details.\n * @param source The audio source to load.\n * @param options Audio player configuration options.\n */\nexport function createAudioPlayer(\n source: AudioSource | string | number | null = null,\n options: AudioPlayerOptions = {}\n): AudioPlayer {\n const { updateInterval = 500, downloadFirst = false } = options;\n const initialSource = downloadFirst ? null : resolveSource(source);\n const player = new AudioModule.AudioPlayer(initialSource, updateInterval);\n\n if (downloadFirst && source) {\n resolveSourceWithDownload(source)\n .then((resolved) => {\n if (resolved) {\n player.replace(resolved);\n }\n })\n .catch((error) => {\n console.warn('expo-audio: Failed to download source, using fallback:', error);\n const fallback = resolveSource(source);\n if (fallback) {\n player.replace(fallback);\n }\n });\n }\n\n return player;\n}\n\n/**\n * Enables or disables the audio subsystem globally.\n *\n * When set to `false`, this will pause all audio playback and prevent new audio from playing.\n * This is useful for implementing app-wide audio controls or responding to system events.\n *\n * @param active Whether audio should be active (`true`) or disabled (`false`).\n * @returns A Promise that resolves when the audio state has been updated.\n *\n * @example\n * ```tsx\n * import { setIsAudioActiveAsync } from 'expo-audio';\n *\n * // Disable all audio when app goes to background\n * const handleAppStateChange = async (nextAppState) => {\n * if (nextAppState === 'background') {\n * await setIsAudioActiveAsync(false);\n * } else if (nextAppState === 'active') {\n * await setIsAudioActiveAsync(true);\n * }\n * };\n * ```\n */\nexport async function setIsAudioActiveAsync(active: boolean): Promise<void> {\n return await AudioModule.setIsAudioActiveAsync(active);\n}\n\n/**\n * Configures the global audio behavior and session settings.\n *\n * This function allows you to control how your app's audio interacts with other apps,\n * background playback behavior, audio routing, and interruption handling.\n *\n * @param mode Partial audio mode configuration object. Only specified properties will be updated.\n * @returns A Promise that resolves when the audio mode has been applied.\n *\n * @example\n * ```tsx\n * import { setAudioModeAsync } from 'expo-audio';\n *\n * // Configure audio for background playback\n * await setAudioModeAsync({\n * playsInSilentMode: true,\n * shouldPlayInBackground: true,\n * interruptionModeAndroid: 'duckOthers',\n * interruptionMode: 'mixWithOthers'\n * });\n *\n * // Configure audio for recording\n * await setAudioModeAsync({\n * allowsRecording: true,\n * playsInSilentMode: false\n * });\n * ```\n */\nexport async function setAudioModeAsync(mode: Partial<AudioMode>): Promise<void> {\n const audioMode: Partial<AudioMode> =\n Platform.OS === 'ios'\n ? mode\n : {\n shouldPlayInBackground: mode.shouldPlayInBackground,\n shouldRouteThroughEarpiece: mode.shouldRouteThroughEarpiece,\n interruptionMode: mode.interruptionModeAndroid,\n };\n return await AudioModule.setAudioModeAsync(audioMode);\n}\n\n/**\n * Requests permission to record audio from the microphone.\n *\n * This function prompts the user for microphone access permission, which is required\n * for audio recording functionality. On iOS, this will show the system permission dialog.\n * On Android, this requests the `RECORD_AUDIO` permission.\n *\n * @returns A Promise that resolves to a `PermissionResponse` object containing the permission status.\n *\n * @example\n * ```tsx\n * import { requestRecordingPermissionsAsync } from 'expo-audio';\n *\n * const checkPermissions = async () => {\n * const { status, granted } = await requestRecordingPermissionsAsync();\n *\n * if (granted) {\n * console.log('Recording permission granted');\n * } else {\n * console.log('Recording permission denied:', status);\n * }\n * };\n * ```\n */\nexport async function requestRecordingPermissionsAsync(): Promise<PermissionResponse> {\n return await AudioModule.requestRecordingPermissionsAsync();\n}\n\n/**\n * Checks the current status of recording permissions without requesting them.\n *\n * This function returns the current permission status for microphone access\n * without triggering a permission request dialog. Use this to check permissions\n * before deciding whether to call `requestRecordingPermissionsAsync()`.\n *\n * @returns A Promise that resolves to a `PermissionResponse` object containing the current permission status.\n *\n * @example\n * ```tsx\n * import { getRecordingPermissionsAsync, requestRecordingPermissionsAsync } from 'expo-audio';\n *\n * const ensureRecordingPermissions = async () => {\n * const { status } = await getRecordingPermissionsAsync();\n *\n * if (status !== 'granted') {\n * // Permission not granted, request it\n * const { granted } = await requestRecordingPermissionsAsync();\n * return granted;\n * }\n *\n * return true; // Already granted\n * };\n * ```\n */\nexport async function getRecordingPermissionsAsync(): Promise<PermissionResponse> {\n return await AudioModule.getRecordingPermissionsAsync();\n}\n\nexport { AudioModule };\n"]}
1
+ {"version":3,"file":"ExpoAudio.js","sourceRoot":"","sources":["../src/ExpoAudio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAsB,wBAAwB,EAAE,MAAM,mBAAmB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACrD,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAaxC,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,uBAAuB,GACxB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,WAAW,MAAM,eAAe,CAAC;AAExC,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,yBAAyB,EAAE,MAAM,uBAAuB,CAAC;AAEjF,4HAA4H;AAC5H,MAAM,OAAO,GAAG,WAAW,CAAC,WAAW,CAAC,SAAS,CAAC,OAAO,CAAC;AA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A4B,EAAE,CAAC;AAC1D,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { useEvent } from 'expo';\nimport { PermissionResponse, useReleasingSharedObject } from 'expo-modules-core';\nimport { useEffect, useState, useMemo } from 'react';\nimport { Platform } from 'react-native';\n\nimport {\n AudioMode,\n AudioPlayerOptions,\n AudioSource,\n AudioStatus,\n PitchCorrectionQuality,\n RecorderState,\n RecordingOptions,\n RecordingStartOptions,\n RecordingStatus,\n} from './Audio.types';\nimport {\n AUDIO_SAMPLE_UPDATE,\n PLAYBACK_STATUS_UPDATE,\n RECORDING_STATUS_UPDATE,\n} from './AudioEventKeys';\nimport AudioModule from './AudioModule';\nimport { AudioPlayer, AudioRecorder, AudioSample } from './AudioModule.types';\nimport { createRecordingOptions } from './utils/options';\nimport { resolveSource, resolveSourceWithDownload } from './utils/resolveSource';\n\n// TODO: Temporary solution until we develop a way of overriding prototypes that won't break the lazy loading of the module.\nconst replace = AudioModule.AudioPlayer.prototype.replace;\nAudioModule.AudioPlayer.prototype.replace = function (source: AudioSource) {\n return replace.call(this, resolveSource(source));\n};\n\nconst setPlaybackRate = AudioModule.AudioPlayer.prototype.setPlaybackRate;\nAudioModule.AudioPlayer.prototype.setPlaybackRate = function (\n rate: number,\n pitchCorrectionQuality?: PitchCorrectionQuality\n) {\n if (Platform.OS === 'android') {\n return setPlaybackRate.call(this, rate);\n } else {\n return setPlaybackRate.call(this, rate, pitchCorrectionQuality);\n }\n};\n\n// Audio recording prototypes should not be shimmed on tvOS, where they do not exist\nif (!Platform.isTV || Platform.OS !== 'ios') {\n const prepareToRecordAsync = AudioModule.AudioRecorder.prototype.prepareToRecordAsync;\n AudioModule.AudioRecorder.prototype.prepareToRecordAsync = function (options?: RecordingOptions) {\n const processedOptions = options ? createRecordingOptions(options) : undefined;\n return prepareToRecordAsync.call(this, processedOptions);\n };\n\n const record = AudioModule.AudioRecorder.prototype.record;\n AudioModule.AudioRecorder.prototype.record = function (options?: RecordingStartOptions) {\n return record.call(this, options);\n };\n}\n\n/**\n * Creates an `AudioPlayer` instance that automatically releases when the component unmounts.\n *\n * This hook manages the player's lifecycle and ensures it's properly disposed when no longer needed.\n * The player will start loading the audio source immediately upon creation.\n *\n * @param source The audio source to load. Can be a local asset via `require()`, a remote URL, or null for no initial source.\n * @param options Audio player configuration options.\n * @returns An `AudioPlayer` instance that's automatically managed by the component lifecycle.\n *\n * @example\n * ```tsx\n * import { useAudioPlayer } from 'expo-audio';\n *\n * function MyComponent() {\n * const player = useAudioPlayer(require('./sound.mp3'));\n *\n * return (\n * <Button title=\"Play\" onPress={() => player.play()} />\n * );\n * }\n * ```\n *\n * @example Using downloadFirst\n * ```tsx\n * import { useAudioPlayer } from 'expo-audio';\n *\n * function MyComponent() {\n * const player = useAudioPlayer('https://example.com/audio.mp3', {\n * updateInterval: 1000,\n * downloadFirst: true,\n * });\n *\n * return (\n * <Button title=\"Play\" onPress={() => player.play()} />\n * );\n * }\n * ```\n */\nexport function useAudioPlayer(\n source: AudioSource = null,\n options: AudioPlayerOptions = {}\n): AudioPlayer {\n const { updateInterval = 500, downloadFirst = false, keepAudioSessionActive = false } = options;\n\n // If downloadFirst is true, we don't need to resolve the source, because it will be resolved in the useEffect below.\n // If downloadFirst is false, we resolve the source here.\n // we call .replace() in the useEffect below to replace the source with the downloaded one.\n const initialSource = useMemo(() => {\n return downloadFirst ? null : resolveSource(source);\n }, [JSON.stringify(source), downloadFirst]);\n\n const player = useReleasingSharedObject(\n () => new AudioModule.AudioPlayer(initialSource, updateInterval, keepAudioSessionActive),\n [JSON.stringify(initialSource), updateInterval, keepAudioSessionActive]\n );\n\n // Handle async source resolution for downloadFirst\n useEffect(() => {\n if (!downloadFirst || source === null) {\n return;\n }\n\n let isCancelled = false;\n\n // We resolve the source with expo-asset and replace the player's source with the downloaded one.\n async function resolveAndReplaceSource() {\n try {\n const resolved = await resolveSourceWithDownload(source);\n\n if (\n !isCancelled &&\n resolved &&\n JSON.stringify(resolved) !== JSON.stringify(initialSource)\n ) {\n player.replace(resolved);\n }\n } catch (error) {\n if (!isCancelled) {\n console.warn('expo-audio: Failed to download source, using original:', error);\n }\n }\n }\n\n resolveAndReplaceSource();\n\n return () => {\n isCancelled = true;\n };\n }, [player, JSON.stringify(source), downloadFirst]);\n\n return player;\n}\n\n/**\n * Hook that provides real-time playback status updates for an `AudioPlayer`.\n *\n * This hook automatically subscribes to playback status changes and returns the current status.\n * The status includes information about playback state, current time, duration, loading state, and more.\n *\n * @param player The `AudioPlayer` instance to monitor.\n * @returns The current `AudioStatus` object containing playback information.\n *\n * @example\n * ```tsx\n * import { useAudioPlayer, useAudioPlayerStatus } from 'expo-audio';\n *\n * function PlayerComponent() {\n * const player = useAudioPlayer(require('./sound.mp3'));\n * const status = useAudioPlayerStatus(player);\n *\n * return (\n * <View>\n * <Text>Playing: {status.isPlaying ? 'Yes' : 'No'}</Text>\n * <Text>Current Time: {status.currentTime}s</Text>\n * <Text>Duration: {status.duration}s</Text>\n * </View>\n * );\n * }\n * ```\n */\nexport function useAudioPlayerStatus(player: AudioPlayer): AudioStatus {\n const currentStatus = useMemo(() => player.currentStatus, [player.id]);\n return useEvent(player, PLAYBACK_STATUS_UPDATE, currentStatus);\n}\n\n/**\n * Hook that sets up audio sampling for an `AudioPlayer` and calls a listener with audio data.\n *\n * This hook enables audio sampling on the player (if supported) and subscribes to audio sample updates.\n * Audio sampling provides real-time access to audio waveform data for visualization or analysis.\n *\n * > **Note:** Audio sampling requires `RECORD_AUDIO` permission on Android and is not supported on all platforms.\n *\n * @param player The `AudioPlayer` instance to sample audio from.\n * @param listener Function called with each audio sample containing waveform data.\n *\n * @example\n * ```tsx\n * import { useAudioPlayer, useAudioSampleListener } from 'expo-audio';\n *\n * function AudioVisualizerComponent() {\n * const player = useAudioPlayer(require('./music.mp3'));\n *\n * useAudioSampleListener(player, (sample) => {\n * // Use sample.channels array for audio visualization\n * console.log('Audio sample:', sample.channels[0].frames);\n * });\n *\n * return <AudioWaveform player={player} />;\n * }\n * ```\n */\nexport function useAudioSampleListener(player: AudioPlayer, listener: (data: AudioSample) => void) {\n useEffect(() => {\n if (!player.isAudioSamplingSupported) {\n return;\n }\n player.setAudioSamplingEnabled(true);\n const subscription = player.addListener(AUDIO_SAMPLE_UPDATE, listener);\n return () => subscription.remove();\n }, [player.id]);\n}\n\n/**\n * Hook that creates an `AudioRecorder` instance for recording audio.\n *\n * This hook manages the recorder's lifecycle and ensures it's properly disposed when no longer needed.\n * The recorder is automatically prepared with the provided options and can be used to record audio.\n *\n * @param options Recording configuration options including format, quality, sample rate, etc.\n * @param statusListener Optional callback function that receives recording status updates.\n * @returns An `AudioRecorder` instance that's automatically managed by the component lifecycle.\n *\n * @example\n * ```tsx\n * import { useAudioRecorder, RecordingPresets } from 'expo-audio';\n *\n * function RecorderComponent() {\n * const recorder = useAudioRecorder(\n * RecordingPresets.HIGH_QUALITY,\n * (status) => console.log('Recording status:', status)\n * );\n *\n * const startRecording = async () => {\n * await recorder.prepareToRecordAsync();\n * recorder.record();\n * };\n *\n * return (\n * <Button title=\"Start Recording\" onPress={startRecording} />\n * );\n * }\n * ```\n */\nexport function useAudioRecorder(\n options: RecordingOptions,\n statusListener?: (status: RecordingStatus) => void\n): AudioRecorder {\n const platformOptions = createRecordingOptions(options);\n const recorder = useReleasingSharedObject(() => {\n return new AudioModule.AudioRecorder(platformOptions);\n }, [JSON.stringify(platformOptions)]);\n\n useEffect(() => {\n const subscription = recorder.addListener(RECORDING_STATUS_UPDATE, (status) => {\n statusListener?.(status);\n });\n return () => subscription.remove();\n }, [recorder.id]);\n\n return recorder;\n}\n\n/**\n * Hook that provides real-time recording state updates for an `AudioRecorder`.\n *\n * This hook polls the recorder's status at regular intervals and returns the current recording state.\n * Use this when you need to monitor the recording status without setting up a status listener.\n *\n * @param recorder The `AudioRecorder` instance to monitor.\n * @param interval How often (in milliseconds) to poll the recorder's status. Defaults to 500ms.\n * @returns The current `RecorderState` containing recording information.\n *\n * @example\n * ```tsx\n * import { useAudioRecorder, useAudioRecorderState, RecordingPresets } from 'expo-audio';\n *\n * function RecorderStatusComponent() {\n * const recorder = useAudioRecorder(RecordingPresets.HIGH_QUALITY);\n * const state = useAudioRecorderState(recorder);\n *\n * return (\n * <View>\n * <Text>Recording: {state.isRecording ? 'Yes' : 'No'}</Text>\n * <Text>Duration: {state.currentTime}s</Text>\n * <Text>Can Record: {state.canRecord ? 'Yes' : 'No'}</Text>\n * </View>\n * );\n * }\n * ```\n */\nexport function useAudioRecorderState(recorder: AudioRecorder, interval: number = 500) {\n const [state, setState] = useState<RecorderState>(recorder.getStatus());\n\n useEffect(() => {\n const int = setInterval(() => {\n const newState = recorder.getStatus();\n\n setState((prevState) => {\n const meteringChanged =\n (prevState.metering === undefined) !== (newState.metering === undefined) ||\n (prevState.metering !== undefined &&\n newState.metering !== undefined &&\n Math.abs(prevState.metering - newState.metering) > 0.1);\n\n if (\n prevState.canRecord !== newState.canRecord ||\n prevState.isRecording !== newState.isRecording ||\n prevState.mediaServicesDidReset !== newState.mediaServicesDidReset ||\n prevState.url !== newState.url ||\n Math.abs(prevState.durationMillis - newState.durationMillis) > 50 ||\n meteringChanged\n ) {\n return newState;\n }\n return prevState;\n });\n }, interval);\n\n return () => clearInterval(int);\n }, [recorder.id]);\n\n return state;\n}\n\n/**\n * Creates an instance of an `AudioPlayer` that doesn't release automatically.\n *\n * > **info** For most use cases you should use the [`useAudioPlayer`](#useaudioplayer) hook instead.\n * > See the [Using the `AudioPlayer` directly](#using-the-audioplayer-directly) section for more details.\n * @param source The audio source to load.\n * @param options Audio player configuration options.\n */\nexport function createAudioPlayer(\n source: AudioSource | string | number | null = null,\n options: AudioPlayerOptions = {}\n): AudioPlayer {\n const { updateInterval = 500, downloadFirst = false, keepAudioSessionActive = false } = options;\n const initialSource = downloadFirst ? null : resolveSource(source);\n const player = new AudioModule.AudioPlayer(initialSource, updateInterval, keepAudioSessionActive);\n\n if (downloadFirst && source) {\n resolveSourceWithDownload(source)\n .then((resolved) => {\n if (resolved) {\n player.replace(resolved);\n }\n })\n .catch((error) => {\n console.warn('expo-audio: Failed to download source, using fallback:', error);\n const fallback = resolveSource(source);\n if (fallback) {\n player.replace(fallback);\n }\n });\n }\n\n return player;\n}\n\n/**\n * Enables or disables the audio subsystem globally.\n *\n * When set to `false`, this will pause all audio playback and prevent new audio from playing.\n * This is useful for implementing app-wide audio controls or responding to system events.\n *\n * @param active Whether audio should be active (`true`) or disabled (`false`).\n * @returns A Promise that resolves when the audio state has been updated.\n *\n * @example\n * ```tsx\n * import { setIsAudioActiveAsync } from 'expo-audio';\n *\n * // Disable all audio when app goes to background\n * const handleAppStateChange = async (nextAppState) => {\n * if (nextAppState === 'background') {\n * await setIsAudioActiveAsync(false);\n * } else if (nextAppState === 'active') {\n * await setIsAudioActiveAsync(true);\n * }\n * };\n * ```\n */\nexport async function setIsAudioActiveAsync(active: boolean): Promise<void> {\n return await AudioModule.setIsAudioActiveAsync(active);\n}\n\n/**\n * Configures the global audio behavior and session settings.\n *\n * This function allows you to control how your app's audio interacts with other apps,\n * background playback behavior, audio routing, and interruption handling.\n *\n * @param mode Partial audio mode configuration object. Only specified properties will be updated.\n * @returns A Promise that resolves when the audio mode has been applied.\n *\n * @example\n * ```tsx\n * import { setAudioModeAsync } from 'expo-audio';\n *\n * // Configure audio for background playback\n * await setAudioModeAsync({\n * playsInSilentMode: true,\n * shouldPlayInBackground: true,\n * interruptionModeAndroid: 'duckOthers',\n * interruptionMode: 'mixWithOthers'\n * });\n *\n * // Configure audio for recording\n * await setAudioModeAsync({\n * allowsRecording: true,\n * playsInSilentMode: false\n * });\n * ```\n */\nexport async function setAudioModeAsync(mode: Partial<AudioMode>): Promise<void> {\n const audioMode: Partial<AudioMode> =\n Platform.OS === 'ios'\n ? mode\n : {\n shouldPlayInBackground: mode.shouldPlayInBackground,\n shouldRouteThroughEarpiece: mode.shouldRouteThroughEarpiece,\n interruptionMode: mode.interruptionModeAndroid,\n };\n return await AudioModule.setAudioModeAsync(audioMode);\n}\n\n/**\n * Requests permission to record audio from the microphone.\n *\n * This function prompts the user for microphone access permission, which is required\n * for audio recording functionality. On iOS, this will show the system permission dialog.\n * On Android, this requests the `RECORD_AUDIO` permission.\n *\n * @returns A Promise that resolves to a `PermissionResponse` object containing the permission status.\n *\n * @example\n * ```tsx\n * import { requestRecordingPermissionsAsync } from 'expo-audio';\n *\n * const checkPermissions = async () => {\n * const { status, granted } = await requestRecordingPermissionsAsync();\n *\n * if (granted) {\n * console.log('Recording permission granted');\n * } else {\n * console.log('Recording permission denied:', status);\n * }\n * };\n * ```\n */\nexport async function requestRecordingPermissionsAsync(): Promise<PermissionResponse> {\n return await AudioModule.requestRecordingPermissionsAsync();\n}\n\n/**\n * Checks the current status of recording permissions without requesting them.\n *\n * This function returns the current permission status for microphone access\n * without triggering a permission request dialog. Use this to check permissions\n * before deciding whether to call `requestRecordingPermissionsAsync()`.\n *\n * @returns A Promise that resolves to a `PermissionResponse` object containing the current permission status.\n *\n * @example\n * ```tsx\n * import { getRecordingPermissionsAsync, requestRecordingPermissionsAsync } from 'expo-audio';\n *\n * const ensureRecordingPermissions = async () => {\n * const { status } = await getRecordingPermissionsAsync();\n *\n * if (status !== 'granted') {\n * // Permission not granted, request it\n * const { granted } = await requestRecordingPermissionsAsync();\n * return granted;\n * }\n *\n * return true; // Already granted\n * };\n * ```\n */\nexport async function getRecordingPermissionsAsync(): Promise<PermissionResponse> {\n return await AudioModule.getRecordingPermissionsAsync();\n}\n\nexport { AudioModule };\n"]}
@@ -8,7 +8,7 @@
8
8
  "publication": {
9
9
  "groupId": "expo.modules.audio",
10
10
  "artifactId": "expo.modules.audio",
11
- "version": "1.0.6",
11
+ "version": "1.0.8",
12
12
  "repository": "local-maven-repo"
13
13
  }
14
14
  }
@@ -77,12 +77,15 @@ public class AudioModule: Module {
77
77
 
78
78
  // swiftlint:disable:next closure_body_length
79
79
  Class(AudioPlayer.self) {
80
- Constructor { (source: AudioSource?, updateInterval: Double) -> AudioPlayer in
80
+ Constructor { (source: AudioSource?, updateInterval: Double, keepAudioSessionActive: Bool) -> AudioPlayer in
81
81
  let avPlayer = AudioUtils.createAVPlayer(from: source)
82
82
  let player = AudioPlayer(avPlayer, interval: updateInterval)
83
83
  player.owningRegistry = self.registry
84
+ player.keepAudioSessionActive = keepAudioSessionActive
84
85
  player.onPlaybackComplete = { [weak self] in
85
- self?.deactivateSession()
86
+ if !keepAudioSessionActive {
87
+ self?.deactivateSession()
88
+ }
86
89
  }
87
90
  self.registry.add(player)
88
91
  return player
@@ -182,7 +185,9 @@ public class AudioModule: Module {
182
185
 
183
186
  Function("pause") { player in
184
187
  player.ref.pause()
185
- deactivateSession()
188
+ if !player.keepAudioSessionActive {
189
+ deactivateSession()
190
+ }
186
191
  }
187
192
 
188
193
  Function("remove") { player in
@@ -18,6 +18,7 @@ public class AudioPlayer: SharedRef<AVPlayer> {
18
18
  ref.rate == 0.0
19
19
  }
20
20
  var samplingEnabled = false
21
+ var keepAudioSessionActive = false
21
22
 
22
23
  // MARK: Observers
23
24
  private var timeToken: Any?
@@ -0,0 +1 @@
1
+ caf8ac9e00d60620ad5406dea94ae3865cc7b9aca65ade0a4239b84048adf494
@@ -0,0 +1 @@
1
+ 071848199cd4a94d3ba77e7d173daa7888e1f87f9c3a0c8e260bc3dffdd91b785511c8bad75eeeb2e7d91a5f1a590b3ed12afe49cbe7792761d65c450ac91ba7
@@ -0,0 +1 @@
1
+ 4d1a4e8b0f4c72e56a4bb3c6290ee78aedafaff3
@@ -0,0 +1 @@
1
+ abb37dd839e29011c906ae2ee8486955e9b2a1eeeb38f474691ed35e7ccd5199
@@ -0,0 +1 @@
1
+ 5690f7de0ddfec039106d58b7386a71819c96c5210b89c2fc7b6ea2523b346b0cfd7ab7cc1dd91326f29268f9a5007c2a181e18d67588d97af2a0ef44d137cfd
@@ -3,7 +3,7 @@
3
3
  "component": {
4
4
  "group": "expo.modules.audio",
5
5
  "module": "expo.modules.audio",
6
- "version": "1.0.6",
6
+ "version": "1.0.8",
7
7
  "attributes": {
8
8
  "org.gradle.status": "release"
9
9
  }
@@ -24,13 +24,13 @@
24
24
  },
25
25
  "files": [
26
26
  {
27
- "name": "expo.modules.audio-1.0.6.aar",
28
- "url": "expo.modules.audio-1.0.6.aar",
29
- "size": 209112,
30
- "sha512": "3671356caa6ec10b30405e7321ceccf5c75341ea1053aac35ce7fe63815b1fd74247fd63301b929622faef66b8694dcd18e375a7ae2fcfcc0d2a131a1a3b5cf6",
31
- "sha256": "7ae65099bf929c11afa62540b81bd0c64149e77f563742d1658d7cf66c3e1e58",
32
- "sha1": "92aad35d45bfe43545a12ec627dfb3bd5cb33865",
33
- "md5": "d532db6de5a366040e5451f34fc5648d"
27
+ "name": "expo.modules.audio-1.0.8.aar",
28
+ "url": "expo.modules.audio-1.0.8.aar",
29
+ "size": 210085,
30
+ "sha512": "5690f7de0ddfec039106d58b7386a71819c96c5210b89c2fc7b6ea2523b346b0cfd7ab7cc1dd91326f29268f9a5007c2a181e18d67588d97af2a0ef44d137cfd",
31
+ "sha256": "abb37dd839e29011c906ae2ee8486955e9b2a1eeeb38f474691ed35e7ccd5199",
32
+ "sha1": "4d1a4e8b0f4c72e56a4bb3c6290ee78aedafaff3",
33
+ "md5": "206298fcd2c19a9bcf7106a4165a8941"
34
34
  }
35
35
  ]
36
36
  },
@@ -95,13 +95,13 @@
95
95
  ],
96
96
  "files": [
97
97
  {
98
- "name": "expo.modules.audio-1.0.6.aar",
99
- "url": "expo.modules.audio-1.0.6.aar",
100
- "size": 209112,
101
- "sha512": "3671356caa6ec10b30405e7321ceccf5c75341ea1053aac35ce7fe63815b1fd74247fd63301b929622faef66b8694dcd18e375a7ae2fcfcc0d2a131a1a3b5cf6",
102
- "sha256": "7ae65099bf929c11afa62540b81bd0c64149e77f563742d1658d7cf66c3e1e58",
103
- "sha1": "92aad35d45bfe43545a12ec627dfb3bd5cb33865",
104
- "md5": "d532db6de5a366040e5451f34fc5648d"
98
+ "name": "expo.modules.audio-1.0.8.aar",
99
+ "url": "expo.modules.audio-1.0.8.aar",
100
+ "size": 210085,
101
+ "sha512": "5690f7de0ddfec039106d58b7386a71819c96c5210b89c2fc7b6ea2523b346b0cfd7ab7cc1dd91326f29268f9a5007c2a181e18d67588d97af2a0ef44d137cfd",
102
+ "sha256": "abb37dd839e29011c906ae2ee8486955e9b2a1eeeb38f474691ed35e7ccd5199",
103
+ "sha1": "4d1a4e8b0f4c72e56a4bb3c6290ee78aedafaff3",
104
+ "md5": "206298fcd2c19a9bcf7106a4165a8941"
105
105
  }
106
106
  ]
107
107
  },
@@ -115,13 +115,13 @@
115
115
  },
116
116
  "files": [
117
117
  {
118
- "name": "expo.modules.audio-1.0.6-sources.jar",
119
- "url": "expo.modules.audio-1.0.6-sources.jar",
120
- "size": 13095,
121
- "sha512": "692cc735d375aa36d94c1119e528c01421c1e204fe5dc3fd6049b7d29113d90130ab55577c12b8811e35fa12f7b20b7bed9daa38d1b70ac80c7238b62b0bcce3",
122
- "sha256": "3b41eabbf5383b027d7f364c3c21cae258c98356355332c703ad81c994a65ac0",
123
- "sha1": "13ff70202f0f707366029ea98c4b9b2ecd556c8a",
124
- "md5": "00917469c2f0fbfd7ecdc636b1e54e40"
118
+ "name": "expo.modules.audio-1.0.8-sources.jar",
119
+ "url": "expo.modules.audio-1.0.8-sources.jar",
120
+ "size": 13104,
121
+ "sha512": "071848199cd4a94d3ba77e7d173daa7888e1f87f9c3a0c8e260bc3dffdd91b785511c8bad75eeeb2e7d91a5f1a590b3ed12afe49cbe7792761d65c450ac91ba7",
122
+ "sha256": "caf8ac9e00d60620ad5406dea94ae3865cc7b9aca65ade0a4239b84048adf494",
123
+ "sha1": "5da2cfac339b925ca12c1419c63c9fd0564e91e5",
124
+ "md5": "c6d6c20a31fa3cef9d706ac8abc339dd"
125
125
  }
126
126
  ]
127
127
  }
@@ -0,0 +1 @@
1
+ 131b5afd5aefb0c252703fe17da786922e18905a53a5c5f42e801d9388dac277
@@ -0,0 +1 @@
1
+ 8773c65dd0430478ed0781e23a10867c7bb479b180c7dcd98a1aff64b0828d42a75f1ec21e5347185497c3d6c111679ec4c6aa2f4b4f9358ce471d90c68ea1da
@@ -9,7 +9,7 @@
9
9
  <modelVersion>4.0.0</modelVersion>
10
10
  <groupId>expo.modules.audio</groupId>
11
11
  <artifactId>expo.modules.audio</artifactId>
12
- <version>1.0.6</version>
12
+ <version>1.0.8</version>
13
13
  <packaging>aar</packaging>
14
14
  <name>expo.modules.audio</name>
15
15
  <url>https://github.com/expo/expo</url>
@@ -0,0 +1 @@
1
+ e810fdb59e0fb9643183bbafbda645bca859e717
@@ -0,0 +1 @@
1
+ b17677c5d6968b50ab61fc809e671a40e70367ee6bf31a03c19ee6966daa8f48
@@ -0,0 +1 @@
1
+ 062cb7c15c08e7d02f9256b0e920220dce5e78b3255756bc60807bbe6888100196ef8e87bd7ef27610effbc9b6eed62246f64acf049b9ab46ee5cf77bc7ca99c
@@ -3,11 +3,11 @@
3
3
  <groupId>expo.modules.audio</groupId>
4
4
  <artifactId>expo.modules.audio</artifactId>
5
5
  <versioning>
6
- <latest>1.0.6</latest>
7
- <release>1.0.6</release>
6
+ <latest>1.0.8</latest>
7
+ <release>1.0.8</release>
8
8
  <versions>
9
- <version>1.0.6</version>
9
+ <version>1.0.8</version>
10
10
  </versions>
11
- <lastUpdated>20250827210803</lastUpdated>
11
+ <lastUpdated>20250902175114</lastUpdated>
12
12
  </versioning>
13
13
  </metadata>
@@ -1 +1 @@
1
- cf3733ddb4977797b075d4eaff665cd3
1
+ 7ee445d563bce410deea7fdb627b57c0
@@ -1 +1 @@
1
- d416c9e47a588ea02d07591fe14218746edb499b
1
+ a73cf7c00df6862fed9fa7a9c2116697bdce7633
@@ -1 +1 @@
1
- 7533730e61ab5a5005d5ea7fd5911aa1ce94899045f61c39ebd13e5de7c8f515
1
+ 9dfbdff37670cb9f8ca9325ad7e594bc61947e1aff72f4ef388c06ded106e38a
@@ -1 +1 @@
1
- 3661fdf7b45a7cc389bf3f6cec2632ce3997ecdb5ec1865306080685548783b7ad05dd52885c3a1c45f8799c9f3d85dece6482e127ba69bdb7cd0a1d1701e622
1
+ 34c92ea80e1e526e08e067756ab4065ac850432c2042414a698184ec32ae3322d3410b1e3f1d653515325194550e6c7d7c22a75412c8e569b95add158d805193
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "expo-audio",
3
3
  "title": "Expo Audio",
4
- "version": "1.0.6",
4
+ "version": "1.0.8",
5
5
  "description": "A cross-platform audio library for React Native and Expo apps.",
6
6
  "main": "build/index.js",
7
7
  "types": "build/index.d.ts",
@@ -33,12 +33,12 @@
33
33
  "license": "MIT",
34
34
  "dependencies": {},
35
35
  "devDependencies": {
36
- "expo-module-scripts": "^5.0.4"
36
+ "expo-module-scripts": "^5.0.6"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "expo": "*",
40
40
  "react": "*",
41
41
  "react-native": "*"
42
42
  },
43
- "gitHead": "48faa7b9a9f93a7660cb80aa118c7f6bf0aeff38"
43
+ "gitHead": "d635404a12ea7996b987ce0fb7679a238ebcf31b"
44
44
  }
@@ -72,6 +72,19 @@ export type AudioPlayerOptions = {
72
72
  * @default undefined
73
73
  */
74
74
  crossOrigin?: 'anonymous' | 'use-credentials';
75
+ /**
76
+ * If set to `true`, the audio session will not be deactivated when this player pauses or finishes playback.
77
+ * This prevents interrupting other audio sources (like videos) when the audio ends.
78
+ *
79
+ * Useful for sound effects that should not interfere with ongoing video playback or other audio.
80
+ * The audio session for this player will not be deactivated automatically when the player finishes playback.
81
+ *
82
+ * > **Note:** If needed, you can manually deactivate the audio session using `setIsAudioActiveAsync(false)`.
83
+ *
84
+ * @platform ios
85
+ * @default false
86
+ */
87
+ keepAudioSessionActive?: boolean;
75
88
  };
76
89
 
77
90
  /**
@@ -30,7 +30,7 @@ export declare class AudioPlayer extends SharedObject<AudioEvents> {
30
30
  * Initializes a new audio player instance with the given source.
31
31
  * @hidden
32
32
  */
33
- constructor(source: AudioSource, updateInterval: number);
33
+ constructor(source: AudioSource, updateInterval: number, keepAudioSessionActive: boolean);
34
34
 
35
35
  /**
36
36
  * Unique identifier for the player object.
package/src/ExpoAudio.ts CHANGED
@@ -99,7 +99,7 @@ export function useAudioPlayer(
99
99
  source: AudioSource = null,
100
100
  options: AudioPlayerOptions = {}
101
101
  ): AudioPlayer {
102
- const { updateInterval = 500, downloadFirst = false } = options;
102
+ const { updateInterval = 500, downloadFirst = false, keepAudioSessionActive = false } = options;
103
103
 
104
104
  // If downloadFirst is true, we don't need to resolve the source, because it will be resolved in the useEffect below.
105
105
  // If downloadFirst is false, we resolve the source here.
@@ -109,8 +109,8 @@ export function useAudioPlayer(
109
109
  }, [JSON.stringify(source), downloadFirst]);
110
110
 
111
111
  const player = useReleasingSharedObject(
112
- () => new AudioModule.AudioPlayer(initialSource, updateInterval),
113
- [JSON.stringify(initialSource), updateInterval]
112
+ () => new AudioModule.AudioPlayer(initialSource, updateInterval, keepAudioSessionActive),
113
+ [JSON.stringify(initialSource), updateInterval, keepAudioSessionActive]
114
114
  );
115
115
 
116
116
  // Handle async source resolution for downloadFirst
@@ -344,9 +344,9 @@ export function createAudioPlayer(
344
344
  source: AudioSource | string | number | null = null,
345
345
  options: AudioPlayerOptions = {}
346
346
  ): AudioPlayer {
347
- const { updateInterval = 500, downloadFirst = false } = options;
347
+ const { updateInterval = 500, downloadFirst = false, keepAudioSessionActive = false } = options;
348
348
  const initialSource = downloadFirst ? null : resolveSource(source);
349
- const player = new AudioModule.AudioPlayer(initialSource, updateInterval);
349
+ const player = new AudioModule.AudioPlayer(initialSource, updateInterval, keepAudioSessionActive);
350
350
 
351
351
  if (downloadFirst && source) {
352
352
  resolveSourceWithDownload(source)
@@ -1 +0,0 @@
1
- 3b41eabbf5383b027d7f364c3c21cae258c98356355332c703ad81c994a65ac0
@@ -1 +0,0 @@
1
- 692cc735d375aa36d94c1119e528c01421c1e204fe5dc3fd6049b7d29113d90130ab55577c12b8811e35fa12f7b20b7bed9daa38d1b70ac80c7238b62b0bcce3
@@ -1 +0,0 @@
1
- 92aad35d45bfe43545a12ec627dfb3bd5cb33865
@@ -1 +0,0 @@
1
- 7ae65099bf929c11afa62540b81bd0c64149e77f563742d1658d7cf66c3e1e58
@@ -1 +0,0 @@
1
- 3671356caa6ec10b30405e7321ceccf5c75341ea1053aac35ce7fe63815b1fd74247fd63301b929622faef66b8694dcd18e375a7ae2fcfcc0d2a131a1a3b5cf6
@@ -1 +0,0 @@
1
- 9e03a670fbec277b3c98b888563e9273e92ed3e0
@@ -1 +0,0 @@
1
- 67a9707393020c7f85c9d2b6ad04ba46dbe602e99c2429f187d34625e274c77f
@@ -1 +0,0 @@
1
- 8f4586f5f3020a80bd83616d36349f32339876f47ce3069d185404ee20b41cebabc8af4ae74517977fa4d496e0ac778968403499e1dbe72f34ea97bbf092df58
@@ -1 +0,0 @@
1
- b230ee97fc3e2db3442f96e5e813d0afc226fa25
@@ -1 +0,0 @@
1
- 766db92e36a9a59da5768c1dd0e4234421755efd1b8042df17743aecb7881358
@@ -1 +0,0 @@
1
- 3551e8af7cfd888f646274ff1b4f180fadac882fcf51f2b398af9254ab0e45265fee9cd61fab585783fe6001e14f39f0f00a3aea003b7d3d8e52902addcf9047