expo-audio 0.2.1 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/android/build.gradle +2 -2
- package/build/Audio.types.d.ts +11 -13
- package/build/Audio.types.d.ts.map +1 -1
- package/build/Audio.types.js.map +1 -1
- package/build/AudioModule.d.ts +5 -2
- package/build/AudioModule.d.ts.map +1 -1
- package/build/AudioModule.js +3 -0
- package/build/AudioModule.js.map +1 -1
- package/build/AudioModule.types.d.ts +15 -13
- package/build/AudioModule.types.d.ts.map +1 -1
- package/build/AudioModule.types.js.map +1 -1
- package/build/ExpoAudio.d.ts +6 -10
- package/build/ExpoAudio.d.ts.map +1 -1
- package/build/ExpoAudio.js +7 -4
- package/build/ExpoAudio.js.map +1 -1
- package/build/ExpoAudio.web.d.ts +6 -10
- package/build/ExpoAudio.web.d.ts.map +1 -1
- package/build/ExpoAudio.web.js +7 -4
- package/build/ExpoAudio.web.js.map +1 -1
- package/build/RecordingConstants.d.ts +17 -25
- package/build/RecordingConstants.d.ts.map +1 -1
- package/build/RecordingConstants.js +17 -25
- package/build/RecordingConstants.js.map +1 -1
- package/build/index.d.ts +4 -0
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -0
- package/build/index.js.map +1 -1
- package/package.json +2 -2
- package/src/Audio.types.ts +11 -13
- package/src/AudioModule.ts +6 -2
- package/src/AudioModule.types.ts +14 -11
- package/src/ExpoAudio.ts +12 -9
- package/src/ExpoAudio.web.ts +12 -5
- package/src/RecordingConstants.ts +17 -25
- package/src/index.ts +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -10,6 +10,14 @@
|
|
|
10
10
|
|
|
11
11
|
### 💡 Others
|
|
12
12
|
|
|
13
|
+
## 0.2.3 — 2024-10-28
|
|
14
|
+
|
|
15
|
+
_This version does not introduce any user-facing changes._
|
|
16
|
+
|
|
17
|
+
## 0.2.2 — 2024-10-24
|
|
18
|
+
|
|
19
|
+
_This version does not introduce any user-facing changes._
|
|
20
|
+
|
|
13
21
|
## 0.2.1 — 2024-10-24
|
|
14
22
|
|
|
15
23
|
_This version does not introduce any user-facing changes._
|
package/android/build.gradle
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
apply plugin: 'com.android.library'
|
|
2
2
|
|
|
3
3
|
group = 'expo.modules.audio'
|
|
4
|
-
version = '0.2.
|
|
4
|
+
version = '0.2.3'
|
|
5
5
|
|
|
6
6
|
def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
|
|
7
7
|
apply from: expoModulesCorePlugin
|
|
@@ -14,7 +14,7 @@ android {
|
|
|
14
14
|
namespace "expo.modules.audio"
|
|
15
15
|
defaultConfig {
|
|
16
16
|
versionCode 1
|
|
17
|
-
versionName "0.2.
|
|
17
|
+
versionName "0.2.3"
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
compileOptions {
|
package/build/Audio.types.d.ts
CHANGED
|
@@ -96,25 +96,25 @@ export type RecordingOptions = {
|
|
|
96
96
|
/**
|
|
97
97
|
* The desired file extension.
|
|
98
98
|
*
|
|
99
|
-
* @example
|
|
99
|
+
* @example .caf
|
|
100
100
|
*/
|
|
101
101
|
extension: string;
|
|
102
102
|
/**
|
|
103
103
|
* The desired sample rate.
|
|
104
104
|
*
|
|
105
|
-
* @example
|
|
105
|
+
* @example 44100
|
|
106
106
|
*/
|
|
107
107
|
sampleRate: number;
|
|
108
108
|
/**
|
|
109
109
|
* The desired number of channels.
|
|
110
110
|
*
|
|
111
|
-
* @example
|
|
111
|
+
* @example 2
|
|
112
112
|
*/
|
|
113
113
|
numberOfChannels: number;
|
|
114
114
|
/**
|
|
115
115
|
* The desired bit rate.
|
|
116
116
|
*
|
|
117
|
-
* @example
|
|
117
|
+
* @example 128000
|
|
118
118
|
*/
|
|
119
119
|
bitRate: number;
|
|
120
120
|
/**
|
|
@@ -138,13 +138,13 @@ export type RecordingOptionsIos = {
|
|
|
138
138
|
/**
|
|
139
139
|
* The desired file extension.
|
|
140
140
|
*
|
|
141
|
-
* @example
|
|
141
|
+
* @example .caf
|
|
142
142
|
*/
|
|
143
143
|
extension?: string;
|
|
144
144
|
/**
|
|
145
145
|
* The desired sample rate.
|
|
146
146
|
*
|
|
147
|
-
* @example
|
|
147
|
+
* @example 44100
|
|
148
148
|
*/
|
|
149
149
|
sampleRate?: number;
|
|
150
150
|
/**
|
|
@@ -152,7 +152,7 @@ export type RecordingOptionsIos = {
|
|
|
152
152
|
*/
|
|
153
153
|
outputFormat?: string | IOSOutputFormat | number;
|
|
154
154
|
/**
|
|
155
|
-
* The desired audio quality. See the [`
|
|
155
|
+
* The desired audio quality. See the [`AudioQuality`](#audioquality) enum for all valid values.
|
|
156
156
|
*/
|
|
157
157
|
audioQuality: AudioQuality | number;
|
|
158
158
|
/**
|
|
@@ -162,15 +162,13 @@ export type RecordingOptionsIos = {
|
|
|
162
162
|
/**
|
|
163
163
|
* The desired bit depth hint.
|
|
164
164
|
*
|
|
165
|
-
* @example
|
|
166
|
-
* `16`
|
|
165
|
+
* @example 16
|
|
167
166
|
*/
|
|
168
167
|
bitDepthHint?: number;
|
|
169
168
|
/**
|
|
170
169
|
* The desired PCM bit depth.
|
|
171
170
|
*
|
|
172
|
-
* @example
|
|
173
|
-
* `16`
|
|
171
|
+
* @example 16
|
|
174
172
|
*/
|
|
175
173
|
linearPCMBitDepth?: number;
|
|
176
174
|
/**
|
|
@@ -186,13 +184,13 @@ export type RecordingOptionsAndroid = {
|
|
|
186
184
|
/**
|
|
187
185
|
* The desired file extension.
|
|
188
186
|
*
|
|
189
|
-
* @example
|
|
187
|
+
* @example .caf
|
|
190
188
|
*/
|
|
191
189
|
extension?: string;
|
|
192
190
|
/**
|
|
193
191
|
* The desired sample rate.
|
|
194
192
|
*
|
|
195
|
-
* @example
|
|
193
|
+
* @example 44100
|
|
196
194
|
*/
|
|
197
195
|
sampleRate?: number;
|
|
198
196
|
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E,MAAM,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,MAAM,CAAC;IACjD;;OAEG;IACH,YAAY,EAAE,YAAY,GAAG,MAAM,CAAC;IACpC;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB;;;;OAIG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B;;OAEG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,uBAAuB,GAAG;IACpC;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,YAAY,EAAE,mBAAmB,CAAC;IAClC;;OAEG;IACH,YAAY,EAAE,mBAAmB,CAAC;IAClC;;;;;;OAMG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,eAAe,EAAE,OAAO,CAAC;IACzB,sBAAsB,EAAE,OAAO,CAAC;IAChC,0BAA0B,EAAE,OAAO,CAAC;CACrC,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,eAAe,GAAG,UAAU,GAAG,YAAY,CAAC"}
|
package/build/Audio.types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Audio.types.js","sourceRoot":"","sources":["../src/Audio.types.ts"],"names":[],"mappings":"AAqEA,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,MAAM,CAAN,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,6CAAO,CAAA;IACP,8CAAU,CAAA;IACV,oDAAa,CAAA;IACb,gDAAW,CAAA;IACX,+CAAU,CAAA;AACZ,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB","sourcesContent":["export type AudioSource =\n | string\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 * 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 | null;\n\nexport type RecordingInput = {\n name: string;\n type: string;\n uid: string;\n};\n\nexport type PitchCorrectionQuality = 'low' | 'medium' | 'high';\n\nexport type AudioStatus = {\n id: number;\n currentTime: number;\n playbackState: string;\n timeControlStatus: string;\n reasonForWaitingToPlay: string;\n mute: boolean;\n duration: number;\n playing: boolean;\n loop: boolean;\n isBuffering: boolean;\n isLoaded: boolean;\n playbackRate: number;\n shouldCorrectPitch: boolean;\n};\n\nexport type RecordingStatus = {\n id: number;\n isFinished: boolean;\n hasError: boolean;\n error: string | null;\n url: string | null;\n};\n\nexport type RecorderState = {\n canRecord: boolean;\n isRecording: boolean;\n durationMillis: number;\n mediaServicesDidReset: boolean;\n metering?: number;\n url: string | null;\n};\n\nexport type AndroidOutputFormat =\n | 'default'\n | '3gp'\n | 'mpeg4'\n | 'amrnb'\n | 'amrwb'\n | 'aac_adts'\n | 'mpeg2ts'\n | 'webm';\n\nexport type AndroidAudioEncoder = 'default' | 'amr_nb' | 'amr_wb' | 'aac' | 'he_aac' | 'aac_eld';\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\nexport enum AudioQuality {\n MIN = 0,\n LOW = 0x20,\n MEDIUM = 0x40,\n HIGH = 0x60,\n MAX = 0x7f,\n}\n\nexport type BitRateStrategy = 'constant' | 'longTermAverage' | 'variableConstrained' | 'variable';\n\nexport type RecordingOptions = {\n /**\n * The desired file extension.\n *\n * @example
|
|
1
|
+
{"version":3,"file":"Audio.types.js","sourceRoot":"","sources":["../src/Audio.types.ts"],"names":[],"mappings":"AAqEA,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,MAAM,CAAN,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,6CAAO,CAAA;IACP,8CAAU,CAAA;IACV,oDAAa,CAAA;IACb,gDAAW,CAAA;IACX,+CAAU,CAAA;AACZ,CAAC,EANW,YAAY,KAAZ,YAAY,QAMvB","sourcesContent":["export type AudioSource =\n | string\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 * 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 | null;\n\nexport type RecordingInput = {\n name: string;\n type: string;\n uid: string;\n};\n\nexport type PitchCorrectionQuality = 'low' | 'medium' | 'high';\n\nexport type AudioStatus = {\n id: number;\n currentTime: number;\n playbackState: string;\n timeControlStatus: string;\n reasonForWaitingToPlay: string;\n mute: boolean;\n duration: number;\n playing: boolean;\n loop: boolean;\n isBuffering: boolean;\n isLoaded: boolean;\n playbackRate: number;\n shouldCorrectPitch: boolean;\n};\n\nexport type RecordingStatus = {\n id: number;\n isFinished: boolean;\n hasError: boolean;\n error: string | null;\n url: string | null;\n};\n\nexport type RecorderState = {\n canRecord: boolean;\n isRecording: boolean;\n durationMillis: number;\n mediaServicesDidReset: boolean;\n metering?: number;\n url: string | null;\n};\n\nexport type AndroidOutputFormat =\n | 'default'\n | '3gp'\n | 'mpeg4'\n | 'amrnb'\n | 'amrwb'\n | 'aac_adts'\n | 'mpeg2ts'\n | 'webm';\n\nexport type AndroidAudioEncoder = 'default' | 'amr_nb' | 'amr_wb' | 'aac' | 'he_aac' | 'aac_eld';\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\nexport enum AudioQuality {\n MIN = 0,\n LOW = 0x20,\n MEDIUM = 0x40,\n HIGH = 0x60,\n MAX = 0x7f,\n}\n\nexport type BitRateStrategy = 'constant' | 'longTermAverage' | 'variableConstrained' | 'variable';\n\nexport type RecordingOptions = {\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 */\n android: RecordingOptionsAndroid;\n /**\n * Recording options for the iOS platform.\n */\n ios: RecordingOptionsIos;\n /**\n * Recording options for the Web platform.\n */\n web?: RecordingOptionsWeb;\n};\n\nexport type RecordingOptionsWeb = {\n mimeType?: string;\n bitsPerSecond?: number;\n};\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\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 playsInSilentMode: boolean;\n interruptionMode: InterruptionMode;\n allowsRecording: boolean;\n shouldPlayInBackground: boolean;\n shouldRouteThroughEarpiece: boolean;\n};\n\nexport type InterruptionMode = 'mixWithOthers' | 'doNotMix' | 'duckOthers';\n"]}
|
package/build/AudioModule.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
1
|
+
import { NativeAudioModule } from './AudioModule.types';
|
|
2
|
+
/**
|
|
3
|
+
* @hidden
|
|
4
|
+
*/
|
|
5
|
+
declare const _default: NativeAudioModule;
|
|
3
6
|
export default _default;
|
|
4
7
|
//# sourceMappingURL=AudioModule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioModule.d.ts","sourceRoot":"","sources":["../src/AudioModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"AudioModule.d.ts","sourceRoot":"","sources":["../src/AudioModule.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAExD;;GAEG;;AACH,wBAAmE"}
|
package/build/AudioModule.js
CHANGED
package/build/AudioModule.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioModule.js","sourceRoot":"","sources":["../src/AudioModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"AudioModule.js","sourceRoot":"","sources":["../src/AudioModule.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAIxD;;GAEG;AACH,eAAe,mBAAmB,CAAoB,WAAW,CAAC,CAAC","sourcesContent":["import { requireNativeModule } from 'expo-modules-core';\n\nimport { NativeAudioModule } from './AudioModule.types';\n\n/**\n * @hidden\n */\nexport default requireNativeModule<NativeAudioModule>('ExpoAudio');\n"]}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { PermissionResponse, SharedObject } from 'expo-modules-core';
|
|
2
2
|
import { AudioMode, AudioSource, AudioStatus, PitchCorrectionQuality, RecorderState, RecordingInput, RecordingOptions, RecordingStatus } from './Audio.types';
|
|
3
|
-
|
|
3
|
+
/**
|
|
4
|
+
* @hidden
|
|
5
|
+
*/
|
|
6
|
+
export declare class NativeAudioModule {
|
|
4
7
|
setIsAudioActiveAsync(active: boolean): Promise<void>;
|
|
5
8
|
setAudioModeAsync(category: Partial<AudioMode>): Promise<void>;
|
|
6
|
-
requestRecordingPermissionsAsync(): Promise<
|
|
7
|
-
getRecordingPermissionsAsync(): Promise<
|
|
9
|
+
requestRecordingPermissionsAsync(): Promise<PermissionResponse>;
|
|
10
|
+
getRecordingPermissionsAsync(): Promise<PermissionResponse>;
|
|
8
11
|
readonly AudioPlayer: typeof AudioPlayer;
|
|
9
12
|
readonly AudioRecorder: typeof AudioRecorder;
|
|
10
13
|
}
|
|
11
|
-
export type RecordingPermissionResponse = PermissionResponse;
|
|
12
14
|
export declare class AudioPlayer extends SharedObject<AudioEvents> {
|
|
13
15
|
/**
|
|
14
16
|
* Initializes a new audio player instance with the given source.
|
|
@@ -52,7 +54,7 @@ export declare class AudioPlayer extends SharedObject<AudioEvents> {
|
|
|
52
54
|
*/
|
|
53
55
|
currentTime: number;
|
|
54
56
|
/**
|
|
55
|
-
* The total duration of the audio
|
|
57
|
+
* The total duration of the audio in seconds.
|
|
56
58
|
*/
|
|
57
59
|
duration: number;
|
|
58
60
|
/**
|
|
@@ -73,7 +75,7 @@ export declare class AudioPlayer extends SharedObject<AudioEvents> {
|
|
|
73
75
|
*/
|
|
74
76
|
currentStatus: AudioStatus;
|
|
75
77
|
/**
|
|
76
|
-
*
|
|
78
|
+
* Start playing audio.
|
|
77
79
|
*/
|
|
78
80
|
play(): void;
|
|
79
81
|
/**
|
|
@@ -90,7 +92,7 @@ export declare class AudioPlayer extends SharedObject<AudioEvents> {
|
|
|
90
92
|
* @param rate The playback rate of the audio.
|
|
91
93
|
* @param pitchCorrectionQuality The quality of the pitch correction.
|
|
92
94
|
*/
|
|
93
|
-
setPlaybackRate(
|
|
95
|
+
setPlaybackRate(rate: number, pitchCorrectionQuality?: PitchCorrectionQuality): void;
|
|
94
96
|
/**
|
|
95
97
|
*
|
|
96
98
|
* @hidden
|
|
@@ -101,12 +103,13 @@ export declare class AudioPlayer extends SharedObject<AudioEvents> {
|
|
|
101
103
|
*/
|
|
102
104
|
remove(): void;
|
|
103
105
|
}
|
|
104
|
-
type AudioSample = {
|
|
105
|
-
channels:
|
|
106
|
-
frames: number[];
|
|
107
|
-
}[];
|
|
106
|
+
export type AudioSample = {
|
|
107
|
+
channels: AudioSampleChannel[];
|
|
108
108
|
timestamp: number;
|
|
109
109
|
};
|
|
110
|
+
export type AudioSampleChannel = {
|
|
111
|
+
frames: number[];
|
|
112
|
+
};
|
|
110
113
|
export type AudioEvents = {
|
|
111
114
|
playbackStatusUpdate(status: AudioStatus): void;
|
|
112
115
|
audioSampleUpdate(data: AudioSample): void;
|
|
@@ -160,7 +163,7 @@ export declare class AudioRecorder extends SharedObject<RecordingEvents> {
|
|
|
160
163
|
* @param inputUid The uid of a `RecordingInput`.
|
|
161
164
|
* @return A `Promise` that is resolved if successful or rejected if not.
|
|
162
165
|
*/
|
|
163
|
-
setInput(
|
|
166
|
+
setInput(inputUid: string): void;
|
|
164
167
|
/**
|
|
165
168
|
* Status of the current recording.
|
|
166
169
|
*/
|
|
@@ -183,5 +186,4 @@ export declare class AudioRecorder extends SharedObject<RecordingEvents> {
|
|
|
183
186
|
export type RecordingEvents = {
|
|
184
187
|
recordingStatusUpdate: (status: RecordingStatus) => void;
|
|
185
188
|
};
|
|
186
|
-
export {};
|
|
187
189
|
//# sourceMappingURL=AudioModule.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioModule.types.d.ts","sourceRoot":"","sources":["../src/AudioModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,sBAAsB,EACtB,aAAa,EACb,cAAc,EACd,gBAAgB,EAChB,eAAe,EAChB,MAAM,eAAe,CAAC;AAEvB,MAAM,
|
|
1
|
+
{"version":3,"file":"AudioModule.types.d.ts","sourceRoot":"","sources":["../src/AudioModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAErE,OAAO,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX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;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAEhC;;OAEG;IACH,SAAS,IAAI,aAAa;IAE1B;;;OAGG;IACH,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAE3C;;OAEG;IACH,oBAAoB,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAExE;;;OAGG;IACH,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;CACzC;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,qBAAqB,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,CAAC;CAC1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AudioModule.types.js","sourceRoot":"","sources":["../src/AudioModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["import { PermissionResponse, SharedObject } from 'expo-modules-core';\n\nimport {\n AudioMode,\n AudioSource,\n AudioStatus,\n PitchCorrectionQuality,\n RecorderState,\n RecordingInput,\n RecordingOptions,\n RecordingStatus,\n} from './Audio.types';\n\nexport
|
|
1
|
+
{"version":3,"file":"AudioModule.types.js","sourceRoot":"","sources":["../src/AudioModule.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,YAAY,EAAE,MAAM,mBAAmB,CAAC","sourcesContent":["import { PermissionResponse, SharedObject } from 'expo-modules-core';\n\nimport {\n AudioMode,\n AudioSource,\n AudioStatus,\n PitchCorrectionQuality,\n RecorderState,\n RecordingInput,\n RecordingOptions,\n RecordingStatus,\n} from './Audio.types';\n\n/**\n * @hidden\n */\nexport declare class NativeAudioModule {\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 * Seeks the playback by the given number of seconds.\n * @param seconds The number of seconds to seek by.\n */\n seekTo(seconds: number): 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\nexport type AudioSample = {\n channels: AudioSampleChannel[];\n timestamp: number;\n};\n\nexport type AudioSampleChannel = { frames: number[] };\n\nexport type AudioEvents = {\n playbackStatusUpdate(status: AudioStatus): void;\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 */\n record(): 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 */\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 */\n recordForDuration(seconds: number): void;\n}\n\nexport type RecordingEvents = {\n recordingStatusUpdate: (status: RecordingStatus) => void;\n};\n"]}
|
package/build/ExpoAudio.d.ts
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
|
+
import { PermissionResponse } from 'expo-modules-core';
|
|
1
2
|
import { AudioMode, AudioSource, AudioStatus, RecorderState, RecordingOptions, RecordingStatus } from './Audio.types';
|
|
2
3
|
import AudioModule from './AudioModule';
|
|
3
|
-
import { AudioPlayer, AudioRecorder } from './AudioModule.types';
|
|
4
|
+
import { AudioPlayer, AudioRecorder, AudioSample } from './AudioModule.types';
|
|
4
5
|
export declare const PLAYBACK_STATUS_UPDATE = "playbackStatusUpdate";
|
|
5
6
|
export declare const AUDIO_SAMPLE_UPDATE = "audioSampleUpdate";
|
|
6
7
|
export declare const RECORDING_STATUS_UPDATE = "recordingStatusUpdate";
|
|
7
8
|
export declare function useAudioPlayer(source?: AudioSource | string | number | null, updateInterval?: number): AudioPlayer;
|
|
8
9
|
export declare function useAudioPlayerStatus(player: AudioPlayer): AudioStatus;
|
|
9
|
-
export declare function useAudioSampleListener(player: AudioPlayer, listener: (data:
|
|
10
|
-
channels: {
|
|
11
|
-
frames: number[];
|
|
12
|
-
}[];
|
|
13
|
-
timestamp: number;
|
|
14
|
-
}) => void): void;
|
|
10
|
+
export declare function useAudioSampleListener(player: AudioPlayer, listener: (data: AudioSample) => void): void;
|
|
15
11
|
export declare function useAudioRecorder(options: RecordingOptions, statusListener?: (status: RecordingStatus) => void): AudioRecorder;
|
|
16
12
|
export declare function useAudioRecorderState(recorder: AudioRecorder, interval?: number): RecorderState;
|
|
17
13
|
export declare function setIsAudioActiveAsync(active: boolean): Promise<void>;
|
|
18
14
|
export declare function setAudioModeAsync(mode: Partial<AudioMode>): Promise<void>;
|
|
19
|
-
export
|
|
20
|
-
export
|
|
21
|
-
export
|
|
15
|
+
export declare function requestRecordingPermissionsAsync(): Promise<PermissionResponse>;
|
|
16
|
+
export declare function getRecordingPermissionsAsync(): Promise<PermissionResponse>;
|
|
17
|
+
export { AudioModule };
|
|
22
18
|
//# sourceMappingURL=ExpoAudio.d.ts.map
|
package/build/ExpoAudio.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAudio.d.ts","sourceRoot":"","sources":["../src/ExpoAudio.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExpoAudio.d.ts","sourceRoot":"","sources":["../src/ExpoAudio.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAA4B,MAAM,mBAAmB,CAAC;AAGjF,OAAO,EACL,SAAS,EACT,WAAW,EACX,WAAW,EACX,aAAa,EACb,gBAAgB,EAChB,eAAe,EAChB,MAAM,eAAe,CAAC;AACvB,OAAO,WAAW,MAAM,eAAe,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAI9E,eAAO,MAAM,sBAAsB,yBAAyB,CAAC;AAC7D,eAAO,MAAM,mBAAmB,sBAAsB,CAAC;AACvD,eAAO,MAAM,uBAAuB,0BAA0B,CAAC;AAE/D,wBAAgB,cAAc,CAC5B,MAAM,GAAE,WAAW,GAAG,MAAM,GAAG,MAAM,GAAG,IAAW,EACnD,cAAc,GAAE,MAAY,GAC3B,WAAW,CAMb;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,WAAW,GAAG,WAAW,CAGrE;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,QAWhG;AAED,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,gBAAgB,EACzB,cAAc,CAAC,EAAE,CAAC,MAAM,EAAE,eAAe,KAAK,IAAI,GACjD,aAAa,CAcf;AAED,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,aAAa,EAAE,QAAQ,GAAE,MAAY,iBAYpF;AAED,wBAAsB,qBAAqB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAE1E;AAED,wBAAsB,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAE/E;AAED,wBAAsB,gCAAgC,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAEpF;AAED,wBAAsB,4BAA4B,IAAI,OAAO,CAAC,kBAAkB,CAAC,CAEhF;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/build/ExpoAudio.js
CHANGED
|
@@ -2,7 +2,6 @@ import { useEvent } from 'expo';
|
|
|
2
2
|
import { useReleasingSharedObject } from 'expo-modules-core';
|
|
3
3
|
import { useEffect, useState, useMemo } from 'react';
|
|
4
4
|
import AudioModule from './AudioModule';
|
|
5
|
-
import { AudioPlayer, AudioRecorder } from './AudioModule.types';
|
|
6
5
|
import { createRecordingOptions } from './utils/options';
|
|
7
6
|
import { resolveSource } from './utils/resolveSource';
|
|
8
7
|
export const PLAYBACK_STATUS_UPDATE = 'playbackStatusUpdate';
|
|
@@ -57,7 +56,11 @@ export async function setIsAudioActiveAsync(active) {
|
|
|
57
56
|
export async function setAudioModeAsync(mode) {
|
|
58
57
|
return await AudioModule.setAudioModeAsync(mode);
|
|
59
58
|
}
|
|
60
|
-
export
|
|
61
|
-
|
|
62
|
-
|
|
59
|
+
export async function requestRecordingPermissionsAsync() {
|
|
60
|
+
return await AudioModule.requestRecordingPermissionsAsync();
|
|
61
|
+
}
|
|
62
|
+
export async function getRecordingPermissionsAsync() {
|
|
63
|
+
return await AudioModule.getRecordingPermissionsAsync();
|
|
64
|
+
}
|
|
65
|
+
export { AudioModule };
|
|
63
66
|
//# sourceMappingURL=ExpoAudio.js.map
|
package/build/ExpoAudio.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAudio.js","sourceRoot":"","sources":["../src/ExpoAudio.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,
|
|
1
|
+
{"version":3,"file":"ExpoAudio.js","sourceRoot":"","sources":["../src/ExpoAudio.ts"],"names":[],"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CAAC,GAAG,CAAC,CAAC;IAClC,CAAC,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC;IAElB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,MAAe;IACzD,OAAO,MAAM,WAAW,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CAAC,IAAwB;IAC9D,OAAO,MAAM,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC;IACpD,OAAO,MAAM,WAAW,CAAC,gCAAgC,EAAE,CAAC;AAC9D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,4BAA4B;IAChD,OAAO,MAAM,WAAW,CAAC,4BAA4B,EAAE,CAAC;AAC1D,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { useEvent } from 'expo';\nimport { PermissionResponse, useReleasingSharedObject } from 'expo-modules-core';\nimport { useEffect, useState, useMemo } from 'react';\n\nimport {\n AudioMode,\n AudioSource,\n AudioStatus,\n RecorderState,\n RecordingOptions,\n RecordingStatus,\n} from './Audio.types';\nimport AudioModule from './AudioModule';\nimport { AudioPlayer, AudioRecorder, AudioSample } from './AudioModule.types';\nimport { createRecordingOptions } from './utils/options';\nimport { resolveSource } from './utils/resolveSource';\n\nexport const PLAYBACK_STATUS_UPDATE = 'playbackStatusUpdate';\nexport const AUDIO_SAMPLE_UPDATE = 'audioSampleUpdate';\nexport const RECORDING_STATUS_UPDATE = 'recordingStatusUpdate';\n\nexport function useAudioPlayer(\n source: AudioSource | string | number | null = null,\n updateInterval: number = 500\n): AudioPlayer {\n const parsedSource = resolveSource(source);\n return useReleasingSharedObject(\n () => new AudioModule.AudioPlayer(parsedSource, updateInterval),\n [JSON.stringify(parsedSource)]\n );\n}\n\nexport function useAudioPlayerStatus(player: AudioPlayer): AudioStatus {\n const currentStatus = useMemo(() => player.currentStatus, [player.id]);\n return useEvent(player, PLAYBACK_STATUS_UPDATE, currentStatus);\n}\n\nexport function useAudioSampleListener(player: AudioPlayer, listener: (data: AudioSample) => void) {\n player.setAudioSamplingEnabled(true);\n useEffect(() => {\n if (!player.isAudioSamplingSupported) {\n return;\n }\n const subscription = player.addListener(AUDIO_SAMPLE_UPDATE, listener);\n return () => {\n subscription.remove();\n };\n }, [player.id]);\n}\n\nexport function useAudioRecorder(\n options: RecordingOptions,\n statusListener?: (status: RecordingStatus) => void\n): AudioRecorder {\n const platformOptions = createRecordingOptions(options);\n const recorder = useReleasingSharedObject(() => {\n return new AudioModule.AudioRecorder(platformOptions);\n }, [JSON.stringify(platformOptions)]);\n\n useEffect(() => {\n const subscription = recorder.addListener(RECORDING_STATUS_UPDATE, (status) => {\n statusListener?.(status);\n });\n return () => subscription.remove();\n }, [recorder.id]);\n\n return recorder;\n}\n\nexport function useAudioRecorderState(recorder: AudioRecorder, interval: number = 500) {\n const [state, setState] = useState<RecorderState>(recorder.getStatus());\n\n useEffect(() => {\n const int = setInterval(() => {\n setState(recorder.getStatus());\n }, interval);\n\n return () => clearInterval(int);\n }, [recorder.id]);\n\n return state;\n}\n\nexport async function setIsAudioActiveAsync(active: boolean): Promise<void> {\n return await AudioModule.setIsAudioActiveAsync(active);\n}\n\nexport async function setAudioModeAsync(mode: Partial<AudioMode>): Promise<void> {\n return await AudioModule.setAudioModeAsync(mode);\n}\n\nexport async function requestRecordingPermissionsAsync(): Promise<PermissionResponse> {\n return await AudioModule.requestRecordingPermissionsAsync();\n}\n\nexport async function getRecordingPermissionsAsync(): Promise<PermissionResponse> {\n return await AudioModule.getRecordingPermissionsAsync();\n}\n\nexport { AudioModule };\n"]}
|
package/build/ExpoAudio.web.d.ts
CHANGED
|
@@ -1,19 +1,15 @@
|
|
|
1
|
+
import { PermissionResponse } from 'expo-modules-core';
|
|
1
2
|
import { AudioMode, AudioSource, AudioStatus, RecorderState, RecordingOptions, RecordingStatus } from './Audio.types';
|
|
2
|
-
import {
|
|
3
|
+
import { AudioRecorder, AudioSample } from './AudioModule.types';
|
|
3
4
|
import * as AudioModule from './AudioModule.web';
|
|
4
5
|
export declare function useAudioPlayer(source?: AudioSource | string | number | null, updateInterval?: number): AudioModule.AudioPlayerWeb;
|
|
5
6
|
export declare function useAudioPlayerStatus(player: AudioModule.AudioPlayerWeb): AudioStatus;
|
|
6
|
-
export declare function useAudioSampleListener(player: AudioModule.AudioPlayerWeb, listener: (data:
|
|
7
|
-
channels: {
|
|
8
|
-
frames: number[];
|
|
9
|
-
}[];
|
|
10
|
-
timestamp: number;
|
|
11
|
-
}) => void): void;
|
|
7
|
+
export declare function useAudioSampleListener(player: AudioModule.AudioPlayerWeb, listener: (data: AudioSample) => void): void;
|
|
12
8
|
export declare function useAudioRecorder(options: RecordingOptions, statusListener?: (status: RecordingStatus) => void): AudioModule.AudioRecorderWeb;
|
|
13
9
|
export declare function useAudioRecorderState(recorder: AudioRecorder, interval?: number): RecorderState;
|
|
14
10
|
export declare function setIsAudioActiveAsync(active: boolean): Promise<void>;
|
|
15
11
|
export declare function setAudioModeAsync(mode: AudioMode): Promise<void>;
|
|
16
|
-
export
|
|
17
|
-
export
|
|
18
|
-
export
|
|
12
|
+
export declare function requestRecordingPermissionsAsync(): Promise<PermissionResponse>;
|
|
13
|
+
export declare function getRecordingPermissionsAsync(): Promise<PermissionResponse>;
|
|
14
|
+
export { AudioModule };
|
|
19
15
|
//# sourceMappingURL=ExpoAudio.web.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAudio.web.d.ts","sourceRoot":"","sources":["../src/ExpoAudio.web.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ExpoAudio.web.d.ts","sourceRoot":"","sources":["../src/ExpoAudio.web.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AA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AudioPlayer, AudioRecorder } from './AudioModule.types';
|
|
4
3
|
import * as AudioModule from './AudioModule.web';
|
|
5
4
|
import { AUDIO_SAMPLE_UPDATE, PLAYBACK_STATUS_UPDATE, RECORDING_STATUS_UPDATE } from './ExpoAudio';
|
|
6
5
|
import { createRecordingOptions } from './utils/options';
|
|
@@ -59,7 +58,11 @@ export async function setIsAudioActiveAsync(active) {
|
|
|
59
58
|
export async function setAudioModeAsync(mode) {
|
|
60
59
|
return await AudioModule.setAudioModeAsync(mode);
|
|
61
60
|
}
|
|
62
|
-
export
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
export async function requestRecordingPermissionsAsync() {
|
|
62
|
+
return await AudioModule.requestRecordingPermissionsAsync();
|
|
63
|
+
}
|
|
64
|
+
export async function getRecordingPermissionsAsync() {
|
|
65
|
+
return await AudioModule.getRecordingPermissionsAsync();
|
|
66
|
+
}
|
|
67
|
+
export { AudioModule };
|
|
65
68
|
//# sourceMappingURL=ExpoAudio.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ExpoAudio.web.js","sourceRoot":"","sources":["../src/ExpoAudio.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"ExpoAudio.web.js","sourceRoot":"","sources":["../src/ExpoAudio.web.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAEhC,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAWrD,OAAO,KAAK,WAAW,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAAE,mBAAmB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACnG,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,MAAM,U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D,OAAO,MAAM,WAAW,CAAC,iBAAiB,CAAC,IAAI,CAAC,CAAC;AACnD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,gCAAgC;IACpD,OAAO,MAAM,WAAW,CAAC,gCAAgC,EAAE,CAAC;AAC9D,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,4BAA4B;IAChD,OAAO,MAAM,WAAW,CAAC,4BAA4B,EAAE,CAAC;AAC1D,CAAC;AAED,OAAO,EAAE,WAAW,EAAE,CAAC","sourcesContent":["import { useEvent } from 'expo';\nimport { PermissionResponse } from 'expo-modules-core';\nimport { useEffect, useState, useMemo } from 'react';\n\nimport {\n AudioMode,\n AudioSource,\n AudioStatus,\n RecorderState,\n RecordingOptions,\n RecordingStatus,\n} from './Audio.types';\nimport { AudioRecorder, AudioSample } from './AudioModule.types';\nimport * as AudioModule from './AudioModule.web';\nimport { AUDIO_SAMPLE_UPDATE, PLAYBACK_STATUS_UPDATE, RECORDING_STATUS_UPDATE } from './ExpoAudio';\nimport { createRecordingOptions } from './utils/options';\nimport { resolveSource } from './utils/resolveSource';\n\nexport function useAudioPlayer(\n source: AudioSource | string | number | null = null,\n updateInterval: number = 500\n): AudioModule.AudioPlayerWeb {\n const parsedSource = resolveSource(source);\n const player = useMemo(\n () => new AudioModule.AudioPlayerWeb(parsedSource, updateInterval),\n [JSON.stringify(parsedSource)]\n );\n\n useEffect(() => {\n return () => player.remove();\n }, []);\n\n return player;\n}\n\nexport function useAudioPlayerStatus(player: AudioModule.AudioPlayerWeb): AudioStatus {\n const currentStatus = useMemo(() => player.currentStatus, [player.id]);\n return useEvent(player, PLAYBACK_STATUS_UPDATE, currentStatus);\n}\n\nexport function useAudioSampleListener(\n player: AudioModule.AudioPlayerWeb,\n listener: (data: AudioSample) => void\n) {\n player.setAudioSamplingEnabled(true);\n useEffect(() => {\n const subscription = player.addListener(AUDIO_SAMPLE_UPDATE, listener);\n return () => {\n player.setAudioSamplingEnabled(false);\n subscription.remove();\n };\n }, [player.id]);\n}\n\nexport function useAudioRecorder(\n options: RecordingOptions,\n statusListener?: (status: RecordingStatus) => void\n): AudioModule.AudioRecorderWeb {\n const platformOptions = createRecordingOptions(options);\n const recorder = useMemo(() => {\n return new AudioModule.AudioRecorderWeb(platformOptions);\n }, [JSON.stringify(platformOptions)]);\n\n useEffect(() => {\n const subscription = recorder.addListener(RECORDING_STATUS_UPDATE, (status) => {\n statusListener?.(status);\n });\n return () => {\n recorder.clearTimeouts();\n subscription.remove();\n };\n }, [recorder.id]);\n\n return recorder;\n}\n\nexport function useAudioRecorderState(recorder: AudioRecorder, interval: number = 500) {\n const [state, setState] = useState<RecorderState>(recorder.getStatus());\n\n useEffect(() => {\n const id = setInterval(() => {\n setState(recorder.getStatus());\n }, interval);\n\n return () => clearInterval(id);\n }, [recorder.id]);\n\n return state;\n}\n\nexport async function setIsAudioActiveAsync(active: boolean): Promise<void> {\n return await AudioModule.setIsAudioActiveAsync(active);\n}\n\nexport async function setAudioModeAsync(mode: AudioMode): Promise<void> {\n return await AudioModule.setAudioModeAsync(mode);\n}\n\nexport async function requestRecordingPermissionsAsync(): Promise<PermissionResponse> {\n return await AudioModule.requestRecordingPermissionsAsync();\n}\n\nexport async function getRecordingPermissionsAsync(): Promise<PermissionResponse> {\n return await AudioModule.getRecordingPermissionsAsync();\n}\n\nexport { AudioModule };\n"]}
|
|
@@ -4,23 +4,18 @@ import { type RecordingOptions } from './Audio.types';
|
|
|
4
4
|
*
|
|
5
5
|
* # `HIGH_QUALITY`
|
|
6
6
|
* ```ts
|
|
7
|
-
*
|
|
8
|
-
*
|
|
7
|
+
* RecordingPresets.HIGH_QUALITY = {
|
|
8
|
+
* extension: '.m4a',
|
|
9
|
+
* sampleRate: 44100,
|
|
10
|
+
* numberOfChannels: 2,
|
|
11
|
+
* bitRate: 128000,
|
|
9
12
|
* android: {
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* audioEncoder: AndroidAudioEncoder.AAC,
|
|
13
|
-
* sampleRate: 44100,
|
|
14
|
-
* numberOfChannels: 2,
|
|
15
|
-
* bitRate: 128000,
|
|
13
|
+
* outputFormat: 'mpeg4',
|
|
14
|
+
* audioEncoder: 'aac',
|
|
16
15
|
* },
|
|
17
16
|
* ios: {
|
|
18
|
-
* extension: '.m4a',
|
|
19
17
|
* outputFormat: IOSOutputFormat.MPEG4AAC,
|
|
20
|
-
* audioQuality:
|
|
21
|
-
* sampleRate: 44100,
|
|
22
|
-
* numberOfChannels: 2,
|
|
23
|
-
* bitRate: 128000,
|
|
18
|
+
* audioQuality: AudioQuality.MAX,
|
|
24
19
|
* linearPCMBitDepth: 16,
|
|
25
20
|
* linearPCMIsBigEndian: false,
|
|
26
21
|
* linearPCMIsFloat: false,
|
|
@@ -34,22 +29,19 @@ import { type RecordingOptions } from './Audio.types';
|
|
|
34
29
|
*
|
|
35
30
|
* # `LOW_QUALITY`
|
|
36
31
|
* ```ts
|
|
37
|
-
*
|
|
38
|
-
*
|
|
32
|
+
* RecordingPresets.LOW_QUALITY = {
|
|
33
|
+
* extension: '.m4a',
|
|
34
|
+
* sampleRate: 44100,
|
|
35
|
+
* numberOfChannels: 2,
|
|
36
|
+
* bitRate: 64000,
|
|
39
37
|
* android: {
|
|
40
38
|
* extension: '.3gp',
|
|
41
|
-
* outputFormat:
|
|
42
|
-
* audioEncoder:
|
|
43
|
-
* sampleRate: 44100,
|
|
44
|
-
* numberOfChannels: 2,
|
|
45
|
-
* bitRate: 128000,
|
|
39
|
+
* outputFormat: '3gp',
|
|
40
|
+
* audioEncoder: 'amr_nb',
|
|
46
41
|
* },
|
|
47
42
|
* ios: {
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* sampleRate: 44100,
|
|
51
|
-
* numberOfChannels: 2,
|
|
52
|
-
* bitRate: 128000,
|
|
43
|
+
* audioQuality: AudioQuality.MIN,
|
|
44
|
+
* outputFormat: IOSOutputFormat.MPEG4AAC,
|
|
53
45
|
* linearPCMBitDepth: 16,
|
|
54
46
|
* linearPCMIsBigEndian: false,
|
|
55
47
|
* linearPCMIsFloat: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordingConstants.d.ts","sourceRoot":"","sources":["../src/RecordingConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,gBAAgB,EAAgB,MAAM,eAAe,CAAC;AA+CrF
|
|
1
|
+
{"version":3,"file":"RecordingConstants.d.ts","sourceRoot":"","sources":["../src/RecordingConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,gBAAgB,EAAgB,MAAM,eAAe,CAAC;AA+CrF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAG7D,CAAC"}
|
|
@@ -47,23 +47,18 @@ const LOW_QUALITY = {
|
|
|
47
47
|
*
|
|
48
48
|
* # `HIGH_QUALITY`
|
|
49
49
|
* ```ts
|
|
50
|
-
*
|
|
51
|
-
*
|
|
50
|
+
* RecordingPresets.HIGH_QUALITY = {
|
|
51
|
+
* extension: '.m4a',
|
|
52
|
+
* sampleRate: 44100,
|
|
53
|
+
* numberOfChannels: 2,
|
|
54
|
+
* bitRate: 128000,
|
|
52
55
|
* android: {
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* audioEncoder: AndroidAudioEncoder.AAC,
|
|
56
|
-
* sampleRate: 44100,
|
|
57
|
-
* numberOfChannels: 2,
|
|
58
|
-
* bitRate: 128000,
|
|
56
|
+
* outputFormat: 'mpeg4',
|
|
57
|
+
* audioEncoder: 'aac',
|
|
59
58
|
* },
|
|
60
59
|
* ios: {
|
|
61
|
-
* extension: '.m4a',
|
|
62
60
|
* outputFormat: IOSOutputFormat.MPEG4AAC,
|
|
63
|
-
* audioQuality:
|
|
64
|
-
* sampleRate: 44100,
|
|
65
|
-
* numberOfChannels: 2,
|
|
66
|
-
* bitRate: 128000,
|
|
61
|
+
* audioQuality: AudioQuality.MAX,
|
|
67
62
|
* linearPCMBitDepth: 16,
|
|
68
63
|
* linearPCMIsBigEndian: false,
|
|
69
64
|
* linearPCMIsFloat: false,
|
|
@@ -77,22 +72,19 @@ const LOW_QUALITY = {
|
|
|
77
72
|
*
|
|
78
73
|
* # `LOW_QUALITY`
|
|
79
74
|
* ```ts
|
|
80
|
-
*
|
|
81
|
-
*
|
|
75
|
+
* RecordingPresets.LOW_QUALITY = {
|
|
76
|
+
* extension: '.m4a',
|
|
77
|
+
* sampleRate: 44100,
|
|
78
|
+
* numberOfChannels: 2,
|
|
79
|
+
* bitRate: 64000,
|
|
82
80
|
* android: {
|
|
83
81
|
* extension: '.3gp',
|
|
84
|
-
* outputFormat:
|
|
85
|
-
* audioEncoder:
|
|
86
|
-
* sampleRate: 44100,
|
|
87
|
-
* numberOfChannels: 2,
|
|
88
|
-
* bitRate: 128000,
|
|
82
|
+
* outputFormat: '3gp',
|
|
83
|
+
* audioEncoder: 'amr_nb',
|
|
89
84
|
* },
|
|
90
85
|
* ios: {
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
* sampleRate: 44100,
|
|
94
|
-
* numberOfChannels: 2,
|
|
95
|
-
* bitRate: 128000,
|
|
86
|
+
* audioQuality: AudioQuality.MIN,
|
|
87
|
+
* outputFormat: IOSOutputFormat.MPEG4AAC,
|
|
96
88
|
* linearPCMBitDepth: 16,
|
|
97
89
|
* linearPCMIsBigEndian: false,
|
|
98
90
|
* linearPCMIsFloat: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"RecordingConstants.js","sourceRoot":"","sources":["../src/RecordingConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAyB,YAAY,EAAE,MAAM,eAAe,CAAC;AAErF,MAAM,YAAY,GAAqB;IACrC,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,KAAK;IACjB,gBAAgB,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM;IACf,OAAO,EAAE;QACP,YAAY,EAAE,OAAO;QACrB,YAAY,EAAE,KAAK;KACpB;IACD,GAAG,EAAE;QACH,YAAY,EAAE,eAAe,CAAC,QAAQ;QACtC,YAAY,EAAE,YAAY,CAAC,GAAG;QAC9B,iBAAiB,EAAE,EAAE;QACrB,oBAAoB,EAAE,KAAK;QAC3B,gBAAgB,EAAE,KAAK;KACxB;IACD,GAAG,EAAE;QACH,QAAQ,EAAE,YAAY;QACtB,aAAa,EAAE,MAAM;KACtB;CACF,CAAC;AAEF,MAAM,WAAW,GAAqB;IACpC,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,KAAK;IACjB,gBAAgB,EAAE,CAAC;IACnB,OAAO,EAAE,KAAK;IACd,OAAO,EAAE;QACP,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,QAAQ;KACvB;IACD,GAAG,EAAE;QACH,YAAY,EAAE,YAAY,CAAC,GAAG;QAC9B,YAAY,EAAE,eAAe,CAAC,QAAQ;QACtC,iBAAiB,EAAE,EAAE;QACrB,oBAAoB,EAAE,KAAK;QAC3B,gBAAgB,EAAE,KAAK;KACxB;IACD,GAAG,EAAE;QACH,QAAQ,EAAE,YAAY;QACtB,aAAa,EAAE,MAAM;KACtB;CACF,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"RecordingConstants.js","sourceRoot":"","sources":["../src/RecordingConstants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAyB,YAAY,EAAE,MAAM,eAAe,CAAC;AAErF,MAAM,YAAY,GAAqB;IACrC,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,KAAK;IACjB,gBAAgB,EAAE,CAAC;IACnB,OAAO,EAAE,MAAM;IACf,OAAO,EAAE;QACP,YAAY,EAAE,OAAO;QACrB,YAAY,EAAE,KAAK;KACpB;IACD,GAAG,EAAE;QACH,YAAY,EAAE,eAAe,CAAC,QAAQ;QACtC,YAAY,EAAE,YAAY,CAAC,GAAG;QAC9B,iBAAiB,EAAE,EAAE;QACrB,oBAAoB,EAAE,KAAK;QAC3B,gBAAgB,EAAE,KAAK;KACxB;IACD,GAAG,EAAE;QACH,QAAQ,EAAE,YAAY;QACtB,aAAa,EAAE,MAAM;KACtB;CACF,CAAC;AAEF,MAAM,WAAW,GAAqB;IACpC,SAAS,EAAE,MAAM;IACjB,UAAU,EAAE,KAAK;IACjB,gBAAgB,EAAE,CAAC;IACnB,OAAO,EAAE,KAAK;IACd,OAAO,EAAE;QACP,SAAS,EAAE,MAAM;QACjB,YAAY,EAAE,KAAK;QACnB,YAAY,EAAE,QAAQ;KACvB;IACD,GAAG,EAAE;QACH,YAAY,EAAE,YAAY,CAAC,GAAG;QAC9B,YAAY,EAAE,eAAe,CAAC,QAAQ;QACtC,iBAAiB,EAAE,EAAE;QACrB,oBAAoB,EAAE,KAAK;QAC3B,gBAAgB,EAAE,KAAK;KACxB;IACD,GAAG,EAAE;QACH,QAAQ,EAAE,YAAY;QACtB,aAAa,EAAE,MAAM;KACtB;CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqDG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAqC;IAChE,YAAY;IACZ,WAAW;CACZ,CAAC","sourcesContent":["import { IOSOutputFormat, type RecordingOptions, AudioQuality } from './Audio.types';\n\nconst HIGH_QUALITY: RecordingOptions = {\n extension: '.m4a',\n sampleRate: 44100,\n numberOfChannels: 2,\n bitRate: 128000,\n android: {\n outputFormat: 'mpeg4',\n audioEncoder: 'aac',\n },\n ios: {\n outputFormat: IOSOutputFormat.MPEG4AAC,\n audioQuality: AudioQuality.MAX,\n linearPCMBitDepth: 16,\n linearPCMIsBigEndian: false,\n linearPCMIsFloat: false,\n },\n web: {\n mimeType: 'audio/webm',\n bitsPerSecond: 128000,\n },\n};\n\nconst LOW_QUALITY: RecordingOptions = {\n extension: '.m4a',\n sampleRate: 44100,\n numberOfChannels: 2,\n bitRate: 64000,\n android: {\n extension: '.3gp',\n outputFormat: '3gp',\n audioEncoder: 'amr_nb',\n },\n ios: {\n audioQuality: AudioQuality.MIN,\n outputFormat: IOSOutputFormat.MPEG4AAC,\n linearPCMBitDepth: 16,\n linearPCMIsBigEndian: false,\n linearPCMIsFloat: false,\n },\n web: {\n mimeType: 'audio/webm',\n bitsPerSecond: 128000,\n },\n};\n\n/**\n * Constant which contains definitions of the two preset examples of `RecordingOptions`, as implemented in the Audio SDK.\n *\n * # `HIGH_QUALITY`\n * ```ts\n * RecordingPresets.HIGH_QUALITY = {\n * extension: '.m4a',\n * sampleRate: 44100,\n * numberOfChannels: 2,\n * bitRate: 128000,\n * android: {\n * outputFormat: 'mpeg4',\n * audioEncoder: 'aac',\n * },\n * ios: {\n * outputFormat: IOSOutputFormat.MPEG4AAC,\n * audioQuality: AudioQuality.MAX,\n * linearPCMBitDepth: 16,\n * linearPCMIsBigEndian: false,\n * linearPCMIsFloat: false,\n * },\n * web: {\n * mimeType: 'audio/webm',\n * bitsPerSecond: 128000,\n * },\n * };\n * ```\n *\n * # `LOW_QUALITY`\n * ```ts\n * RecordingPresets.LOW_QUALITY = {\n * extension: '.m4a',\n * sampleRate: 44100,\n * numberOfChannels: 2,\n * bitRate: 64000,\n * android: {\n * extension: '.3gp',\n * outputFormat: '3gp',\n * audioEncoder: 'amr_nb',\n * },\n * ios: {\n * audioQuality: AudioQuality.MIN,\n * outputFormat: IOSOutputFormat.MPEG4AAC,\n * linearPCMBitDepth: 16,\n * linearPCMIsBigEndian: false,\n * linearPCMIsFloat: false,\n * },\n * web: {\n * mimeType: 'audio/webm',\n * bitsPerSecond: 128000,\n * },\n * };\n * ```\n */\nexport const RecordingPresets: Record<string, RecordingOptions> = {\n HIGH_QUALITY,\n LOW_QUALITY,\n};\n"]}
|
package/build/index.d.ts
CHANGED
|
@@ -1,2 +1,6 @@
|
|
|
1
|
+
export { PermissionResponse, PermissionExpiration, PermissionStatus } from 'expo-modules-core';
|
|
1
2
|
export * from './ExpoAudio';
|
|
3
|
+
export * from './Audio.types';
|
|
4
|
+
export * from './AudioModule.types';
|
|
5
|
+
export * from './RecordingConstants';
|
|
2
6
|
//# sourceMappingURL=index.d.ts.map
|
package/build/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE/F,cAAc,aAAa,CAAC;AAE5B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
|
package/build/index.js
CHANGED
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC","sourcesContent":["export * from './ExpoAudio';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4C,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE/F,cAAc,aAAa,CAAC;AAE5B,cAAc,eAAe,CAAC;AAC9B,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC","sourcesContent":["export { PermissionResponse, PermissionExpiration, PermissionStatus } from 'expo-modules-core';\n\nexport * from './ExpoAudio';\n\nexport * from './Audio.types';\nexport * from './AudioModule.types';\nexport * from './RecordingConstants';\n"]}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "expo-audio",
|
|
3
3
|
"title": "Expo Audio",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.3",
|
|
5
5
|
"description": "A cross-platform audio library for React Native and Expo apps.",
|
|
6
6
|
"main": "build/index.js",
|
|
7
7
|
"types": "build/index.d.ts",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"react": "*",
|
|
41
41
|
"react-native": "*"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "fc8a1408cab82e003dd2424db2994d7dea958067"
|
|
44
44
|
}
|
package/src/Audio.types.ts
CHANGED
|
@@ -118,25 +118,25 @@ export type RecordingOptions = {
|
|
|
118
118
|
/**
|
|
119
119
|
* The desired file extension.
|
|
120
120
|
*
|
|
121
|
-
* @example
|
|
121
|
+
* @example .caf
|
|
122
122
|
*/
|
|
123
123
|
extension: string;
|
|
124
124
|
/**
|
|
125
125
|
* The desired sample rate.
|
|
126
126
|
*
|
|
127
|
-
* @example
|
|
127
|
+
* @example 44100
|
|
128
128
|
*/
|
|
129
129
|
sampleRate: number;
|
|
130
130
|
/**
|
|
131
131
|
* The desired number of channels.
|
|
132
132
|
*
|
|
133
|
-
* @example
|
|
133
|
+
* @example 2
|
|
134
134
|
*/
|
|
135
135
|
numberOfChannels: number;
|
|
136
136
|
/**
|
|
137
137
|
* The desired bit rate.
|
|
138
138
|
*
|
|
139
|
-
* @example
|
|
139
|
+
* @example 128000
|
|
140
140
|
*/
|
|
141
141
|
bitRate: number;
|
|
142
142
|
/**
|
|
@@ -162,13 +162,13 @@ export type RecordingOptionsIos = {
|
|
|
162
162
|
/**
|
|
163
163
|
* The desired file extension.
|
|
164
164
|
*
|
|
165
|
-
* @example
|
|
165
|
+
* @example .caf
|
|
166
166
|
*/
|
|
167
167
|
extension?: string;
|
|
168
168
|
/**
|
|
169
169
|
* The desired sample rate.
|
|
170
170
|
*
|
|
171
|
-
* @example
|
|
171
|
+
* @example 44100
|
|
172
172
|
*/
|
|
173
173
|
sampleRate?: number;
|
|
174
174
|
/**
|
|
@@ -176,7 +176,7 @@ export type RecordingOptionsIos = {
|
|
|
176
176
|
*/
|
|
177
177
|
outputFormat?: string | IOSOutputFormat | number;
|
|
178
178
|
/**
|
|
179
|
-
* The desired audio quality. See the [`
|
|
179
|
+
* The desired audio quality. See the [`AudioQuality`](#audioquality) enum for all valid values.
|
|
180
180
|
*/
|
|
181
181
|
audioQuality: AudioQuality | number;
|
|
182
182
|
/**
|
|
@@ -186,15 +186,13 @@ export type RecordingOptionsIos = {
|
|
|
186
186
|
/**
|
|
187
187
|
* The desired bit depth hint.
|
|
188
188
|
*
|
|
189
|
-
* @example
|
|
190
|
-
* `16`
|
|
189
|
+
* @example 16
|
|
191
190
|
*/
|
|
192
191
|
bitDepthHint?: number;
|
|
193
192
|
/**
|
|
194
193
|
* The desired PCM bit depth.
|
|
195
194
|
*
|
|
196
|
-
* @example
|
|
197
|
-
* `16`
|
|
195
|
+
* @example 16
|
|
198
196
|
*/
|
|
199
197
|
linearPCMBitDepth?: number;
|
|
200
198
|
/**
|
|
@@ -211,13 +209,13 @@ export type RecordingOptionsAndroid = {
|
|
|
211
209
|
/**
|
|
212
210
|
* The desired file extension.
|
|
213
211
|
*
|
|
214
|
-
* @example
|
|
212
|
+
* @example .caf
|
|
215
213
|
*/
|
|
216
214
|
extension?: string;
|
|
217
215
|
/**
|
|
218
216
|
* The desired sample rate.
|
|
219
217
|
*
|
|
220
|
-
* @example
|
|
218
|
+
* @example 44100
|
|
221
219
|
*/
|
|
222
220
|
sampleRate?: number;
|
|
223
221
|
/**
|
package/src/AudioModule.ts
CHANGED
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { requireNativeModule } from 'expo-modules-core';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import { NativeAudioModule } from './AudioModule.types';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @hidden
|
|
7
|
+
*/
|
|
8
|
+
export default requireNativeModule<NativeAudioModule>('ExpoAudio');
|
package/src/AudioModule.types.ts
CHANGED
|
@@ -11,18 +11,19 @@ import {
|
|
|
11
11
|
RecordingStatus,
|
|
12
12
|
} from './Audio.types';
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
/**
|
|
15
|
+
* @hidden
|
|
16
|
+
*/
|
|
17
|
+
export declare class NativeAudioModule {
|
|
15
18
|
setIsAudioActiveAsync(active: boolean): Promise<void>;
|
|
16
19
|
setAudioModeAsync(category: Partial<AudioMode>): Promise<void>;
|
|
17
|
-
requestRecordingPermissionsAsync(): Promise<
|
|
18
|
-
getRecordingPermissionsAsync(): Promise<
|
|
20
|
+
requestRecordingPermissionsAsync(): Promise<PermissionResponse>;
|
|
21
|
+
getRecordingPermissionsAsync(): Promise<PermissionResponse>;
|
|
19
22
|
|
|
20
23
|
readonly AudioPlayer: typeof AudioPlayer;
|
|
21
24
|
readonly AudioRecorder: typeof AudioRecorder;
|
|
22
25
|
}
|
|
23
26
|
|
|
24
|
-
export type RecordingPermissionResponse = PermissionResponse;
|
|
25
|
-
|
|
26
27
|
export declare class AudioPlayer extends SharedObject<AudioEvents> {
|
|
27
28
|
/**
|
|
28
29
|
* Initializes a new audio player instance with the given source.
|
|
@@ -76,7 +77,7 @@ export declare class AudioPlayer extends SharedObject<AudioEvents> {
|
|
|
76
77
|
currentTime: number;
|
|
77
78
|
|
|
78
79
|
/**
|
|
79
|
-
* The total duration of the audio
|
|
80
|
+
* The total duration of the audio in seconds.
|
|
80
81
|
*/
|
|
81
82
|
duration: number;
|
|
82
83
|
|
|
@@ -102,7 +103,7 @@ export declare class AudioPlayer extends SharedObject<AudioEvents> {
|
|
|
102
103
|
currentStatus: AudioStatus;
|
|
103
104
|
|
|
104
105
|
/**
|
|
105
|
-
*
|
|
106
|
+
* Start playing audio.
|
|
106
107
|
*/
|
|
107
108
|
play(): void;
|
|
108
109
|
|
|
@@ -122,7 +123,7 @@ export declare class AudioPlayer extends SharedObject<AudioEvents> {
|
|
|
122
123
|
* @param rate The playback rate of the audio.
|
|
123
124
|
* @param pitchCorrectionQuality The quality of the pitch correction.
|
|
124
125
|
*/
|
|
125
|
-
setPlaybackRate(
|
|
126
|
+
setPlaybackRate(rate: number, pitchCorrectionQuality?: PitchCorrectionQuality): void;
|
|
126
127
|
|
|
127
128
|
/**
|
|
128
129
|
*
|
|
@@ -136,11 +137,13 @@ export declare class AudioPlayer extends SharedObject<AudioEvents> {
|
|
|
136
137
|
remove(): void;
|
|
137
138
|
}
|
|
138
139
|
|
|
139
|
-
type AudioSample = {
|
|
140
|
-
channels:
|
|
140
|
+
export type AudioSample = {
|
|
141
|
+
channels: AudioSampleChannel[];
|
|
141
142
|
timestamp: number;
|
|
142
143
|
};
|
|
143
144
|
|
|
145
|
+
export type AudioSampleChannel = { frames: number[] };
|
|
146
|
+
|
|
144
147
|
export type AudioEvents = {
|
|
145
148
|
playbackStatusUpdate(status: AudioStatus): void;
|
|
146
149
|
audioSampleUpdate(data: AudioSample): void;
|
|
@@ -205,7 +208,7 @@ export declare class AudioRecorder extends SharedObject<RecordingEvents> {
|
|
|
205
208
|
* @param inputUid The uid of a `RecordingInput`.
|
|
206
209
|
* @return A `Promise` that is resolved if successful or rejected if not.
|
|
207
210
|
*/
|
|
208
|
-
setInput(
|
|
211
|
+
setInput(inputUid: string): void;
|
|
209
212
|
|
|
210
213
|
/**
|
|
211
214
|
* Status of the current recording.
|
package/src/ExpoAudio.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { useEvent } from 'expo';
|
|
2
|
-
import { useReleasingSharedObject } from 'expo-modules-core';
|
|
2
|
+
import { PermissionResponse, useReleasingSharedObject } from 'expo-modules-core';
|
|
3
3
|
import { useEffect, useState, useMemo } from 'react';
|
|
4
4
|
|
|
5
5
|
import {
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
RecordingStatus,
|
|
12
12
|
} from './Audio.types';
|
|
13
13
|
import AudioModule from './AudioModule';
|
|
14
|
-
import { AudioPlayer, AudioRecorder } from './AudioModule.types';
|
|
14
|
+
import { AudioPlayer, AudioRecorder, AudioSample } from './AudioModule.types';
|
|
15
15
|
import { createRecordingOptions } from './utils/options';
|
|
16
16
|
import { resolveSource } from './utils/resolveSource';
|
|
17
17
|
|
|
@@ -35,10 +35,7 @@ export function useAudioPlayerStatus(player: AudioPlayer): AudioStatus {
|
|
|
35
35
|
return useEvent(player, PLAYBACK_STATUS_UPDATE, currentStatus);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export function useAudioSampleListener(
|
|
39
|
-
player: AudioPlayer,
|
|
40
|
-
listener: (data: { channels: { frames: number[] }[]; timestamp: number }) => void
|
|
41
|
-
) {
|
|
38
|
+
export function useAudioSampleListener(player: AudioPlayer, listener: (data: AudioSample) => void) {
|
|
42
39
|
player.setAudioSamplingEnabled(true);
|
|
43
40
|
useEffect(() => {
|
|
44
41
|
if (!player.isAudioSamplingSupported) {
|
|
@@ -92,6 +89,12 @@ export async function setAudioModeAsync(mode: Partial<AudioMode>): Promise<void>
|
|
|
92
89
|
return await AudioModule.setAudioModeAsync(mode);
|
|
93
90
|
}
|
|
94
91
|
|
|
95
|
-
export
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
export async function requestRecordingPermissionsAsync(): Promise<PermissionResponse> {
|
|
93
|
+
return await AudioModule.requestRecordingPermissionsAsync();
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export async function getRecordingPermissionsAsync(): Promise<PermissionResponse> {
|
|
97
|
+
return await AudioModule.getRecordingPermissionsAsync();
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export { AudioModule };
|
package/src/ExpoAudio.web.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { useEvent } from 'expo';
|
|
2
|
+
import { PermissionResponse } from 'expo-modules-core';
|
|
2
3
|
import { useEffect, useState, useMemo } from 'react';
|
|
3
4
|
|
|
4
5
|
import {
|
|
@@ -9,7 +10,7 @@ import {
|
|
|
9
10
|
RecordingOptions,
|
|
10
11
|
RecordingStatus,
|
|
11
12
|
} from './Audio.types';
|
|
12
|
-
import {
|
|
13
|
+
import { AudioRecorder, AudioSample } from './AudioModule.types';
|
|
13
14
|
import * as AudioModule from './AudioModule.web';
|
|
14
15
|
import { AUDIO_SAMPLE_UPDATE, PLAYBACK_STATUS_UPDATE, RECORDING_STATUS_UPDATE } from './ExpoAudio';
|
|
15
16
|
import { createRecordingOptions } from './utils/options';
|
|
@@ -39,7 +40,7 @@ export function useAudioPlayerStatus(player: AudioModule.AudioPlayerWeb): AudioS
|
|
|
39
40
|
|
|
40
41
|
export function useAudioSampleListener(
|
|
41
42
|
player: AudioModule.AudioPlayerWeb,
|
|
42
|
-
listener: (data:
|
|
43
|
+
listener: (data: AudioSample) => void
|
|
43
44
|
) {
|
|
44
45
|
player.setAudioSamplingEnabled(true);
|
|
45
46
|
useEffect(() => {
|
|
@@ -95,6 +96,12 @@ export async function setAudioModeAsync(mode: AudioMode): Promise<void> {
|
|
|
95
96
|
return await AudioModule.setAudioModeAsync(mode);
|
|
96
97
|
}
|
|
97
98
|
|
|
98
|
-
export
|
|
99
|
-
|
|
100
|
-
|
|
99
|
+
export async function requestRecordingPermissionsAsync(): Promise<PermissionResponse> {
|
|
100
|
+
return await AudioModule.requestRecordingPermissionsAsync();
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export async function getRecordingPermissionsAsync(): Promise<PermissionResponse> {
|
|
104
|
+
return await AudioModule.getRecordingPermissionsAsync();
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export { AudioModule };
|
|
@@ -50,23 +50,18 @@ const LOW_QUALITY: RecordingOptions = {
|
|
|
50
50
|
*
|
|
51
51
|
* # `HIGH_QUALITY`
|
|
52
52
|
* ```ts
|
|
53
|
-
*
|
|
54
|
-
*
|
|
53
|
+
* RecordingPresets.HIGH_QUALITY = {
|
|
54
|
+
* extension: '.m4a',
|
|
55
|
+
* sampleRate: 44100,
|
|
56
|
+
* numberOfChannels: 2,
|
|
57
|
+
* bitRate: 128000,
|
|
55
58
|
* android: {
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
* audioEncoder: AndroidAudioEncoder.AAC,
|
|
59
|
-
* sampleRate: 44100,
|
|
60
|
-
* numberOfChannels: 2,
|
|
61
|
-
* bitRate: 128000,
|
|
59
|
+
* outputFormat: 'mpeg4',
|
|
60
|
+
* audioEncoder: 'aac',
|
|
62
61
|
* },
|
|
63
62
|
* ios: {
|
|
64
|
-
* extension: '.m4a',
|
|
65
63
|
* outputFormat: IOSOutputFormat.MPEG4AAC,
|
|
66
|
-
* audioQuality:
|
|
67
|
-
* sampleRate: 44100,
|
|
68
|
-
* numberOfChannels: 2,
|
|
69
|
-
* bitRate: 128000,
|
|
64
|
+
* audioQuality: AudioQuality.MAX,
|
|
70
65
|
* linearPCMBitDepth: 16,
|
|
71
66
|
* linearPCMIsBigEndian: false,
|
|
72
67
|
* linearPCMIsFloat: false,
|
|
@@ -80,22 +75,19 @@ const LOW_QUALITY: RecordingOptions = {
|
|
|
80
75
|
*
|
|
81
76
|
* # `LOW_QUALITY`
|
|
82
77
|
* ```ts
|
|
83
|
-
*
|
|
84
|
-
*
|
|
78
|
+
* RecordingPresets.LOW_QUALITY = {
|
|
79
|
+
* extension: '.m4a',
|
|
80
|
+
* sampleRate: 44100,
|
|
81
|
+
* numberOfChannels: 2,
|
|
82
|
+
* bitRate: 64000,
|
|
85
83
|
* android: {
|
|
86
84
|
* extension: '.3gp',
|
|
87
|
-
* outputFormat:
|
|
88
|
-
* audioEncoder:
|
|
89
|
-
* sampleRate: 44100,
|
|
90
|
-
* numberOfChannels: 2,
|
|
91
|
-
* bitRate: 128000,
|
|
85
|
+
* outputFormat: '3gp',
|
|
86
|
+
* audioEncoder: 'amr_nb',
|
|
92
87
|
* },
|
|
93
88
|
* ios: {
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
* sampleRate: 44100,
|
|
97
|
-
* numberOfChannels: 2,
|
|
98
|
-
* bitRate: 128000,
|
|
89
|
+
* audioQuality: AudioQuality.MIN,
|
|
90
|
+
* outputFormat: IOSOutputFormat.MPEG4AAC,
|
|
99
91
|
* linearPCMBitDepth: 16,
|
|
100
92
|
* linearPCMIsBigEndian: false,
|
|
101
93
|
* linearPCMIsFloat: false,
|
package/src/index.ts
CHANGED