@capgo/capacitor-native-audio 8.4.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/CapgoCapacitorNativeAudio.podspec +16 -0
- package/LICENSE +373 -0
- package/Package.swift +31 -0
- package/README.md +1229 -0
- package/android/build.gradle +89 -0
- package/android/src/main/AndroidManifest.xml +3 -0
- package/android/src/main/java/ee/forgr/audio/AudioAsset.java +611 -0
- package/android/src/main/java/ee/forgr/audio/AudioCompletionListener.java +5 -0
- package/android/src/main/java/ee/forgr/audio/AudioDispatcher.java +208 -0
- package/android/src/main/java/ee/forgr/audio/Constant.java +36 -0
- package/android/src/main/java/ee/forgr/audio/HlsAvailabilityChecker.java +84 -0
- package/android/src/main/java/ee/forgr/audio/Logger.java +55 -0
- package/android/src/main/java/ee/forgr/audio/NativeAudio.java +2022 -0
- package/android/src/main/java/ee/forgr/audio/RemoteAudioAsset.java +886 -0
- package/android/src/main/java/ee/forgr/audio/StreamAudioAsset.java +708 -0
- package/android/src/main/res/values/colors.xml +3 -0
- package/android/src/main/res/values/strings.xml +3 -0
- package/android/src/main/res/values/styles.xml +3 -0
- package/dist/docs.json +1470 -0
- package/dist/esm/audio-asset.d.ts +4 -0
- package/dist/esm/audio-asset.js +6 -0
- package/dist/esm/audio-asset.js.map +1 -0
- package/dist/esm/definitions.d.ts +597 -0
- package/dist/esm/definitions.js +2 -0
- package/dist/esm/definitions.js.map +1 -0
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +7 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/web.d.ts +82 -0
- package/dist/esm/web.js +553 -0
- package/dist/esm/web.js.map +1 -0
- package/dist/plugin.cjs.js +571 -0
- package/dist/plugin.cjs.js.map +1 -0
- package/dist/plugin.js +574 -0
- package/dist/plugin.js.map +1 -0
- package/ios/Sources/NativeAudioPlugin/AudioAsset+Fade.swift +157 -0
- package/ios/Sources/NativeAudioPlugin/AudioAsset.swift +403 -0
- package/ios/Sources/NativeAudioPlugin/Constant.swift +52 -0
- package/ios/Sources/NativeAudioPlugin/Logger.swift +43 -0
- package/ios/Sources/NativeAudioPlugin/Plugin.swift +1786 -0
- package/ios/Sources/NativeAudioPlugin/RemoteAudioAsset+Fade.swift +152 -0
- package/ios/Sources/NativeAudioPlugin/RemoteAudioAsset.swift +405 -0
- package/ios/Tests/NativeAudioPluginTests/PluginTests.swift +648 -0
- package/ios/Tests/README.md +39 -0
- package/package.json +101 -0
- package/scripts/configure-dependencies.js +251 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
//
|
|
2
|
+
// Constant.swift
|
|
3
|
+
// Plugin
|
|
4
|
+
//
|
|
5
|
+
// Created by priyankpat on 2020-05-28.
|
|
6
|
+
// Copyright © 2022 Martin Donadieu. All rights reserved.
|
|
7
|
+
//
|
|
8
|
+
|
|
9
|
+
public class Constant {
|
|
10
|
+
// Parameter keys
|
|
11
|
+
public static let FadeKey = "fade" // legacy global fade toggle
|
|
12
|
+
public static let FadeIn = "fadeIn"
|
|
13
|
+
public static let FadeOut = "fadeOut"
|
|
14
|
+
public static let FadeInDuration = "fadeInDuration"
|
|
15
|
+
public static let FadeOutDuration = "fadeOutDuration"
|
|
16
|
+
public static let FadeOutStartTime = "fadeOutStartTime"
|
|
17
|
+
public static let FadeDuration = "duration"
|
|
18
|
+
public static let FocusAudio = "focus"
|
|
19
|
+
public static let AssetPath = "assetPath"
|
|
20
|
+
public static let AssetId = "assetId"
|
|
21
|
+
public static let Volume = "volume"
|
|
22
|
+
public static let Time = "time"
|
|
23
|
+
public static let Delay = "delay"
|
|
24
|
+
public static let Rate = "rate"
|
|
25
|
+
public static let Loop = "loop"
|
|
26
|
+
public static let Background = "background"
|
|
27
|
+
public static let IgnoreSilent = "ignoreSilent"
|
|
28
|
+
public static let ShowNotification = "showNotification"
|
|
29
|
+
public static let NotificationMetadata = "notificationMetadata"
|
|
30
|
+
|
|
31
|
+
// Default values - used for consistency across the plugin
|
|
32
|
+
public static let DefaultVolume: Float = 1.0
|
|
33
|
+
public static let DefaultRate: Float = 1.0
|
|
34
|
+
public static let DefaultChannels: Int = 1
|
|
35
|
+
public static let DefaultFadeDuration: Float = 1.0
|
|
36
|
+
public static let MinRate: Float = 0.25
|
|
37
|
+
public static let MaxRate: Float = 4.0
|
|
38
|
+
public static let MinVolume: Float = 0.0
|
|
39
|
+
public static let MaxVolume: Float = 1.0
|
|
40
|
+
public static let MaxChannels: Int = 32
|
|
41
|
+
|
|
42
|
+
// Error messages
|
|
43
|
+
public static let ErrorAssetId = "Asset Id is missing"
|
|
44
|
+
public static let ErrorAssetPath = "Asset Path is missing"
|
|
45
|
+
public static let ErrorAssetNotFound = "Asset is not loaded"
|
|
46
|
+
public static let ErrorAssetAlreadyLoaded = "Asset is already loaded"
|
|
47
|
+
|
|
48
|
+
// Backward compatibility aliases
|
|
49
|
+
public static let AssetPathKey = AssetPath
|
|
50
|
+
public static let AssetIdKey = AssetId
|
|
51
|
+
public static let DefaultFadeDelay = DefaultFadeDuration
|
|
52
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import Foundation
|
|
2
|
+
import os.log
|
|
3
|
+
|
|
4
|
+
public class Logger {
|
|
5
|
+
private var osLogger: OSLog?
|
|
6
|
+
|
|
7
|
+
public static var debugModeEnabled = false
|
|
8
|
+
|
|
9
|
+
public init(logTag: String) {
|
|
10
|
+
osLogger = OSLog(subsystem: Bundle.main.bundleIdentifier ?? "com.capgo.native-audio", category: logTag)
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
func error(_ message: String, _ args: CVarArg...) {
|
|
14
|
+
osLog(message, args, level: .error)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
func warning(_ message: String, _ args: CVarArg...) {
|
|
18
|
+
osLog(message, args, level: .fault)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
func info(_ message: String, _ args: CVarArg...) {
|
|
22
|
+
osLog(message, args, level: .info)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
func debug(_ message: String, _ args: CVarArg...) {
|
|
26
|
+
osLog(message, args, level: .debug)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
func verbose(_ message: String, _ args: CVarArg...) {
|
|
30
|
+
osLog(message, args, level: .default)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
private func osLog(_ message: String, _ args: [CVarArg], level: OSLogType = .default) {
|
|
34
|
+
if !Logger.debugModeEnabled {
|
|
35
|
+
return
|
|
36
|
+
}
|
|
37
|
+
let formatted = String(format: message, arguments: args)
|
|
38
|
+
guard let osLogger else {
|
|
39
|
+
return
|
|
40
|
+
}
|
|
41
|
+
os_log("%{public}@", log: osLogger, type: level, formatted)
|
|
42
|
+
}
|
|
43
|
+
}
|