@scr2em/capacitor-plugin-recorder 0.0.1 → 0.0.2
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.
|
@@ -3,7 +3,7 @@ require 'json'
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
|
|
4
4
|
|
|
5
5
|
Pod::Spec.new do |s|
|
|
6
|
-
s.name = '
|
|
6
|
+
s.name = 'Scr2emCapacitorPluginRecorder'
|
|
7
7
|
s.version = package['version']
|
|
8
8
|
s.summary = package['description']
|
|
9
9
|
s.license = package['license']
|
|
@@ -150,7 +150,7 @@ private class PlayerState: NSObject, AVAudioPlayerDelegate {
|
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
152
|
|
|
153
|
-
|
|
153
|
+
public func stopRecord() throws -> (path: String, duration: Int) {
|
|
154
154
|
guard let recorder = audioRecorder, recordingStatus != .stopped else {
|
|
155
155
|
throw NSError(domain: "RecorderPlayer", code: 3, userInfo: [NSLocalizedDescriptionKey: "No recording in progress"])
|
|
156
156
|
}
|
|
@@ -188,7 +188,7 @@ private class PlayerState: NSObject, AVAudioPlayerDelegate {
|
|
|
188
188
|
notifyRecordingStatusChange()
|
|
189
189
|
}
|
|
190
190
|
|
|
191
|
-
|
|
191
|
+
public func preparePlay(path: String) throws -> (playerId: String, duration: Int) {
|
|
192
192
|
// Use Application Support directory + bundle identifier (matches Capacitor's Directory.Data)
|
|
193
193
|
let appSupportDir = FileManager.default.urls(for: .applicationSupportDirectory, in: .userDomainMask)[0]
|
|
194
194
|
let dataDir = appSupportDir.appendingPathComponent(Bundle.main.bundleIdentifier ?? "")
|
|
@@ -283,7 +283,7 @@ private class PlayerState: NSObject, AVAudioPlayerDelegate {
|
|
|
283
283
|
playerState.notifyStatusChange()
|
|
284
284
|
}
|
|
285
285
|
|
|
286
|
-
|
|
286
|
+
public func getPlaybackStatus(playerId: String) -> (status: String, currentPosition: Int, duration: Int)? {
|
|
287
287
|
guard let playerState = players[playerId] else {
|
|
288
288
|
return nil
|
|
289
289
|
}
|
|
@@ -293,7 +293,7 @@ private class PlayerState: NSObject, AVAudioPlayerDelegate {
|
|
|
293
293
|
return (playerState.status.rawValue, currentPosition, duration)
|
|
294
294
|
}
|
|
295
295
|
|
|
296
|
-
|
|
296
|
+
public func getRecordingStatus() -> (status: String, duration: Int) {
|
|
297
297
|
var duration = 0
|
|
298
298
|
if let recorder = audioRecorder {
|
|
299
299
|
duration = Int(recorder.currentTime * 1000)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@scr2em/capacitor-plugin-recorder",
|
|
3
|
-
"version": "0.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.0.2",
|
|
4
|
+
"description": "record audios and play them back",
|
|
5
5
|
"main": "dist/plugin.cjs.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/esm/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"ios/Sources",
|
|
14
14
|
"ios/Tests",
|
|
15
15
|
"Package.swift",
|
|
16
|
-
"
|
|
16
|
+
"Scr2emCapacitorPluginRecorder.podspec"
|
|
17
17
|
],
|
|
18
18
|
"author": "me",
|
|
19
19
|
"license": "MIT",
|