expo-audio 1.0.3 → 1.0.5

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 (66) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/android/build.gradle +2 -2
  3. package/android/src/main/java/expo/modules/audio/AudioPlayer.kt +4 -0
  4. package/android/src/main/java/expo/modules/audio/AudioRecorder.kt +9 -7
  5. package/build/Audio.types.d.ts +1 -64
  6. package/build/Audio.types.d.ts.map +1 -1
  7. package/build/Audio.types.js +1 -66
  8. package/build/Audio.types.js.map +1 -1
  9. package/build/AudioModule.types.d.ts +1 -1
  10. package/build/AudioModule.types.d.ts.map +1 -1
  11. package/build/AudioModule.types.js.map +1 -1
  12. package/build/AudioModule.web.d.ts +1 -1
  13. package/build/AudioModule.web.d.ts.map +1 -1
  14. package/build/AudioModule.web.js +2 -2
  15. package/build/AudioModule.web.js.map +1 -1
  16. package/build/RecordingConstants.d.ts +64 -0
  17. package/build/RecordingConstants.d.ts.map +1 -1
  18. package/build/RecordingConstants.js +66 -1
  19. package/build/RecordingConstants.js.map +1 -1
  20. package/expo-module.config.json +1 -1
  21. package/local-maven-repo/expo/modules/audio/expo.modules.audio/{1.0.3/expo.modules.audio-1.0.3-sources.jar → 1.0.5/expo.modules.audio-1.0.5-sources.jar} +0 -0
  22. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5-sources.jar.md5 +1 -0
  23. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5-sources.jar.sha1 +1 -0
  24. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5-sources.jar.sha256 +1 -0
  25. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5-sources.jar.sha512 +1 -0
  26. package/local-maven-repo/expo/modules/audio/expo.modules.audio/{1.0.3/expo.modules.audio-1.0.3.aar → 1.0.5/expo.modules.audio-1.0.5.aar} +0 -0
  27. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5.aar.md5 +1 -0
  28. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5.aar.sha1 +1 -0
  29. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5.aar.sha256 +1 -0
  30. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5.aar.sha512 +1 -0
  31. package/local-maven-repo/expo/modules/audio/expo.modules.audio/{1.0.3/expo.modules.audio-1.0.3.module → 1.0.5/expo.modules.audio-1.0.5.module} +22 -22
  32. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5.module.md5 +1 -0
  33. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5.module.sha1 +1 -0
  34. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5.module.sha256 +1 -0
  35. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5.module.sha512 +1 -0
  36. package/local-maven-repo/expo/modules/audio/expo.modules.audio/{1.0.3/expo.modules.audio-1.0.3.pom → 1.0.5/expo.modules.audio-1.0.5.pom} +1 -1
  37. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5.pom.md5 +1 -0
  38. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5.pom.sha1 +1 -0
  39. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5.pom.sha256 +1 -0
  40. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.5/expo.modules.audio-1.0.5.pom.sha512 +1 -0
  41. package/local-maven-repo/expo/modules/audio/expo.modules.audio/maven-metadata.xml +4 -4
  42. package/local-maven-repo/expo/modules/audio/expo.modules.audio/maven-metadata.xml.md5 +1 -1
  43. package/local-maven-repo/expo/modules/audio/expo.modules.audio/maven-metadata.xml.sha1 +1 -1
  44. package/local-maven-repo/expo/modules/audio/expo.modules.audio/maven-metadata.xml.sha256 +1 -1
  45. package/local-maven-repo/expo/modules/audio/expo.modules.audio/maven-metadata.xml.sha512 +1 -1
  46. package/package.json +3 -3
  47. package/src/Audio.types.ts +2 -66
  48. package/src/AudioModule.types.ts +1 -1
  49. package/src/AudioModule.web.ts +3 -3
  50. package/src/RecordingConstants.ts +67 -1
  51. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3-sources.jar.md5 +0 -1
  52. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3-sources.jar.sha1 +0 -1
  53. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3-sources.jar.sha256 +0 -1
  54. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3-sources.jar.sha512 +0 -1
  55. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3.aar.md5 +0 -1
  56. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3.aar.sha1 +0 -1
  57. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3.aar.sha256 +0 -1
  58. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3.aar.sha512 +0 -1
  59. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3.module.md5 +0 -1
  60. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3.module.sha1 +0 -1
  61. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3.module.sha256 +0 -1
  62. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3.module.sha512 +0 -1
  63. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3.pom.md5 +0 -1
  64. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3.pom.sha1 +0 -1
  65. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3.pom.sha256 +0 -1
  66. package/local-maven-repo/expo/modules/audio/expo.modules.audio/1.0.3/expo.modules.audio-1.0.3.pom.sha512 +0 -1
package/CHANGELOG.md CHANGED
@@ -10,6 +10,22 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 1.0.5 — 2025-08-21
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Correctly export enum values. ([#38940](https://github.com/expo/expo/pull/38940) by [@alanjhughes](https://github.com/alanjhughes))
18
+
19
+ ### 💡 Others
20
+
21
+ - Repurpose audio recording tests. ([#38940](https://github.com/expo/expo/pull/38940) by [@alanjhughes](https://github.com/alanjhughes))
22
+
23
+ ## 1.0.4 — 2025-08-21
24
+
25
+ ### 🐛 Bug fixes
26
+
27
+ - [Android] Emit state update after reload. ([#39003](https://github.com/expo/expo/pull/39003) by [@alanjhughes](https://github.com/alanjhughes))
28
+
13
29
  ## 1.0.3 — 2025-08-18
14
30
 
15
31
  ### 🐛 Bug fixes
@@ -4,13 +4,13 @@ plugins {
4
4
  }
5
5
 
6
6
  group = 'expo.modules.audio'
7
- version = '1.0.3'
7
+ version = '1.0.5'
8
8
 
9
9
  android {
10
10
  namespace "expo.modules.audio"
11
11
  defaultConfig {
12
12
  versionCode 1
13
- versionName "1.0.3"
13
+ versionName "1.0.5"
14
14
  }
15
15
 
16
16
  compileOptions {
@@ -23,6 +23,7 @@ import kotlinx.coroutines.delay
23
23
  import kotlinx.coroutines.flow.flow
24
24
  import kotlinx.coroutines.flow.launchIn
25
25
  import kotlinx.coroutines.flow.onEach
26
+ import kotlinx.coroutines.flow.onStart
26
27
  import kotlinx.coroutines.launch
27
28
  import kotlinx.coroutines.withContext
28
29
  import java.util.UUID
@@ -92,6 +93,9 @@ class AudioPlayer(
92
93
  delay(updateInterval.toLong())
93
94
  }
94
95
  }
96
+ .onStart {
97
+ sendPlayerUpdate()
98
+ }
95
99
  .onEach {
96
100
  if (playing) {
97
101
  sendPlayerUpdate()
@@ -297,13 +297,15 @@ class AudioRecorder(
297
297
  throw GetAudioInputNotSupportedException()
298
298
  }
299
299
 
300
- try {
301
- // getRoutedDevice() is the most reliable way to return the actual mic input, however it
302
- // only returns a valid device when actively recording, and may throw otherwise.
303
- // https://developer.android.com/reference/android/media/MediaRecorder#getRoutedDevice()
304
- deviceInfo = recorder?.routedDevice
305
- } catch (e: java.lang.Exception) {
306
- // no-op
300
+ if (isRecording) {
301
+ try {
302
+ // getRoutedDevice() is the most reliable way to return the actual mic input, however it
303
+ // only returns a valid device when actively recording, and may throw otherwise.
304
+ // https://developer.android.com/reference/android/media/MediaRecorder#getRoutedDevice()
305
+ deviceInfo = recorder?.routedDevice
306
+ } catch (e: java.lang.Exception) {
307
+ // no-op
308
+ }
307
309
  }
308
310
 
309
311
  // If no routed device is found try preferred device
@@ -1,3 +1,4 @@
1
+ import { AudioQuality, IOSOutputFormat } from './RecordingConstants';
1
2
  export type AudioSource = string | number | null | {
2
3
  /**
3
4
  * A string representing the resource identifier for the audio,
@@ -189,70 +190,6 @@ export type AndroidOutputFormat = 'default' | '3gp' | 'mpeg4' | 'amrnb' | 'amrwb
189
190
  * @platform android
190
191
  */
191
192
  export type AndroidAudioEncoder = 'default' | 'amr_nb' | 'amr_wb' | 'aac' | 'he_aac' | 'aac_eld';
192
- /**
193
- * Audio output format options for iOS recording.
194
- *
195
- * Comprehensive enum of audio formats supported by iOS for recording.
196
- * Each format has different characteristics in terms of quality, file size, and compatibility.
197
- * Some formats like LINEARPCM offer the highest quality but larger file sizes,
198
- * while compressed formats like AAC provide good quality with smaller files.
199
- *
200
- * @platform ios
201
- */
202
- export declare enum IOSOutputFormat {
203
- LINEARPCM = "lpcm",
204
- AC3 = "ac-3",
205
- '60958AC3' = "cac3",
206
- APPLEIMA4 = "ima4",
207
- MPEG4AAC = "aac ",
208
- MPEG4CELP = "celp",
209
- MPEG4HVXC = "hvxc",
210
- MPEG4TWINVQ = "twvq",
211
- MACE3 = "MAC3",
212
- MACE6 = "MAC6",
213
- ULAW = "ulaw",
214
- ALAW = "alaw",
215
- QDESIGN = "QDMC",
216
- QDESIGN2 = "QDM2",
217
- QUALCOMM = "Qclp",
218
- MPEGLAYER1 = ".mp1",
219
- MPEGLAYER2 = ".mp2",
220
- MPEGLAYER3 = ".mp3",
221
- APPLELOSSLESS = "alac",
222
- MPEG4AAC_HE = "aach",
223
- MPEG4AAC_LD = "aacl",
224
- MPEG4AAC_ELD = "aace",
225
- MPEG4AAC_ELD_SBR = "aacf",
226
- MPEG4AAC_ELD_V2 = "aacg",
227
- MPEG4AAC_HE_V2 = "aacp",
228
- MPEG4AAC_SPATIAL = "aacs",
229
- AMR = "samr",
230
- AMR_WB = "sawb",
231
- AUDIBLE = "AUDB",
232
- ILBC = "ilbc",
233
- DVIINTELIMA = 1836253201,
234
- MICROSOFTGSM = 1836253233,
235
- AES3 = "aes3",
236
- ENHANCEDAC3 = "ec-3"
237
- }
238
- /**
239
- * Audio quality levels for recording.
240
- *
241
- * Predefined quality levels that balance file size and audio fidelity.
242
- * Higher quality levels produce better sound but larger files and require more processing power.
243
- */
244
- export declare enum AudioQuality {
245
- /** Minimum quality: smallest file size, lowest fidelity. */
246
- MIN = 0,
247
- /** Low quality: good for voice recordings where file size matters. */
248
- LOW = 32,
249
- /** Medium quality: balanced option for most use cases. */
250
- MEDIUM = 64,
251
- /** High quality: good fidelity, larger file size. */
252
- HIGH = 96,
253
- /** Maximum quality: best fidelity, largest file size. */
254
- MAX = 127
255
- }
256
193
  /**
257
194
  * Bit rate strategies for audio encoding.
258
195
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ACH,YAAY,EAAE,mBAAmB,CAAC;IAClC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB;;;;OAIG;IACH,iBAAiB,EAAE,OAAO,CAAC;IAC3B;;;;OAIG;IACH,gBAAgB,EAAE,gBAAgB,CAAC;IACnC;;;;OAIG;IACH,uBAAuB,EAAE,uBAAuB,CAAC;IACjD;;;;;OAKG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;;OAGG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAChC;;;OAGG;IACH,0BAA0B,EAAE,OAAO,CAAC;CACrC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,UAAU,GAAG,YAAY,CAAC;AAE3E;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,UAAU,GAAG,YAAY,CAAC"}
@@ -1,67 +1,2 @@
1
- /**
2
- * Audio output format options for iOS recording.
3
- *
4
- * Comprehensive enum of audio formats supported by iOS for recording.
5
- * Each format has different characteristics in terms of quality, file size, and compatibility.
6
- * Some formats like LINEARPCM offer the highest quality but larger file sizes,
7
- * while compressed formats like AAC provide good quality with smaller files.
8
- *
9
- * @platform ios
10
- */
11
- export var IOSOutputFormat;
12
- (function (IOSOutputFormat) {
13
- IOSOutputFormat["LINEARPCM"] = "lpcm";
14
- IOSOutputFormat["AC3"] = "ac-3";
15
- IOSOutputFormat["60958AC3"] = "cac3";
16
- IOSOutputFormat["APPLEIMA4"] = "ima4";
17
- IOSOutputFormat["MPEG4AAC"] = "aac ";
18
- IOSOutputFormat["MPEG4CELP"] = "celp";
19
- IOSOutputFormat["MPEG4HVXC"] = "hvxc";
20
- IOSOutputFormat["MPEG4TWINVQ"] = "twvq";
21
- IOSOutputFormat["MACE3"] = "MAC3";
22
- IOSOutputFormat["MACE6"] = "MAC6";
23
- IOSOutputFormat["ULAW"] = "ulaw";
24
- IOSOutputFormat["ALAW"] = "alaw";
25
- IOSOutputFormat["QDESIGN"] = "QDMC";
26
- IOSOutputFormat["QDESIGN2"] = "QDM2";
27
- IOSOutputFormat["QUALCOMM"] = "Qclp";
28
- IOSOutputFormat["MPEGLAYER1"] = ".mp1";
29
- IOSOutputFormat["MPEGLAYER2"] = ".mp2";
30
- IOSOutputFormat["MPEGLAYER3"] = ".mp3";
31
- IOSOutputFormat["APPLELOSSLESS"] = "alac";
32
- IOSOutputFormat["MPEG4AAC_HE"] = "aach";
33
- IOSOutputFormat["MPEG4AAC_LD"] = "aacl";
34
- IOSOutputFormat["MPEG4AAC_ELD"] = "aace";
35
- IOSOutputFormat["MPEG4AAC_ELD_SBR"] = "aacf";
36
- IOSOutputFormat["MPEG4AAC_ELD_V2"] = "aacg";
37
- IOSOutputFormat["MPEG4AAC_HE_V2"] = "aacp";
38
- IOSOutputFormat["MPEG4AAC_SPATIAL"] = "aacs";
39
- IOSOutputFormat["AMR"] = "samr";
40
- IOSOutputFormat["AMR_WB"] = "sawb";
41
- IOSOutputFormat["AUDIBLE"] = "AUDB";
42
- IOSOutputFormat["ILBC"] = "ilbc";
43
- IOSOutputFormat[IOSOutputFormat["DVIINTELIMA"] = 1836253201] = "DVIINTELIMA";
44
- IOSOutputFormat[IOSOutputFormat["MICROSOFTGSM"] = 1836253233] = "MICROSOFTGSM";
45
- IOSOutputFormat["AES3"] = "aes3";
46
- IOSOutputFormat["ENHANCEDAC3"] = "ec-3";
47
- })(IOSOutputFormat || (IOSOutputFormat = {}));
48
- /**
49
- * Audio quality levels for recording.
50
- *
51
- * Predefined quality levels that balance file size and audio fidelity.
52
- * Higher quality levels produce better sound but larger files and require more processing power.
53
- */
54
- export var AudioQuality;
55
- (function (AudioQuality) {
56
- /** Minimum quality: smallest file size, lowest fidelity. */
57
- AudioQuality[AudioQuality["MIN"] = 0] = "MIN";
58
- /** Low quality: good for voice recordings where file size matters. */
59
- AudioQuality[AudioQuality["LOW"] = 32] = "LOW";
60
- /** Medium quality: balanced option for most use cases. */
61
- AudioQuality[AudioQuality["MEDIUM"] = 64] = "MEDIUM";
62
- /** High quality: good fidelity, larger file size. */
63
- AudioQuality[AudioQuality["HIGH"] = 96] = "HIGH";
64
- /** Maximum quality: best fidelity, largest file size. */
65
- AudioQuality[AudioQuality["MAX"] = 127] = "MAX";
66
- })(AudioQuality || (AudioQuality = {}));
1
+ export {};
67
2
  //# sourceMappingURL=Audio.types.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Audio.types.js","sourceRoot":"","sources":["../src/Audio.types.ts"],"names":[],"mappings":"AAsNA;;;;;;;;;GASG;AACH,MAAM,CAAN,IAAY,eAmCX;AAnCD,WAAY,eAAe;IACzB,qCAAkB,CAAA;IAClB,+BAAY,CAAA;IACZ,oCAAmB,CAAA;IACnB,qCAAkB,CAAA;IAClB,oCAAiB,CAAA;IACjB,qCAAkB,CAAA;IAClB,qCAAkB,CAAA;IAClB,uCAAoB,CAAA;IACpB,iCAAc,CAAA;IACd,iCAAc,CAAA;IACd,gCAAa,CAAA;IACb,gCAAa,CAAA;IACb,mCAAgB,CAAA;IAChB,oCAAiB,CAAA;IACjB,oCAAiB,CAAA;IACjB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,sCAAmB,CAAA;IACnB,yCAAsB,CAAA;IACtB,uCAAoB,CAAA;IACpB,uCAAoB,CAAA;IACpB,wCAAqB,CAAA;IACrB,4CAAyB,CAAA;IACzB,2CAAwB,CAAA;IACxB,0CAAuB,CAAA;IACvB,4CAAyB,CAAA;IACzB,+BAAY,CAAA;IACZ,kCAAe,CAAA;IACf,mCAAgB,CAAA;IAChB,gCAAa,CAAA;IACb,4EAAwB,CAAA;IACxB,8EAAyB,CAAA;IACzB,gCAAa,CAAA;IACb,uCAAoB,CAAA;AACtB,CAAC,EAnCW,eAAe,KAAf,eAAe,QAmC1B;AAED;;;;;GAKG;AACH,MAAM,CAAN,IAAY,YAWX;AAXD,WAAY,YAAY;IACtB,4DAA4D;IAC5D,6CAAO,CAAA;IACP,sEAAsE;IACtE,8CAAU,CAAA;IACV,0DAA0D;IAC1D,oDAAa,CAAA;IACb,qDAAqD;IACrD,gDAAW,CAAA;IACX,yDAAyD;IACzD,+CAAU,CAAA;AACZ,CAAC,EAXW,YAAY,KAAZ,YAAY,QAWvB","sourcesContent":["// @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 * Audio output format options for iOS recording.\n *\n * Comprehensive enum of audio formats supported by iOS for recording.\n * Each format has different characteristics in terms of quality, file size, and compatibility.\n * Some formats like LINEARPCM offer the highest quality but larger file sizes,\n * while compressed formats like AAC provide good quality with smaller files.\n *\n * @platform ios\n */\nexport enum IOSOutputFormat {\n LINEARPCM = 'lpcm',\n AC3 = 'ac-3',\n '60958AC3' = 'cac3',\n APPLEIMA4 = 'ima4',\n MPEG4AAC = 'aac ',\n MPEG4CELP = 'celp',\n MPEG4HVXC = 'hvxc',\n MPEG4TWINVQ = 'twvq',\n MACE3 = 'MAC3',\n MACE6 = 'MAC6',\n ULAW = 'ulaw',\n ALAW = 'alaw',\n QDESIGN = 'QDMC',\n QDESIGN2 = 'QDM2',\n QUALCOMM = 'Qclp',\n MPEGLAYER1 = '.mp1',\n MPEGLAYER2 = '.mp2',\n MPEGLAYER3 = '.mp3',\n APPLELOSSLESS = 'alac',\n MPEG4AAC_HE = 'aach',\n MPEG4AAC_LD = 'aacl',\n MPEG4AAC_ELD = 'aace',\n MPEG4AAC_ELD_SBR = 'aacf',\n MPEG4AAC_ELD_V2 = 'aacg',\n MPEG4AAC_HE_V2 = 'aacp',\n MPEG4AAC_SPATIAL = 'aacs',\n AMR = 'samr',\n AMR_WB = 'sawb',\n AUDIBLE = 'AUDB',\n ILBC = 'ilbc',\n DVIINTELIMA = 0x6d730011,\n MICROSOFTGSM = 0x6d730031,\n AES3 = 'aes3',\n ENHANCEDAC3 = 'ec-3',\n}\n\n/**\n * Audio quality levels for recording.\n *\n * Predefined quality levels that balance file size and audio fidelity.\n * Higher quality levels produce better sound but larger files and require more processing power.\n */\nexport enum AudioQuality {\n /** Minimum quality: smallest file size, lowest fidelity. */\n MIN = 0,\n /** Low quality: good for voice recordings where file size matters. */\n LOW = 0x20,\n /** Medium quality: balanced option for most use cases. */\n MEDIUM = 0x40,\n /** High quality: good fidelity, larger file size. */\n HIGH = 0x60,\n /** Maximum quality: best fidelity, largest file size. */\n MAX = 0x7f,\n}\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\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"]}
@@ -188,7 +188,7 @@ export declare class AudioRecorder extends SharedObject<RecordingEvents> {
188
188
  * Returns the currently-selected recording input. This method can only be called if the `Recording` has been prepared.
189
189
  * @return A `Promise` that is fulfilled with a `RecordingInput` object.
190
190
  */
191
- getCurrentInput(): RecordingInput;
191
+ getCurrentInput(): Promise<RecordingInput>;
192
192
  /**
193
193
  * Sets the current recording input.
194
194
  * @param inputUid The uid of a `RecordingInput`.
@@ -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,WAAW,EAAE,OAAO,WAAW,CAAC;IACzC,QAAQ,CAAC,aAAa,EAAE,OAAO,aAAa,CAAC;CAC9C;AAED,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,YAAY,CAAC,WAAW,CAAC;IAChE;;;OAGG;gBACS,MAAM,EA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Module.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(): 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);\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"]}
@@ -51,7 +51,7 @@ export declare class AudioRecorderWeb extends globalThis.expo.SharedObject<Recor
51
51
  record(options?: RecordingStartOptions): void;
52
52
  private startActualRecording;
53
53
  getAvailableInputs(): RecordingInput[];
54
- getCurrentInput(): RecordingInput;
54
+ getCurrentInput(): Promise<RecordingInput>;
55
55
  prepareToRecordAsync(): Promise<void>;
56
56
  getStatus(): RecorderState;
57
57
  pause(): void;
@@ -1 +1 @@
1
- {"version":3,"file":"AudioModule.web.d.ts","sourceRoot":"","sources":["../src/AudioModule.web.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAoB,MAAM,mBAAmB,CAAC;AAEzE,OAAO,EACL,SAAS,EACT,kBAAkB,EAClB,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAuF/F,qBAAa,cACX,SAAQ,UAAU,CAAC,IAAI,CAAC,YAAY,CAAC,WAAW,CAChD,YAAW,WAAW;gBAEV,MAAM,EAAE,WAAW,EAAE,OAAO,GAAE,kBAAuB;IASjE,EAAE,EAAE,MAAM,CAAY;IACtB,wBAAwB,UAAS;IACjC,WAAW,UAAS;IACpB,kBAAkB,UAAS;IAE3B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AI,OAAO,CAAC,IAAI,CAAC;IA4B3B,aAAa;YAIC,mBAAmB;IA0CjC,OAAO,CAAC,8BAA8B;CAOvC;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,SAAS,iBAAI;AAC3D,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,OAAO,iBAAI;AAE/D,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAoBhF;AAED,wBAAsB,gCAAgC,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAkBpF"}
@@ -289,11 +289,11 @@ export class AudioRecorderWeb extends globalThis.expo.SharedObject {
289
289
  return [];
290
290
  }
291
291
  getCurrentInput() {
292
- return {
292
+ return Promise.resolve({
293
293
  type: 'Default',
294
294
  name: 'Default',
295
295
  uid: 'Default',
296
- };
296
+ });
297
297
  }
298
298
  async prepareToRecordAsync() {
299
299
  return this.setup();
@@ -1 +1 @@
1
- {"version":3,"file":"AudioModule.web.js","sourceRoot":"","sources":["../src/AudioModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAsB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAazE,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;IACnB,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,OAAO,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AACpB,CAAC,CAAC,EAAE,CAAC;AAEL,KAAK,UAAU,2BAA2B,CACxC,IAAwC;IAExC,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,WAAW,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK;QAAE,OAAO,IAAI,CAAC;IAEtF,IAAI,CAAC;QACH,MAAM,EAAE,KAAK,EAAE,GA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Y,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,MAAM,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QACpD,OAAO;YACL,MAAM,EAAE,gBAAgB,CAAC,OAAO;YAChC,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,MAAM,EAAE,gBAAgB,CAAC,MAAM;YAC/B,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import { Asset } from 'expo-asset';\nimport { PermissionResponse, PermissionStatus } from 'expo-modules-core';\n\nimport {\n AudioMode,\n AudioPlayerOptions,\n AudioSource,\n AudioStatus,\n PitchCorrectionQuality,\n RecorderState,\n RecordingInput,\n RecordingOptions,\n RecordingStartOptions,\n} from './Audio.types';\nimport { PLAYBACK_STATUS_UPDATE, RECORDING_STATUS_UPDATE } from './AudioEventKeys';\nimport { AudioPlayer, AudioEvents, RecordingEvents, AudioRecorder } from './AudioModule.types';\nimport { RecordingPresets } from './RecordingConstants';\n\nconst nextId = (() => {\n let id = 0;\n return () => id++;\n})();\n\nasync function getPermissionWithQueryAsync(\n name: PermissionNameWithAdditionalValues\n): Promise<PermissionStatus | null> {\n if (!navigator || !navigator.permissions || !navigator.permissions.query) return null;\n\n try {\n const { state } = await navigator.permissions.query({ name });\n switch (state) {\n case 'granted':\n return PermissionStatus.GRANTED;\n case 'denied':\n return PermissionStatus.DENIED;\n default:\n return PermissionStatus.UNDETERMINED;\n }\n } catch {\n // Firefox - TypeError: 'microphone' (value of 'name' member of PermissionDescriptor) is not a valid value for enumeration PermissionName.\n return PermissionStatus.UNDETERMINED;\n }\n}\n\nfunction getUserMedia(constraints: MediaStreamConstraints): Promise<MediaStream> {\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n return navigator.mediaDevices.getUserMedia(constraints);\n }\n\n // Some browsers partially implement mediaDevices. We can't just assign an object\n // with getUserMedia as it would overwrite existing properties.\n // Here, we will just add the getUserMedia property if it's missing.\n\n // First get ahold of the legacy getUserMedia, if present\n const getUserMedia =\n // TODO: this method is deprecated, migrate to https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia\n navigator.getUserMedia ||\n navigator.webkitGetUserMedia ||\n navigator.mozGetUserMedia ||\n function () {\n const error: any = new Error('Permission unimplemented');\n error.code = 0;\n error.name = 'NotAllowedError';\n throw error;\n };\n\n return new Promise((resolve, reject) => {\n // TODO(@kitten): The types indicates that this is incorrect.\n // Please check whether this is correct!\n // @ts-expect-error: The `successCallback` doesn't match a `resolve` function\n getUserMedia.call(navigator, constraints, resolve, reject);\n });\n}\n\nfunction getStatusFromMedia(media: HTMLMediaElement, id: number): AudioStatus {\n const isPlaying = !!(\n media.currentTime > 0 &&\n !media.paused &&\n !media.ended &&\n media.readyState > 2\n );\n\n const status: AudioStatus = {\n id,\n isLoaded: true,\n duration: media.duration,\n currentTime: media.currentTime,\n playbackState: '',\n timeControlStatus: isPlaying ? 'playing' : 'paused',\n reasonForWaitingToPlay: '',\n playing: isPlaying,\n didJustFinish: media.ended,\n isBuffering: false,\n playbackRate: media.playbackRate,\n shouldCorrectPitch: false,\n mute: media.muted,\n loop: media.loop,\n };\n\n return status;\n}\n\nexport class AudioPlayerWeb\n extends globalThis.expo.SharedObject<AudioEvents>\n implements AudioPlayer\n{\n constructor(source: AudioSource, options: AudioPlayerOptions = {}) {\n super();\n const { updateInterval = 500, crossOrigin } = options;\n this.src = source;\n this.interval = Math.max(updateInterval, 1);\n this.crossOrigin = crossOrigin;\n this.media = this._createMediaElement();\n }\n\n id: number = nextId();\n isAudioSamplingSupported = false;\n isBuffering = false;\n shouldCorrectPitch = false;\n\n private src: AudioSource = null;\n private media: HTMLAudioElement;\n private interval = 500;\n private isPlaying = false;\n private loaded = false;\n private crossOrigin?: 'anonymous' | 'use-credentials';\n\n get playing(): boolean {\n return this.isPlaying;\n }\n\n get muted(): boolean {\n return this.media.muted;\n }\n\n set muted(value: boolean) {\n this.media.muted = value;\n }\n\n get loop(): boolean {\n return this.media.loop;\n }\n\n set loop(value: boolean) {\n this.media.loop = value;\n }\n\n get duration(): number {\n return this.media.duration;\n }\n\n get currentTime(): number {\n return this.media.currentTime;\n }\n\n get paused(): boolean {\n return this.media.paused;\n }\n\n get isLoaded(): boolean {\n return this.loaded;\n }\n\n get playbackRate(): number {\n return this.media.playbackRate;\n }\n\n set playbackRate(value: number) {\n this.media.playbackRate = value;\n }\n\n get volume(): number {\n return this.media.volume;\n }\n\n set volume(value: number) {\n this.media.volume = value;\n }\n\n get currentStatus(): AudioStatus {\n return getStatusFromMedia(this.media, this.id);\n }\n\n play(): void {\n this.media.play();\n this.isPlaying = true;\n }\n\n pause(): void {\n this.media.pause();\n this.isPlaying = false;\n }\n\n replace(source: AudioSource): void {\n const wasPlaying = this.isPlaying;\n\n // we need to remove the current media element and create a new one\n this.remove();\n\n this.src = source;\n this.isPlaying = false;\n this.loaded = false;\n this.media = this._createMediaElement();\n\n // Resume playback if it was playing before\n if (wasPlaying) {\n this.play();\n }\n }\n\n async seekTo(\n seconds: number,\n toleranceMillisBefore?: number,\n toleranceMillisAfter?: number\n ): Promise<void> {\n this.media.currentTime = seconds;\n }\n\n // Not supported on web\n setAudioSamplingEnabled(enabled: boolean): void {\n this.isAudioSamplingSupported = false;\n }\n\n setPlaybackRate(second: number, pitchCorrectionQuality?: PitchCorrectionQuality): void {\n this.media.playbackRate = second;\n this.shouldCorrectPitch = pitchCorrectionQuality === 'high';\n this.media.preservesPitch = this.shouldCorrectPitch;\n }\n\n remove(): void {\n this.media.pause();\n this.media.removeAttribute('src');\n this.media.load();\n getStatusFromMedia(this.media, this.id);\n }\n\n _createMediaElement() {\n const newSource = getSourceUri(this.src);\n const media = new Audio(newSource);\n if (this.crossOrigin !== undefined) {\n media.crossOrigin = this.crossOrigin;\n }\n\n let lastEmitTime = 0;\n const intervalSec = this.interval / 1000;\n\n // Throttled status updates based on interval\n media.ontimeupdate = () => {\n const now = media.currentTime;\n // Handle backwards time (loop/seek)\n if (now < lastEmitTime) {\n lastEmitTime = now;\n }\n if (now - lastEmitTime >= intervalSec) {\n lastEmitTime = now;\n this.emit(PLAYBACK_STATUS_UPDATE, getStatusFromMedia(media, this.id));\n }\n };\n\n media.onplay = () => {\n this.isPlaying = true;\n lastEmitTime = media.currentTime;\n this.emit(PLAYBACK_STATUS_UPDATE, {\n ...getStatusFromMedia(media, this.id),\n playing: this.isPlaying,\n });\n };\n\n media.onpause = () => {\n this.isPlaying = false;\n lastEmitTime = media.currentTime;\n this.emit(PLAYBACK_STATUS_UPDATE, {\n ...getStatusFromMedia(media, this.id),\n playing: this.isPlaying,\n });\n };\n\n media.onseeked = () => {\n lastEmitTime = media.currentTime;\n this.emit(PLAYBACK_STATUS_UPDATE, getStatusFromMedia(media, this.id));\n };\n\n media.onended = () => {\n lastEmitTime = 0;\n };\n\n media.onloadeddata = () => {\n this.loaded = true;\n lastEmitTime = media.currentTime;\n this.emit(PLAYBACK_STATUS_UPDATE, {\n ...getStatusFromMedia(media, this.id),\n isLoaded: this.loaded,\n });\n };\n\n return media;\n }\n}\n\nfunction getSourceUri(source: AudioSource): string | undefined {\n if (typeof source === 'string') {\n return source;\n }\n if (typeof source === 'number') {\n const asset = Asset.fromModule(source);\n return asset.uri;\n }\n if (typeof source?.assetId === 'number' && !source?.uri) {\n const asset = Asset.fromModule(source.assetId);\n return asset.uri;\n }\n\n return source?.uri ?? undefined;\n}\n\nexport class AudioRecorderWeb\n extends globalThis.expo.SharedObject<RecordingEvents>\n implements AudioRecorder\n{\n constructor(options: Partial<RecordingOptions>) {\n super();\n this.options = options;\n }\n\n async setup() {\n this.mediaRecorder = await this.createMediaRecorder(this.options);\n }\n\n id = nextId();\n currentTime = 0;\n uri: string | null = null;\n\n private options: Partial<RecordingOptions>;\n private mediaRecorder: MediaRecorder | null = null;\n private mediaRecorderUptimeOfLastStartResume = 0;\n private mediaRecorderIsRecording = false;\n private timeoutIds: number[] = [];\n\n get isRecording(): boolean {\n return this.mediaRecorder?.state === 'recording';\n }\n\n record(options?: RecordingStartOptions): void {\n if (this.mediaRecorder === null) {\n throw new Error(\n 'Cannot start an audio recording without initializing a MediaRecorder. Run prepareToRecordAsync() before attempting to start an audio recording.'\n );\n }\n\n // Clear any existing timeouts\n this.clearTimeouts();\n\n // Note: atTime is not supported on Web (no native equivalent), so we ignore it entirely\n // Only forDuration is implemented using setTimeout\n const { forDuration } = options || {};\n\n this.startActualRecording();\n\n if (forDuration !== undefined) {\n this.timeoutIds.push(\n setTimeout(() => {\n this.stop();\n }, forDuration * 1000)\n );\n }\n }\n\n private startActualRecording(): void {\n if (this.mediaRecorder?.state === 'paused') {\n this.mediaRecorder.resume();\n } else {\n this.mediaRecorder?.start();\n }\n }\n\n getAvailableInputs(): RecordingInput[] {\n return [];\n }\n\n getCurrentInput(): RecordingInput {\n return {\n type: 'Default',\n name: 'Default',\n uid: 'Default',\n };\n }\n\n async prepareToRecordAsync(): Promise<void> {\n return this.setup();\n }\n\n getStatus(): RecorderState {\n return {\n canRecord:\n this.mediaRecorder?.state === 'recording' || this.mediaRecorder?.state === 'inactive',\n isRecording: this.mediaRecorder?.state === 'recording',\n durationMillis: this.getAudioRecorderDurationMillis(),\n mediaServicesDidReset: false,\n url: this.uri,\n };\n }\n\n pause(): void {\n if (this.mediaRecorder === null) {\n throw new Error(\n 'Cannot start an audio recording without initializing a MediaRecorder. Run prepareToRecordAsync() before attempting to start an audio recording.'\n );\n }\n\n this.mediaRecorder?.pause();\n }\n\n recordForDuration(seconds: number): void {\n this.record({ forDuration: seconds });\n }\n\n setInput(input: string): void {}\n\n startRecordingAtTime(seconds: number): void {\n this.record({ atTime: seconds });\n }\n\n async stop(): Promise<void> {\n if (this.mediaRecorder === null) {\n throw new Error(\n 'Cannot start an audio recording without initializing a MediaRecorder. Run prepareToRecordAsync() before attempting to start an audio recording.'\n );\n }\n\n const dataPromise = new Promise<Blob>((resolve) =>\n this.mediaRecorder?.addEventListener('dataavailable', (e) => resolve(e.data))\n );\n\n this.mediaRecorder?.stop();\n this.mediaRecorder = null;\n\n const data = await dataPromise;\n const url = URL.createObjectURL(data);\n\n this.uri = url;\n\n this.emit(RECORDING_STATUS_UPDATE, {\n id: this.id,\n isFinished: true,\n hasError: false,\n error: null,\n url,\n });\n }\n\n clearTimeouts() {\n this.timeoutIds.forEach((id) => clearTimeout(id));\n }\n\n private async createMediaRecorder(options: Partial<RecordingOptions>): Promise<MediaRecorder> {\n if (typeof navigator !== 'undefined' && !navigator.mediaDevices) {\n throw new Error('No media devices available');\n }\n\n this.mediaRecorderUptimeOfLastStartResume = 0;\n this.currentTime = 0;\n\n const stream = await getUserMedia({ audio: true });\n\n const mediaRecorder = new (window as any).MediaRecorder(\n stream,\n options?.web || RecordingPresets.HIGH_QUALITY.web\n );\n\n mediaRecorder.addEventListener('pause', () => {\n this.currentTime = this.getAudioRecorderDurationMillis();\n this.mediaRecorderIsRecording = false;\n });\n\n mediaRecorder.addEventListener('resume', () => {\n this.mediaRecorderUptimeOfLastStartResume = Date.now();\n this.mediaRecorderIsRecording = true;\n });\n\n mediaRecorder.addEventListener('start', () => {\n this.mediaRecorderUptimeOfLastStartResume = Date.now();\n this.currentTime = 0;\n this.mediaRecorderIsRecording = true;\n });\n\n mediaRecorder?.addEventListener('stop', () => {\n this.currentTime = 0;\n this.mediaRecorderIsRecording = false;\n\n // Clears recording icon in Chrome tab\n stream.getTracks().forEach((track) => track.stop());\n });\n\n return mediaRecorder;\n }\n\n private getAudioRecorderDurationMillis() {\n let duration = this.currentTime;\n if (this.mediaRecorderIsRecording && this.mediaRecorderUptimeOfLastStartResume > 0) {\n duration += Date.now() - this.mediaRecorderUptimeOfLastStartResume;\n }\n return duration;\n }\n}\n\nexport async function setAudioModeAsync(mode: AudioMode) {}\nexport async function setIsAudioActiveAsync(active: boolean) {}\n\nexport async function getRecordingPermissionsAsync(): Promise<PermissionResponse> {\n const maybeStatus = await getPermissionWithQueryAsync('microphone');\n switch (maybeStatus) {\n case PermissionStatus.GRANTED:\n return {\n status: PermissionStatus.GRANTED,\n expires: 'never',\n canAskAgain: true,\n granted: true,\n };\n case PermissionStatus.DENIED:\n return {\n status: PermissionStatus.DENIED,\n expires: 'never',\n canAskAgain: true,\n granted: false,\n };\n default:\n return await requestRecordingPermissionsAsync();\n }\n}\n\nexport async function requestRecordingPermissionsAsync(): Promise<PermissionResponse> {\n try {\n const stream = await getUserMedia({ audio: true });\n stream.getTracks().forEach((track) => track.stop());\n return {\n status: PermissionStatus.GRANTED,\n expires: 'never',\n canAskAgain: true,\n granted: true,\n };\n } catch {\n return {\n status: PermissionStatus.DENIED,\n expires: 'never',\n canAskAgain: true,\n granted: false,\n };\n }\n}\n"]}
1
+ {"version":3,"file":"AudioModule.web.js","sourceRoot":"","sources":["../src/AudioModule.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,YAAY,CAAC;AACnC,OAAO,EAAsB,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAazE,OAAO,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAC;AAEnF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAExD,MAAM,MAAM,GAAG,CAAC,GAAG,EAAE;IACnB,IAAI,EAAE,GAAG,CAAC,CAAC;IACX,OAAO,GAAG,EAAE,CAAC,EAAE,EAAE,CAAC;AACpB,CAAC,CAAC,EAAE,CAAC;AAEL,KAAK,UAAU,2BAA2B,CACxC,IAAwC;IAExC,IAAI,CAAC,SAAS,IAAI,CAAC,SAAS,CAAC,WAAW,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,KAAK;QAAE,OAAO,IAAI,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AED,MAAM,CAAC,KAAK,UAAU,gCAAgC;IACpD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;QACnD,MAAM,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;QACpD,OAAO;YACL,MAAM,EAAE,gBAAgB,CAAC,OAAO;YAChC,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,IAAI;SACd,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,OAAO;YACL,MAAM,EAAE,gBAAgB,CAAC,MAAM;YAC/B,OAAO,EAAE,OAAO;YAChB,WAAW,EAAE,IAAI;YACjB,OAAO,EAAE,KAAK;SACf,CAAC;IACJ,CAAC;AACH,CAAC","sourcesContent":["import { Asset } from 'expo-asset';\nimport { PermissionResponse, PermissionStatus } from 'expo-modules-core';\n\nimport {\n AudioMode,\n AudioPlayerOptions,\n AudioSource,\n AudioStatus,\n PitchCorrectionQuality,\n RecorderState,\n RecordingInput,\n RecordingOptions,\n RecordingStartOptions,\n} from './Audio.types';\nimport { PLAYBACK_STATUS_UPDATE, RECORDING_STATUS_UPDATE } from './AudioEventKeys';\nimport { AudioPlayer, AudioEvents, RecordingEvents, AudioRecorder } from './AudioModule.types';\nimport { RecordingPresets } from './RecordingConstants';\n\nconst nextId = (() => {\n let id = 0;\n return () => id++;\n})();\n\nasync function getPermissionWithQueryAsync(\n name: PermissionNameWithAdditionalValues\n): Promise<PermissionStatus | null> {\n if (!navigator || !navigator.permissions || !navigator.permissions.query) return null;\n\n try {\n const { state } = await navigator.permissions.query({ name });\n switch (state) {\n case 'granted':\n return PermissionStatus.GRANTED;\n case 'denied':\n return PermissionStatus.DENIED;\n default:\n return PermissionStatus.UNDETERMINED;\n }\n } catch {\n // Firefox - TypeError: 'microphone' (value of 'name' member of PermissionDescriptor) is not a valid value for enumeration PermissionName.\n return PermissionStatus.UNDETERMINED;\n }\n}\n\nfunction getUserMedia(constraints: MediaStreamConstraints): Promise<MediaStream> {\n if (navigator.mediaDevices && navigator.mediaDevices.getUserMedia) {\n return navigator.mediaDevices.getUserMedia(constraints);\n }\n\n // Some browsers partially implement mediaDevices. We can't just assign an object\n // with getUserMedia as it would overwrite existing properties.\n // Here, we will just add the getUserMedia property if it's missing.\n\n // First get ahold of the legacy getUserMedia, if present\n const getUserMedia =\n // TODO: this method is deprecated, migrate to https://developer.mozilla.org/en-US/docs/Web/API/MediaDevices/getUserMedia\n navigator.getUserMedia ||\n navigator.webkitGetUserMedia ||\n navigator.mozGetUserMedia ||\n function () {\n const error: any = new Error('Permission unimplemented');\n error.code = 0;\n error.name = 'NotAllowedError';\n throw error;\n };\n\n return new Promise((resolve, reject) => {\n // TODO(@kitten): The types indicates that this is incorrect.\n // Please check whether this is correct!\n // @ts-expect-error: The `successCallback` doesn't match a `resolve` function\n getUserMedia.call(navigator, constraints, resolve, reject);\n });\n}\n\nfunction getStatusFromMedia(media: HTMLMediaElement, id: number): AudioStatus {\n const isPlaying = !!(\n media.currentTime > 0 &&\n !media.paused &&\n !media.ended &&\n media.readyState > 2\n );\n\n const status: AudioStatus = {\n id,\n isLoaded: true,\n duration: media.duration,\n currentTime: media.currentTime,\n playbackState: '',\n timeControlStatus: isPlaying ? 'playing' : 'paused',\n reasonForWaitingToPlay: '',\n playing: isPlaying,\n didJustFinish: media.ended,\n isBuffering: false,\n playbackRate: media.playbackRate,\n shouldCorrectPitch: false,\n mute: media.muted,\n loop: media.loop,\n };\n\n return status;\n}\n\nexport class AudioPlayerWeb\n extends globalThis.expo.SharedObject<AudioEvents>\n implements AudioPlayer\n{\n constructor(source: AudioSource, options: AudioPlayerOptions = {}) {\n super();\n const { updateInterval = 500, crossOrigin } = options;\n this.src = source;\n this.interval = Math.max(updateInterval, 1);\n this.crossOrigin = crossOrigin;\n this.media = this._createMediaElement();\n }\n\n id: number = nextId();\n isAudioSamplingSupported = false;\n isBuffering = false;\n shouldCorrectPitch = false;\n\n private src: AudioSource = null;\n private media: HTMLAudioElement;\n private interval = 500;\n private isPlaying = false;\n private loaded = false;\n private crossOrigin?: 'anonymous' | 'use-credentials';\n\n get playing(): boolean {\n return this.isPlaying;\n }\n\n get muted(): boolean {\n return this.media.muted;\n }\n\n set muted(value: boolean) {\n this.media.muted = value;\n }\n\n get loop(): boolean {\n return this.media.loop;\n }\n\n set loop(value: boolean) {\n this.media.loop = value;\n }\n\n get duration(): number {\n return this.media.duration;\n }\n\n get currentTime(): number {\n return this.media.currentTime;\n }\n\n get paused(): boolean {\n return this.media.paused;\n }\n\n get isLoaded(): boolean {\n return this.loaded;\n }\n\n get playbackRate(): number {\n return this.media.playbackRate;\n }\n\n set playbackRate(value: number) {\n this.media.playbackRate = value;\n }\n\n get volume(): number {\n return this.media.volume;\n }\n\n set volume(value: number) {\n this.media.volume = value;\n }\n\n get currentStatus(): AudioStatus {\n return getStatusFromMedia(this.media, this.id);\n }\n\n play(): void {\n this.media.play();\n this.isPlaying = true;\n }\n\n pause(): void {\n this.media.pause();\n this.isPlaying = false;\n }\n\n replace(source: AudioSource): void {\n const wasPlaying = this.isPlaying;\n\n // we need to remove the current media element and create a new one\n this.remove();\n\n this.src = source;\n this.isPlaying = false;\n this.loaded = false;\n this.media = this._createMediaElement();\n\n // Resume playback if it was playing before\n if (wasPlaying) {\n this.play();\n }\n }\n\n async seekTo(\n seconds: number,\n toleranceMillisBefore?: number,\n toleranceMillisAfter?: number\n ): Promise<void> {\n this.media.currentTime = seconds;\n }\n\n // Not supported on web\n setAudioSamplingEnabled(enabled: boolean): void {\n this.isAudioSamplingSupported = false;\n }\n\n setPlaybackRate(second: number, pitchCorrectionQuality?: PitchCorrectionQuality): void {\n this.media.playbackRate = second;\n this.shouldCorrectPitch = pitchCorrectionQuality === 'high';\n this.media.preservesPitch = this.shouldCorrectPitch;\n }\n\n remove(): void {\n this.media.pause();\n this.media.removeAttribute('src');\n this.media.load();\n getStatusFromMedia(this.media, this.id);\n }\n\n _createMediaElement() {\n const newSource = getSourceUri(this.src);\n const media = new Audio(newSource);\n if (this.crossOrigin !== undefined) {\n media.crossOrigin = this.crossOrigin;\n }\n\n let lastEmitTime = 0;\n const intervalSec = this.interval / 1000;\n\n // Throttled status updates based on interval\n media.ontimeupdate = () => {\n const now = media.currentTime;\n // Handle backwards time (loop/seek)\n if (now < lastEmitTime) {\n lastEmitTime = now;\n }\n if (now - lastEmitTime >= intervalSec) {\n lastEmitTime = now;\n this.emit(PLAYBACK_STATUS_UPDATE, getStatusFromMedia(media, this.id));\n }\n };\n\n media.onplay = () => {\n this.isPlaying = true;\n lastEmitTime = media.currentTime;\n this.emit(PLAYBACK_STATUS_UPDATE, {\n ...getStatusFromMedia(media, this.id),\n playing: this.isPlaying,\n });\n };\n\n media.onpause = () => {\n this.isPlaying = false;\n lastEmitTime = media.currentTime;\n this.emit(PLAYBACK_STATUS_UPDATE, {\n ...getStatusFromMedia(media, this.id),\n playing: this.isPlaying,\n });\n };\n\n media.onseeked = () => {\n lastEmitTime = media.currentTime;\n this.emit(PLAYBACK_STATUS_UPDATE, getStatusFromMedia(media, this.id));\n };\n\n media.onended = () => {\n lastEmitTime = 0;\n };\n\n media.onloadeddata = () => {\n this.loaded = true;\n lastEmitTime = media.currentTime;\n this.emit(PLAYBACK_STATUS_UPDATE, {\n ...getStatusFromMedia(media, this.id),\n isLoaded: this.loaded,\n });\n };\n\n return media;\n }\n}\n\nfunction getSourceUri(source: AudioSource): string | undefined {\n if (typeof source === 'string') {\n return source;\n }\n if (typeof source === 'number') {\n const asset = Asset.fromModule(source);\n return asset.uri;\n }\n if (typeof source?.assetId === 'number' && !source?.uri) {\n const asset = Asset.fromModule(source.assetId);\n return asset.uri;\n }\n\n return source?.uri ?? undefined;\n}\n\nexport class AudioRecorderWeb\n extends globalThis.expo.SharedObject<RecordingEvents>\n implements AudioRecorder\n{\n constructor(options: Partial<RecordingOptions>) {\n super();\n this.options = options;\n }\n\n async setup() {\n this.mediaRecorder = await this.createMediaRecorder(this.options);\n }\n\n id = nextId();\n currentTime = 0;\n uri: string | null = null;\n\n private options: Partial<RecordingOptions>;\n private mediaRecorder: MediaRecorder | null = null;\n private mediaRecorderUptimeOfLastStartResume = 0;\n private mediaRecorderIsRecording = false;\n private timeoutIds: number[] = [];\n\n get isRecording(): boolean {\n return this.mediaRecorder?.state === 'recording';\n }\n\n record(options?: RecordingStartOptions): void {\n if (this.mediaRecorder === null) {\n throw new Error(\n 'Cannot start an audio recording without initializing a MediaRecorder. Run prepareToRecordAsync() before attempting to start an audio recording.'\n );\n }\n\n // Clear any existing timeouts\n this.clearTimeouts();\n\n // Note: atTime is not supported on Web (no native equivalent), so we ignore it entirely\n // Only forDuration is implemented using setTimeout\n const { forDuration } = options || {};\n\n this.startActualRecording();\n\n if (forDuration !== undefined) {\n this.timeoutIds.push(\n setTimeout(() => {\n this.stop();\n }, forDuration * 1000)\n );\n }\n }\n\n private startActualRecording(): void {\n if (this.mediaRecorder?.state === 'paused') {\n this.mediaRecorder.resume();\n } else {\n this.mediaRecorder?.start();\n }\n }\n\n getAvailableInputs(): RecordingInput[] {\n return [];\n }\n\n getCurrentInput(): Promise<RecordingInput> {\n return Promise.resolve({\n type: 'Default',\n name: 'Default',\n uid: 'Default',\n });\n }\n\n async prepareToRecordAsync(): Promise<void> {\n return this.setup();\n }\n\n getStatus(): RecorderState {\n return {\n canRecord:\n this.mediaRecorder?.state === 'recording' || this.mediaRecorder?.state === 'inactive',\n isRecording: this.mediaRecorder?.state === 'recording',\n durationMillis: this.getAudioRecorderDurationMillis(),\n mediaServicesDidReset: false,\n url: this.uri,\n };\n }\n\n pause(): void {\n if (this.mediaRecorder === null) {\n throw new Error(\n 'Cannot start an audio recording without initializing a MediaRecorder. Run prepareToRecordAsync() before attempting to start an audio recording.'\n );\n }\n\n this.mediaRecorder?.pause();\n }\n\n recordForDuration(seconds: number): void {\n this.record({ forDuration: seconds });\n }\n\n setInput(input: string): void {}\n\n startRecordingAtTime(seconds: number): void {\n this.record({ atTime: seconds });\n }\n\n async stop(): Promise<void> {\n if (this.mediaRecorder === null) {\n throw new Error(\n 'Cannot start an audio recording without initializing a MediaRecorder. Run prepareToRecordAsync() before attempting to start an audio recording.'\n );\n }\n\n const dataPromise = new Promise<Blob>((resolve) =>\n this.mediaRecorder?.addEventListener('dataavailable', (e) => resolve(e.data))\n );\n\n this.mediaRecorder?.stop();\n this.mediaRecorder = null;\n\n const data = await dataPromise;\n const url = URL.createObjectURL(data);\n\n this.uri = url;\n\n this.emit(RECORDING_STATUS_UPDATE, {\n id: this.id,\n isFinished: true,\n hasError: false,\n error: null,\n url,\n });\n }\n\n clearTimeouts() {\n this.timeoutIds.forEach((id) => clearTimeout(id));\n }\n\n private async createMediaRecorder(options: Partial<RecordingOptions>): Promise<MediaRecorder> {\n if (typeof navigator !== 'undefined' && !navigator.mediaDevices) {\n throw new Error('No media devices available');\n }\n\n this.mediaRecorderUptimeOfLastStartResume = 0;\n this.currentTime = 0;\n\n const stream = await getUserMedia({ audio: true });\n\n const mediaRecorder = new (window as any).MediaRecorder(\n stream,\n options?.web || RecordingPresets.HIGH_QUALITY.web\n );\n\n mediaRecorder.addEventListener('pause', () => {\n this.currentTime = this.getAudioRecorderDurationMillis();\n this.mediaRecorderIsRecording = false;\n });\n\n mediaRecorder.addEventListener('resume', () => {\n this.mediaRecorderUptimeOfLastStartResume = Date.now();\n this.mediaRecorderIsRecording = true;\n });\n\n mediaRecorder.addEventListener('start', () => {\n this.mediaRecorderUptimeOfLastStartResume = Date.now();\n this.currentTime = 0;\n this.mediaRecorderIsRecording = true;\n });\n\n mediaRecorder?.addEventListener('stop', () => {\n this.currentTime = 0;\n this.mediaRecorderIsRecording = false;\n\n // Clears recording icon in Chrome tab\n stream.getTracks().forEach((track) => track.stop());\n });\n\n return mediaRecorder;\n }\n\n private getAudioRecorderDurationMillis() {\n let duration = this.currentTime;\n if (this.mediaRecorderIsRecording && this.mediaRecorderUptimeOfLastStartResume > 0) {\n duration += Date.now() - this.mediaRecorderUptimeOfLastStartResume;\n }\n return duration;\n }\n}\n\nexport async function setAudioModeAsync(mode: AudioMode) {}\nexport async function setIsAudioActiveAsync(active: boolean) {}\n\nexport async function getRecordingPermissionsAsync(): Promise<PermissionResponse> {\n const maybeStatus = await getPermissionWithQueryAsync('microphone');\n switch (maybeStatus) {\n case PermissionStatus.GRANTED:\n return {\n status: PermissionStatus.GRANTED,\n expires: 'never',\n canAskAgain: true,\n granted: true,\n };\n case PermissionStatus.DENIED:\n return {\n status: PermissionStatus.DENIED,\n expires: 'never',\n canAskAgain: true,\n granted: false,\n };\n default:\n return await requestRecordingPermissionsAsync();\n }\n}\n\nexport async function requestRecordingPermissionsAsync(): Promise<PermissionResponse> {\n try {\n const stream = await getUserMedia({ audio: true });\n stream.getTracks().forEach((track) => track.stop());\n return {\n status: PermissionStatus.GRANTED,\n expires: 'never',\n canAskAgain: true,\n granted: true,\n };\n } catch {\n return {\n status: PermissionStatus.DENIED,\n expires: 'never',\n canAskAgain: true,\n granted: false,\n };\n }\n}\n"]}