@capgo/native-audio 8.3.18 → 8.4.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 +63 -13
- package/android/build.gradle +1 -1
- package/android/src/main/java/ee/forgr/audio/NativeAudio.java +310 -89
- package/dist/docs.json +114 -0
- package/dist/esm/definitions.d.ts +36 -0
- package/dist/esm/definitions.js.map +1 -1
- package/ios/Sources/NativeAudioPlugin/Plugin.swift +193 -15
- package/ios/Sources/NativeAudioPlugin/RemoteAudioAsset.swift +6 -3
- package/package.json +14 -8
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
@preconcurrency import AVFoundation
|
|
2
2
|
|
|
3
|
+
// swiftlint:disable file_length
|
|
3
4
|
// swiftlint:disable:next type_body_length
|
|
4
5
|
public class RemoteAudioAsset: AudioAsset {
|
|
5
6
|
var playerItems: [AVPlayerItem] = []
|
|
@@ -89,6 +90,7 @@ public class RemoteAudioAsset: AudioAsset {
|
|
|
89
90
|
guard let self else { return }
|
|
90
91
|
self.owner?.notifyListeners("complete", data: ["assetId": self.assetId])
|
|
91
92
|
self.dispatchedCompleteMap[self.assetId] = true
|
|
93
|
+
self.owner?.handlePlaybackCompletion(assetId: self.assetId, audioAsset: self)
|
|
92
94
|
self.onComplete?()
|
|
93
95
|
}
|
|
94
96
|
}
|
|
@@ -153,11 +155,11 @@ public class RemoteAudioAsset: AudioAsset {
|
|
|
153
155
|
let lowerBound = max(time, 0)
|
|
154
156
|
let validTime: TimeInterval
|
|
155
157
|
if let item = player.currentItem {
|
|
156
|
-
let
|
|
157
|
-
if
|
|
158
|
+
let itemDuration = item.duration
|
|
159
|
+
if itemDuration == .indefinite || !itemDuration.isValid {
|
|
158
160
|
validTime = lowerBound
|
|
159
161
|
} else {
|
|
160
|
-
let durationSeconds =
|
|
162
|
+
let durationSeconds = itemDuration.seconds
|
|
161
163
|
if durationSeconds.isFinite && durationSeconds > 0 {
|
|
162
164
|
validTime = min(lowerBound, durationSeconds)
|
|
163
165
|
} else {
|
|
@@ -400,3 +402,4 @@ public class RemoteAudioAsset: AudioAsset {
|
|
|
400
402
|
}
|
|
401
403
|
|
|
402
404
|
}
|
|
405
|
+
// swiftlint:enable file_length
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@capgo/native-audio",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.4.1",
|
|
4
4
|
"description": "A native plugin for native audio engine",
|
|
5
5
|
"license": "MPL-2.0",
|
|
6
6
|
"main": "dist/plugin.cjs.js",
|
|
@@ -36,23 +36,29 @@
|
|
|
36
36
|
],
|
|
37
37
|
"scripts": {
|
|
38
38
|
"capacitor:sync:after": "node scripts/configure-dependencies.js",
|
|
39
|
-
"verify": "
|
|
39
|
+
"verify": "bun run verify:ios && bun run verify:android && bun run verify:web",
|
|
40
40
|
"verify:ios": "xcodebuild -scheme CapgoNativeAudio -destination generic/platform=iOS",
|
|
41
41
|
"verify:android": "cd android && ./gradlew clean build test && cd ..",
|
|
42
|
-
"verify:web": "
|
|
43
|
-
"test": "
|
|
42
|
+
"verify:web": "bun run build",
|
|
43
|
+
"test": "bun run test:ios",
|
|
44
44
|
"test:ios": "cd ios && xcodebuild test -workspace Plugin.xcworkspace -scheme Plugin -destination 'platform=iOS Simulator,name=iPhone 16' && cd ..",
|
|
45
|
-
"lint": "
|
|
46
|
-
"fmt": "
|
|
45
|
+
"lint": "bun run eslint && bun run prettier -- --check && bun run swiftlint -- lint",
|
|
46
|
+
"fmt": "bun run eslint -- --fix && bun run prettier -- --write && bun run swiftlint -- --fix --format",
|
|
47
47
|
"eslint": "eslint . --ext .ts",
|
|
48
48
|
"prettier": "prettier-pretty-check \"**/*.{css,html,ts,js,java}\" --plugin=prettier-plugin-java",
|
|
49
49
|
"swiftlint": "node-swiftlint",
|
|
50
50
|
"docgen": "docgen --api NativeAudio --output-readme README.md --output-json dist/docs.json",
|
|
51
|
-
"build": "
|
|
51
|
+
"build": "bun run clean && bun run docgen && bun run build:scripts && tsc && rollup -c rollup.config.mjs",
|
|
52
52
|
"build:scripts": "tsc -p scripts/tsconfig.json",
|
|
53
53
|
"clean": "rimraf ./dist",
|
|
54
54
|
"watch": "tsc --watch",
|
|
55
|
-
"
|
|
55
|
+
"example:install": "cd example-app && bun install",
|
|
56
|
+
"example:build": "cd example-app && bun run build",
|
|
57
|
+
"example:sync:android": "cd example-app && bun run sync:android",
|
|
58
|
+
"example:sync:ios": "cd example-app && bun run sync:ios",
|
|
59
|
+
"test:e2e:android": "maestro test .maestro/android/basic-features.yaml",
|
|
60
|
+
"test:e2e:ios": "maestro test .maestro/ios/basic-features.yaml",
|
|
61
|
+
"prepublishOnly": "bun run build"
|
|
56
62
|
},
|
|
57
63
|
"devDependencies": {
|
|
58
64
|
"@capacitor/android": "^8.0.0",
|