@siteed/expo-audio-studio 2.10.4 → 2.10.6
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 +11 -1
- package/ios/AudioStreamManager.swift +29 -13
- package/package.json +1 -1
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.10.6] - 2025-06-04
|
|
12
|
+
### Changed
|
|
13
|
+
- fix(expo-audio-studio): prevent durationMs returning 0 on iOS (#244) (#260) ([595e5d5](https://github.com/deeeed/expo-audio-stream/commit/595e5d56991c9fa88c2fa4e39efb197916cb8b84))
|
|
14
|
+
- chore(expo-audio-studio): release @siteed/expo-audio-studio@2.10.5 ([d8c6e1d](https://github.com/deeeed/expo-audio-stream/commit/d8c6e1de72ccb0c8885a4f5f3326e3229d9dfd92))
|
|
15
|
+
## [2.10.5] - 2025-06-04
|
|
16
|
+
### Changed
|
|
17
|
+
- fix(expo-audio-studio): enable audio streaming when primary output is disabled on iOS (#259) ([1d2bb92](https://github.com/deeeed/expo-audio-stream/commit/1d2bb9280e7d596ed77de30b37e043fd7f8f8cc8))
|
|
18
|
+
- chore(expo-audio-studio): release @siteed/expo-audio-studio@2.10.4 ([32f8c9e](https://github.com/deeeed/expo-audio-stream/commit/32f8c9ee1d65f52370798654be389de1569e851f))
|
|
11
19
|
## [2.10.4] - 2025-06-03
|
|
12
20
|
### Changed
|
|
13
21
|
- fix(expo-audio-studio): resolve Swift compilation scope error in AudioStreamManager (#256) ([b44bf3d](https://github.com/deeeed/expo-audio-stream/commit/b44bf3d6d85a3f953d84b024bba828163354a40b))
|
|
@@ -274,7 +282,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
274
282
|
- Feature: Audio features extraction during recording.
|
|
275
283
|
- Feature: Consistent WAV PCM recording format across all platforms.
|
|
276
284
|
|
|
277
|
-
[unreleased]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.10.
|
|
285
|
+
[unreleased]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.10.6...HEAD
|
|
286
|
+
[2.10.6]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.10.5...@siteed/expo-audio-studio@2.10.6
|
|
287
|
+
[2.10.5]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.10.4...@siteed/expo-audio-studio@2.10.5
|
|
278
288
|
[2.10.4]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.10.3...@siteed/expo-audio-studio@2.10.4
|
|
279
289
|
[2.10.3]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.10.2...@siteed/expo-audio-studio@2.10.3
|
|
280
290
|
[2.10.2]: https://github.com/deeeed/expo-audio-stream/compare/@siteed/expo-audio-studio@2.10.1...@siteed/expo-audio-studio@2.10.2
|
|
@@ -336,6 +336,12 @@ class AudioStreamManager: NSObject, AudioDeviceManagerDelegate {
|
|
|
336
336
|
return lastDuration
|
|
337
337
|
}
|
|
338
338
|
|
|
339
|
+
// Safety check: if recording but no start time, use current time
|
|
340
|
+
if isRecording && startTime == nil {
|
|
341
|
+
Logger.debug("AudioStreamManager", "WARNING: Recording active but startTime is nil, setting to current time")
|
|
342
|
+
startTime = Date()
|
|
343
|
+
}
|
|
344
|
+
|
|
339
345
|
guard let startTime = self.startTime else { return 0 }
|
|
340
346
|
|
|
341
347
|
let now = Date()
|
|
@@ -696,12 +702,12 @@ class AudioStreamManager: NSObject, AudioDeviceManagerDelegate {
|
|
|
696
702
|
// Create the default tap block if none provided
|
|
697
703
|
let tapBlock = customTapBlock ?? { [weak self] (buffer, time) in
|
|
698
704
|
guard let self = self,
|
|
699
|
-
let fileURL = self.recordingFileURL,
|
|
700
705
|
self.isRecording else {
|
|
701
706
|
return
|
|
702
707
|
}
|
|
703
|
-
//
|
|
704
|
-
|
|
708
|
+
// Process audio buffer for streaming, analysis, and optional file writing
|
|
709
|
+
// Note: Audio streaming works regardless of primary output settings (consistent with Web/Android)
|
|
710
|
+
self.processAudioBuffer(buffer)
|
|
705
711
|
self.lastBufferTime = time
|
|
706
712
|
}
|
|
707
713
|
|
|
@@ -786,6 +792,12 @@ class AudioStreamManager: NSObject, AudioDeviceManagerDelegate {
|
|
|
786
792
|
lastEmittedSize = 0
|
|
787
793
|
lastEmittedCompressedSizeAnalysis = 0
|
|
788
794
|
isPaused = false
|
|
795
|
+
|
|
796
|
+
// Initialize startTime early to prevent duration being 0
|
|
797
|
+
// This will be updated when recording actually starts
|
|
798
|
+
if startTime == nil {
|
|
799
|
+
startTime = Date()
|
|
800
|
+
}
|
|
789
801
|
|
|
790
802
|
// Create recording file first (unless primary output is disabled)
|
|
791
803
|
if settings.output.primary.enabled {
|
|
@@ -1030,7 +1042,10 @@ class AudioStreamManager: NSObject, AudioDeviceManagerDelegate {
|
|
|
1030
1042
|
enableWakeLock()
|
|
1031
1043
|
|
|
1032
1044
|
// Set recording state *before* starting engine to avoid race condition
|
|
1033
|
-
startTime
|
|
1045
|
+
// Set startTime as early as possible to ensure duration calculation works
|
|
1046
|
+
if startTime == nil {
|
|
1047
|
+
startTime = Date()
|
|
1048
|
+
}
|
|
1034
1049
|
totalPausedDuration = 0
|
|
1035
1050
|
currentPauseStart = nil
|
|
1036
1051
|
lastEmissionTime = Date()
|
|
@@ -1400,12 +1415,12 @@ class AudioStreamManager: NSObject, AudioDeviceManagerDelegate {
|
|
|
1400
1415
|
}
|
|
1401
1416
|
|
|
1402
1417
|
/// Processes the audio buffer: handles resampling/format conversion if necessary,
|
|
1403
|
-
/// writes the result to the WAV file on a background thread
|
|
1404
|
-
/// analysis processing and event emission based on intervals.
|
|
1418
|
+
/// optionally writes the result to the WAV file on a background thread (if primary output is enabled),
|
|
1419
|
+
/// and triggers analysis processing and event emission based on intervals.
|
|
1420
|
+
/// Audio streaming happens regardless of file output settings.
|
|
1405
1421
|
/// - Parameters:
|
|
1406
1422
|
/// - buffer: The audio buffer received from the input node tap.
|
|
1407
|
-
|
|
1408
|
-
private func processAudioBuffer(_ buffer: AVAudioPCMBuffer, fileURL: URL) {
|
|
1423
|
+
private func processAudioBuffer(_ buffer: AVAudioPCMBuffer) {
|
|
1409
1424
|
guard let settings = recordingSettings else {
|
|
1410
1425
|
Logger.debug("processAudioBuffer: Recording settings not available")
|
|
1411
1426
|
return
|
|
@@ -1465,9 +1480,9 @@ class AudioStreamManager: NSObject, AudioDeviceManagerDelegate {
|
|
|
1465
1480
|
// Create an immutable copy for background/event emission
|
|
1466
1481
|
let dataToWrite = Data(bytes: bufferData, count: Int(audioData.mDataByteSize))
|
|
1467
1482
|
|
|
1468
|
-
// --- Background File Writing ---
|
|
1469
|
-
|
|
1470
|
-
|
|
1483
|
+
// --- Background File Writing (Optional) ---
|
|
1484
|
+
// Only write to file if primary output is enabled
|
|
1485
|
+
if settings.output.primary.enabled {
|
|
1471
1486
|
// Use the persistent fileHandle opened during preparation.
|
|
1472
1487
|
DispatchQueue.global(qos: .utility).async { [weak self] in
|
|
1473
1488
|
guard let self = self, let handle = self.fileHandle else {
|
|
@@ -1488,7 +1503,8 @@ class AudioStreamManager: NSObject, AudioDeviceManagerDelegate {
|
|
|
1488
1503
|
self.totalDataSize += Int64(dataToWrite.count)
|
|
1489
1504
|
}
|
|
1490
1505
|
|
|
1491
|
-
// --- Event Emission & Analysis ---
|
|
1506
|
+
// --- Event Emission & Analysis (Always Happens) ---
|
|
1507
|
+
// Audio streaming is independent of file output settings
|
|
1492
1508
|
accumulatedData.append(dataToWrite)
|
|
1493
1509
|
accumulatedAnalysisData.append(dataToWrite)
|
|
1494
1510
|
|
|
@@ -2104,7 +2120,7 @@ class AudioStreamManager: NSObject, AudioDeviceManagerDelegate {
|
|
|
2104
2120
|
guard let self = self, self.isRecording else { return }
|
|
2105
2121
|
|
|
2106
2122
|
// Process the buffer normally - processAudioBuffer handles all emission logic
|
|
2107
|
-
self.processAudioBuffer(buffer
|
|
2123
|
+
self.processAudioBuffer(buffer)
|
|
2108
2124
|
self.lastBufferTime = time
|
|
2109
2125
|
}
|
|
2110
2126
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siteed/expo-audio-studio",
|
|
3
|
-
"version": "2.10.
|
|
3
|
+
"version": "2.10.6",
|
|
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",
|