@independo/capacitor-voice-recorder 8.1.9-dev.1 → 8.2.0-dev.1
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/README.md +15 -12
- package/android/src/main/java/app/independo/capacitorvoicerecorder/adapters/RecordDataMapper.java +1 -0
- package/android/src/main/java/app/independo/capacitorvoicerecorder/core/RecordData.java +35 -0
- package/android/src/main/java/app/independo/capacitorvoicerecorder/service/VoiceRecorderService.java +1 -1
- package/dist/docs.json +1 -1
- package/dist/esm/core/recording-contract.js +2 -2
- package/dist/esm/core/recording-contract.js.map +1 -1
- package/dist/esm/definitions.d.ts +4 -0
- package/dist/esm/definitions.js.map +1 -1
- package/dist/esm/platform/web/VoiceRecorderImpl.d.ts +0 -2
- package/dist/esm/platform/web/VoiceRecorderImpl.js +8 -15
- package/dist/esm/platform/web/VoiceRecorderImpl.js.map +1 -1
- package/dist/plugin.cjs.js +10 -17
- package/dist/plugin.cjs.js.map +1 -1
- package/dist/plugin.js +10 -17
- package/dist/plugin.js.map +1 -1
- package/ios/Sources/VoiceRecorder/Adapters/RecordDataMapper.swift +1 -0
- package/ios/Sources/VoiceRecorder/Core/RecordData.swift +3 -0
- package/ios/Sources/VoiceRecorder/Platform/CustomMediaRecorder.swift +12 -4
- package/ios/Sources/VoiceRecorder/Service/VoiceRecorderService.swift +6 -1
- package/package.json +32 -31
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
import AVFoundation
|
|
3
3
|
|
|
4
|
+
private let m4aFileExtension = "m4a"
|
|
5
|
+
|
|
4
6
|
protocol AudioSessionProtocol: AnyObject {
|
|
5
7
|
var category: AVAudioSession.Category { get }
|
|
6
8
|
func setCategory(_ category: AVAudioSession.Category) throws
|
|
@@ -95,7 +97,9 @@ class CustomMediaRecorder: RecorderAdapter {
|
|
|
95
97
|
originalRecordingSessionCategory = recordingSession.category
|
|
96
98
|
try recordingSession.setCategory(AVAudioSession.Category.playAndRecord)
|
|
97
99
|
try recordingSession.setActive(true, options: [])
|
|
98
|
-
baseAudioFilePath = getDirectoryToSaveAudioFile().appendingPathComponent(
|
|
100
|
+
baseAudioFilePath = getDirectoryToSaveAudioFile().appendingPathComponent(
|
|
101
|
+
"recording-\(Int(Date().timeIntervalSince1970 * 1000)).\(m4aFileExtension)"
|
|
102
|
+
)
|
|
99
103
|
audioFileSegments = [baseAudioFilePath]
|
|
100
104
|
audioRecorder = try audioRecorderFactory(baseAudioFilePath, settings)
|
|
101
105
|
setupInterruptionHandling()
|
|
@@ -187,7 +191,9 @@ class CustomMediaRecorder: RecorderAdapter {
|
|
|
187
191
|
let directory = getDirectoryToSaveAudioFile()
|
|
188
192
|
let timestamp = Int(Date().timeIntervalSince1970 * 1000)
|
|
189
193
|
let segmentNumber = audioFileSegments.count
|
|
190
|
-
let segmentPath = directory.appendingPathComponent(
|
|
194
|
+
let segmentPath = directory.appendingPathComponent(
|
|
195
|
+
"recording-\(timestamp)-segment-\(segmentNumber).\(m4aFileExtension)"
|
|
196
|
+
)
|
|
191
197
|
audioRecorder = try audioRecorderFactory(segmentPath, settings)
|
|
192
198
|
audioFileSegments.append(segmentPath)
|
|
193
199
|
}
|
|
@@ -263,7 +269,7 @@ class CustomMediaRecorder: RecorderAdapter {
|
|
|
263
269
|
}
|
|
264
270
|
|
|
265
271
|
let basePathWithoutExtension = baseAudioFilePath.deletingPathExtension()
|
|
266
|
-
let mergedFilePath = basePathWithoutExtension.appendingPathExtension(
|
|
272
|
+
let mergedFilePath = basePathWithoutExtension.appendingPathExtension(m4aFileExtension)
|
|
267
273
|
let segmentURLs = audioFileSegments
|
|
268
274
|
let keys = ["tracks", "duration"]
|
|
269
275
|
let dispatchGroup = DispatchGroup()
|
|
@@ -348,7 +354,9 @@ class CustomMediaRecorder: RecorderAdapter {
|
|
|
348
354
|
}
|
|
349
355
|
|
|
350
356
|
let tempDirectory = self.getDirectoryToSaveAudioFile()
|
|
351
|
-
let tempPath = tempDirectory.appendingPathComponent(
|
|
357
|
+
let tempPath = tempDirectory.appendingPathComponent(
|
|
358
|
+
"temp-merged-\(Int(Date().timeIntervalSince1970 * 1000)).\(m4aFileExtension)"
|
|
359
|
+
)
|
|
352
360
|
|
|
353
361
|
exportSession.outputURL = tempPath
|
|
354
362
|
exportSession.outputFileType = .m4a
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import Foundation
|
|
2
2
|
|
|
3
|
+
private let m4aFileExtension = "m4a"
|
|
4
|
+
private let mp4AudioMimeType = "audio/mp4"
|
|
5
|
+
private let aacAudioMimeType = "audio/aac"
|
|
6
|
+
|
|
3
7
|
/// Service layer that orchestrates recording operations.
|
|
4
8
|
final class VoiceRecorderService {
|
|
5
9
|
/// Platform adapter for device and file operations.
|
|
@@ -82,13 +86,14 @@ final class VoiceRecorderService {
|
|
|
82
86
|
|
|
83
87
|
let audioFileUrl = recorder.getOutputFile()
|
|
84
88
|
let fileExtension = audioFileUrl.pathExtension.lowercased()
|
|
85
|
-
let mimeType = fileExtension ==
|
|
89
|
+
let mimeType = fileExtension == m4aFileExtension ? mp4AudioMimeType : aacAudioMimeType
|
|
86
90
|
let sendDataAsBase64 = recorder.options?.directory == nil
|
|
87
91
|
let recordDataBase64 = sendDataAsBase64 ? self.platform.readFileAsBase64(audioFileUrl) : nil
|
|
88
92
|
let uri = sendDataAsBase64 ? nil : audioFileUrl.path
|
|
89
93
|
let recordData = RecordData(
|
|
90
94
|
recordDataBase64: recordDataBase64,
|
|
91
95
|
mimeType: mimeType,
|
|
96
|
+
fileExtension: fileExtension,
|
|
92
97
|
msDuration: self.platform.getDurationMs(audioFileUrl),
|
|
93
98
|
uri: uri
|
|
94
99
|
)
|
package/package.json
CHANGED
|
@@ -13,31 +13,32 @@
|
|
|
13
13
|
"url": "https://github.com/independo-gmbh/capacitor-voice-recorder.git"
|
|
14
14
|
},
|
|
15
15
|
"description": "Capacitor plugin for voice recording",
|
|
16
|
-
"version": "8.
|
|
16
|
+
"version": "8.2.0-dev.1",
|
|
17
|
+
"packageManager": "pnpm@10.30.2",
|
|
17
18
|
"devDependencies": {
|
|
18
|
-
"@capacitor/android": "
|
|
19
|
-
"@capacitor/core": "
|
|
20
|
-
"@capacitor/
|
|
21
|
-
"
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"rollup": "^4.56.0",
|
|
25
|
-
"eslint": "^8.57.0",
|
|
26
|
-
"@semantic-release/git": "^10.0.1",
|
|
19
|
+
"@capacitor/android": "catalog:",
|
|
20
|
+
"@capacitor/core": "catalog:",
|
|
21
|
+
"@capacitor/docgen": "catalog:",
|
|
22
|
+
"@capacitor/ios": "catalog:",
|
|
23
|
+
"@ionic/eslint-config": "^0.4.0",
|
|
24
|
+
"@ionic/prettier-config": "^4.0.0",
|
|
27
25
|
"@ionic/swiftlint-config": "^2.0.0",
|
|
28
|
-
"swiftlint": "^2.0.0",
|
|
29
|
-
"@typescript-eslint/parser": "^5.62.0",
|
|
30
|
-
"typescript": "^5.9.3",
|
|
31
|
-
"@semantic-release/changelog": "^6.0.3",
|
|
32
|
-
"@types/node": "^25.0.10",
|
|
33
26
|
"@saithodev/semantic-release-backmerge": "^4.0.1",
|
|
34
|
-
"@
|
|
35
|
-
"semantic-release": "^
|
|
36
|
-
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
27
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
28
|
+
"@semantic-release/git": "^10.0.1",
|
|
37
29
|
"@types/jest": "^30.0.0",
|
|
38
|
-
"@
|
|
39
|
-
"@
|
|
40
|
-
"
|
|
30
|
+
"@types/node": "^25.3.0",
|
|
31
|
+
"@typescript-eslint/eslint-plugin": "^5.62.0",
|
|
32
|
+
"@typescript-eslint/parser": "^5.62.0",
|
|
33
|
+
"conventional-changelog-conventionalcommits": "^9.1.0",
|
|
34
|
+
"eslint": "^8.57.1",
|
|
35
|
+
"jest": "^30.2.0",
|
|
36
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
37
|
+
"rollup": "^4.59.0",
|
|
38
|
+
"semantic-release": "^25.0.3",
|
|
39
|
+
"swiftlint": "^2.0.0",
|
|
40
|
+
"ts-jest": "^29.4.6",
|
|
41
|
+
"typescript": "^5.9.3"
|
|
41
42
|
},
|
|
42
43
|
"main": "dist/plugin.cjs.js",
|
|
43
44
|
"files": [
|
|
@@ -54,16 +55,16 @@
|
|
|
54
55
|
"url": "https://github.com/independo-gmbh/capacitor-voice-recorder/issues"
|
|
55
56
|
},
|
|
56
57
|
"scripts": {
|
|
57
|
-
"upgrade": "
|
|
58
|
-
"build": "
|
|
59
|
-
"lint": "
|
|
60
|
-
"prepublishOnly": "
|
|
61
|
-
"verify": "
|
|
58
|
+
"upgrade": "pnpm dlx npm-check-updates -u",
|
|
59
|
+
"build": "pnpm run clean && pnpm run docgen && tsc && rollup -c rollup.config.mjs",
|
|
60
|
+
"lint": "pnpm run eslint",
|
|
61
|
+
"prepublishOnly": "pnpm run build",
|
|
62
|
+
"verify": "pnpm run verify:ios && pnpm run verify:android && pnpm run verify:web",
|
|
62
63
|
"verify:android": "node scripts/verify-android.js",
|
|
63
64
|
"verify:ios": "xcodebuild -scheme IndependoCapacitorVoiceRecorder -destination generic/platform=iOS",
|
|
64
|
-
"verify:web": "
|
|
65
|
+
"verify:web": "pnpm run build",
|
|
65
66
|
"watch": "tsc --watch",
|
|
66
|
-
"test": "
|
|
67
|
+
"test": "pnpm run test:web && pnpm run test:android && pnpm run test:ios",
|
|
67
68
|
"test:web": "jest",
|
|
68
69
|
"test:web:coverage": "jest --coverage --coverageReporters=lcov --coverageReporters=text-summary",
|
|
69
70
|
"test:android": "node scripts/verify-android.js testDebugUnitTest",
|
|
@@ -74,7 +75,7 @@
|
|
|
74
75
|
"clean": "rm -rf dist",
|
|
75
76
|
"swiftlint": "node-swiftlint",
|
|
76
77
|
"docgen": "docgen --api VoiceRecorderPlugin --output-readme README.md --output-json dist/docs.json",
|
|
77
|
-
"fmt": "
|
|
78
|
+
"fmt": "pnpm run eslint --fix"
|
|
78
79
|
},
|
|
79
80
|
"eslintConfig": {
|
|
80
81
|
"extends": "@ionic/eslint-config/recommended"
|
|
@@ -112,8 +113,8 @@
|
|
|
112
113
|
}
|
|
113
114
|
],
|
|
114
115
|
"peerDependencies": {
|
|
115
|
-
"@capacitor/
|
|
116
|
-
"@capacitor/
|
|
116
|
+
"@capacitor/core": ">=8.0.0",
|
|
117
|
+
"@capacitor/filesystem": ">=8.0.0"
|
|
117
118
|
},
|
|
118
119
|
"module": "dist/esm/index.js"
|
|
119
120
|
}
|