@siteed/expo-audio-studio 2.8.1 → 2.8.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 CHANGED
@@ -8,6 +8,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
  ## [Unreleased]
9
9
 
10
10
 
11
+ ## [2.8.3] - 2025-05-06
12
+ ### Changed
13
+ - chore(expo-audio-studio): update plugin configuration to use ESM format and streamline build process ([97432eb](https://github.com/deeeed/expo-audio-stream/commit/97432eb2944f43e03a1464fdc166a49392582b08))
14
+ - chore(expo-audio-studio): release @siteed/expo-audio-studio@2.8.2 ([255c802](https://github.com/deeeed/expo-audio-stream/commit/255c802feacec8e4ba21bf442381062620d9b5f0))
15
+ ## [2.8.2] - 2025-05-06
16
+ ### Changed
17
+ - chore(expo-audio-studio): update TypeScript configurations for dual module support and enhance CommonJS compatibility ([7377a5f](https://github.com/deeeed/expo-audio-stream/commit/7377a5fd3925a21d8628eb31b64c8c65102a1713))
18
+ - chore(expo-audio-studio): release @siteed/expo-audio-studio@2.8.1 ([78721e4](https://github.com/deeeed/expo-audio-stream/commit/78721e41bbc9e4e999118474c887cca7b5420915))
11
19
  ## [2.8.1] - 2025-05-06
12
20
  ### Changed
13
21
  - feat(expo-audio-studio): implement dual module format (ESM/CommonJS) to resolve module resolution issues (#235) ([58c5a94](https://github.com/deeeed/expo-audio-stream/commit/58c5a94ecf2fdcefa554b2f8664743730001e6d8))
@@ -226,7 +234,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
226
234
  - Feature: Audio features extraction during recording.
227
235
  - Feature: Consistent WAV PCM recording format across all platforms.
228
236
 
229
- [unreleased]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.8.1...HEAD
237
+ [unreleased]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.8.3...HEAD
238
+ [2.8.3]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.8.2...@siteed/expo-audio-studio@2.8.3
239
+ [2.8.2]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.8.1...@siteed/expo-audio-studio@2.8.2
230
240
  [2.8.1]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.8.0...@siteed/expo-audio-studio@2.8.1
231
241
  [2.8.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.7.0...@siteed/expo-audio-studio@2.8.0
232
242
  [2.7.0]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.6.3...@siteed/expo-audio-studio@2.7.0
package/app.plugin.cjs CHANGED
@@ -1,7 +1,7 @@
1
- // This is a CommonJS file (.cjs) which loads the plugin configuration
1
+ // only here for ts-node and projects using app.config.ts instead of app.json.
2
2
  try {
3
3
  // Export the plugin from its CommonJS build
4
- module.exports = require('./plugin/build/index.cjs')
4
+ module.exports = require('./plugin/build/')
5
5
  } catch (error) {
6
6
  console.error(
7
7
  '[@siteed/expo-audio-studio] Plugin loading error:',
package/app.plugin.js ADDED
@@ -0,0 +1 @@
1
+ module.exports = require('./plugin/build')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siteed/expo-audio-studio",
3
- "version": "2.8.1",
3
+ "version": "2.8.3",
4
4
  "description": "Comprehensive audio processing library for React Native and Expo with recording, analysis, visualization, and streaming capabilities across iOS, Android, and web",
5
5
  "license": "MIT",
6
6
  "type": "commonjs",
@@ -17,7 +17,7 @@
17
17
  "./package.json": "./package.json"
18
18
  },
19
19
  "expo": {
20
- "plugin": "./app.plugin.cjs"
20
+ "plugin": "./app.plugin.js"
21
21
  },
22
22
  "author": "Arthur Breton <abreton@siteed.net> (https://github.com/deeeed)",
23
23
  "homepage": "https://github.com/deeeed/expo-audio-stream/blob/main/packages/expo-audio-studio/README.md",
@@ -59,6 +59,7 @@
59
59
  "cpp",
60
60
  "plugin",
61
61
  "app.plugin.cjs",
62
+ "app.plugin.js",
62
63
  "LICENSE",
63
64
  "CHANGELOG.md",
64
65
  "generated",
@@ -79,12 +80,11 @@
79
80
  "!**/.*"
80
81
  ],
81
82
  "scripts": {
82
- "build": "rimraf build && npm run build:types && npm run build:cjs && npm run build:esm && npm run build:plugin",
83
+ "build": "rimraf build && yarn build:types && yarn build:cjs && yarn build:esm && yarn build:plugin",
83
84
  "build:cjs": "tsc -p tsconfig.cjs.json",
84
85
  "build:esm": "tsc -p tsconfig.esm.json",
85
86
  "build:types": "tsc -p tsconfig.types.json",
86
- "build:plugin": "tsc --build plugin/tsconfig.json && npm run build:plugin:cjs",
87
- "build:plugin:cjs": "node -e \"const fs=require('fs');const path=require('path');const content=fs.readFileSync('./plugin/build/index.js','utf8').replace(/export default/,'module.exports =');fs.writeFileSync('./plugin/build/index.cjs',content);\"",
87
+ "build:plugin": "tsc --build plugin/tsconfig.json",
88
88
  "build:plugin:dev": "expo-module build plugin",
89
89
  "build:dev": "expo-module build",
90
90
  "clean": "expo-module clean && rimraf build plugin/build",
@@ -189,4 +189,5 @@ const withRecordingPermission = (config, props) => {
189
189
  debugLog('✨ Recording Permissions Plugin configuration completed');
190
190
  return config;
191
191
  };
192
+ // Export as default
192
193
  exports.default = withRecordingPermission;
@@ -278,4 +278,5 @@ const withRecordingPermission: ConfigPlugin<AudioStreamPluginOptions> = (
278
278
  return config as any
279
279
  }
280
280
 
281
+ // Export as default
281
282
  export default withRecordingPermission
@@ -7,4 +7,4 @@
7
7
  },
8
8
  "include": ["./src"],
9
9
  "exclude": ["**/__mocks__/*", "**/__tests__/*"]
10
- }
10
+ }
@@ -1,192 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_plugins_1 = require("@expo/config-plugins");
4
- const MICROPHONE_USAGE = 'Allow $(PRODUCT_NAME) to access your microphone';
5
- const NOTIFICATION_USAGE = 'Show recording notifications and controls';
6
- const LOG_PREFIX = '[@siteed/expo-audio-studio]';
7
- function debugLog(message, ...args) {
8
- if (process.env.EXPO_DEBUG) {
9
- console.log(`${LOG_PREFIX} ${message}`, ...args);
10
- }
11
- }
12
- const withRecordingPermission = (config, props) => {
13
- const options = {
14
- enablePhoneStateHandling: true, // Default to true for backward compatibility
15
- enableNotifications: true,
16
- enableBackgroundAudio: true,
17
- iosBackgroundModes: {
18
- useVoIP: false,
19
- useAudio: false,
20
- useProcessing: false,
21
- useLocation: false,
22
- useExternalAccessory: false,
23
- },
24
- iosConfig: {
25
- microphoneUsageDescription: MICROPHONE_USAGE,
26
- notificationUsageDescription: NOTIFICATION_USAGE,
27
- },
28
- ...(props || {}),
29
- };
30
- const { enablePhoneStateHandling, enableNotifications, enableBackgroundAudio, } = options;
31
- debugLog('📱 Configuring Recording Permissions Plugin...', options);
32
- // iOS Configuration
33
- config = (0, config_plugins_1.withInfoPlist)(config, (config) => {
34
- // Always set the microphone usage description from options first
35
- config.modResults['NSMicrophoneUsageDescription'] =
36
- options.iosConfig?.microphoneUsageDescription ||
37
- config.modResults['NSMicrophoneUsageDescription'] ||
38
- MICROPHONE_USAGE;
39
- if (enableNotifications) {
40
- config.modResults['NSUserNotificationsUsageDescription'] =
41
- options.iosConfig?.notificationUsageDescription ||
42
- config.modResults['NSUserNotificationsUsageDescription'] ||
43
- NOTIFICATION_USAGE;
44
- config.modResults['NSUserNotificationAlertStyle'] = 'alert';
45
- }
46
- const existingBackgroundModes = config.modResults.UIBackgroundModes || [];
47
- // If background audio is enabled with useAudio, add the audio background mode
48
- if (options.iosBackgroundModes?.useAudio === true &&
49
- enableBackgroundAudio === true &&
50
- !existingBackgroundModes.includes('audio')) {
51
- // Add 'audio' background mode - REQUIRED for background recording
52
- existingBackgroundModes.push('audio');
53
- debugLog('✅ Added audio background mode for iOS background recording');
54
- // Also ensure processing mode is recommended
55
- if (options.iosBackgroundModes?.useProcessing !== true) {
56
- console.warn(`${LOG_PREFIX} Warning: Background audio recording works best with both 'audio' and 'processing' background modes. Consider enabling 'useProcessing' in iosBackgroundModes.`);
57
- }
58
- }
59
- if (options.iosBackgroundModes?.useVoIP === true &&
60
- enablePhoneStateHandling === true) {
61
- if (!existingBackgroundModes.includes('voip')) {
62
- existingBackgroundModes.push('voip');
63
- }
64
- const existingCapabilities = (config.modResults
65
- .UIRequiredDeviceCapabilities || []);
66
- if (!existingCapabilities.includes('telephony')) {
67
- existingCapabilities.push('telephony');
68
- }
69
- config.modResults.UIRequiredDeviceCapabilities =
70
- existingCapabilities;
71
- }
72
- // Add additional background modes only if explicitly set to true
73
- if (options.iosBackgroundModes?.useProcessing === true) {
74
- if (!existingBackgroundModes.includes('processing')) {
75
- existingBackgroundModes.push('processing');
76
- }
77
- // Add processing info if enabled
78
- // Note: We keep the 'audiostream' namespace for native modules to maintain compatibility
79
- config.modResults.BGTaskSchedulerPermittedIdentifiers = [
80
- 'com.siteed.audiostream.processing',
81
- ];
82
- }
83
- if (options.iosBackgroundModes?.useLocation === true) {
84
- if (!existingBackgroundModes.includes('location')) {
85
- existingBackgroundModes.push('location');
86
- }
87
- }
88
- if (options.iosBackgroundModes?.useExternalAccessory === true) {
89
- if (!existingBackgroundModes.includes('external-accessory')) {
90
- existingBackgroundModes.push('external-accessory');
91
- }
92
- }
93
- // Configure background processing info if enabled
94
- if (options.iosConfig?.backgroundProcessingTitle) {
95
- config.modResults.BGProcessingTaskTitle =
96
- options.iosConfig.backgroundProcessingTitle;
97
- }
98
- // Configure audio session behavior
99
- if (options.iosConfig?.allowBackgroundAudioControls) {
100
- config.modResults.UIBackgroundModes = [
101
- ...existingBackgroundModes,
102
- 'remote-notification',
103
- ];
104
- config.modResults.MPNowPlayingInfoPropertyPlaybackRate = true;
105
- }
106
- config.modResults.UIBackgroundModes = existingBackgroundModes;
107
- return config;
108
- });
109
- // Android Configuration
110
- config = (0, config_plugins_1.withAndroidManifest)(config, (config) => {
111
- const basePermissions = [
112
- 'android.permission.RECORD_AUDIO',
113
- 'android.permission.WAKE_LOCK',
114
- ];
115
- const optionalPermissions = [
116
- enableNotifications && 'android.permission.POST_NOTIFICATIONS',
117
- enablePhoneStateHandling && 'android.permission.READ_PHONE_STATE', // Only add if enabled
118
- enableBackgroundAudio && 'android.permission.FOREGROUND_SERVICE',
119
- enableBackgroundAudio && 'android.permission.FOREGROUND_SERVICE_MICROPHONE',
120
- ].filter(Boolean);
121
- const permissionsToAdd = [...basePermissions, ...optionalPermissions];
122
- debugLog('📋 Existing Android permissions:', config.modResults.manifest['uses-permission']?.map((p) => p.$?.['android:name']) || []);
123
- debugLog('➕ Adding Android permissions:', permissionsToAdd);
124
- const { addPermission } = config_plugins_1.AndroidConfig.Permissions;
125
- // Add each permission only if it doesn't exist
126
- permissionsToAdd.forEach((permission) => {
127
- const existingPermission = config.modResults.manifest['uses-permission']?.find((p) => p.$?.['android:name'] === permission);
128
- if (!existingPermission) {
129
- addPermission(config.modResults, permission);
130
- }
131
- });
132
- // Get the main application node
133
- const mainApplication = config.modResults.manifest.application?.[0];
134
- if (mainApplication) {
135
- debugLog('📱 Configuring Android application components...');
136
- // Add RecordingActionReceiver
137
- if (!mainApplication.receiver) {
138
- mainApplication.receiver = [];
139
- }
140
- const receiverConfig = {
141
- $: {
142
- 'android:name': '.RecordingActionReceiver',
143
- 'android:exported': 'false',
144
- },
145
- 'intent-filter': [
146
- {
147
- action: [
148
- { $: { 'android:name': 'PAUSE_RECORDING' } },
149
- { $: { 'android:name': 'RESUME_RECORDING' } },
150
- { $: { 'android:name': 'STOP_RECORDING' } },
151
- ],
152
- },
153
- ],
154
- };
155
- const receiverIndex = mainApplication.receiver.findIndex((receiver) => receiver.$?.['android:name'] === '.RecordingActionReceiver');
156
- if (receiverIndex >= 0) {
157
- mainApplication.receiver[receiverIndex] = receiverConfig;
158
- }
159
- else {
160
- mainApplication.receiver.push(receiverConfig);
161
- }
162
- debugLog('✅ RecordingActionReceiver configured');
163
- // Add AudioRecordingService
164
- if (!mainApplication.service) {
165
- mainApplication.service = [];
166
- }
167
- const serviceConfig = {
168
- $: {
169
- 'android:name': '.AudioRecordingService',
170
- 'android:enabled': 'true',
171
- 'android:exported': 'false',
172
- 'android:foregroundServiceType': 'microphone',
173
- },
174
- };
175
- const serviceIndex = mainApplication.service.findIndex((service) => service.$?.['android:name'] === '.AudioRecordingService');
176
- if (serviceIndex >= 0) {
177
- mainApplication.service[serviceIndex] = serviceConfig;
178
- }
179
- else {
180
- mainApplication.service.push(serviceConfig);
181
- }
182
- debugLog('✅ AudioRecordingService configured');
183
- }
184
- else {
185
- console.error(`${LOG_PREFIX} ❌ Main application node not found in Android Manifest`);
186
- }
187
- return config;
188
- });
189
- debugLog('✨ Recording Permissions Plugin configuration completed');
190
- return config;
191
- };
192
- exports.default = withRecordingPermission;
@@ -1 +0,0 @@
1
- {"root":["./src/index.ts"],"version":"5.7.2"}