react-native-queue-player 1.0.7 → 1.0.9
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/android/src/main/java/com/margelo/nitro/queueplayer/MediaItemBuilder.kt +21 -3
- package/android/src/main/java/com/margelo/nitro/queueplayer/PlaceholderArtwork.kt +30 -0
- package/android/src/main/java/com/margelo/nitro/queueplayer/PlaceholderFallbackBitmapLoader.kt +9 -6
- package/android/src/main/java/com/margelo/nitro/queueplayer/PlaybackService.kt +4 -1
- package/android/src/main/java/com/margelo/nitro/queueplayer/TrackPlayer.kt +48 -5
- package/android/src/test/java/com/margelo/nitro/queueplayer/MediaItemBuilderTest.kt +55 -0
- package/android/src/test/java/com/margelo/nitro/queueplayer/PlaceholderArtworkTest.kt +72 -0
- package/android/src/test/java/com/margelo/nitro/queueplayer/PlaceholderFallbackBitmapLoaderTest.kt +21 -9
- package/android/src/test/java/com/margelo/nitro/queueplayer/PlaybackServiceArtworkLoaderTest.kt +9 -9
- package/android/src/test/java/com/margelo/nitro/queueplayer/PlaybackServiceCallbackTest.kt +1 -1
- package/android/src/test/java/com/margelo/nitro/queueplayer/TrackPlayerAirPlayMetadataWiringTest.kt +1 -1
- package/android/src/test/java/com/margelo/nitro/queueplayer/TrackPlayerAudioFocusTest.kt +1 -1
- package/android/src/test/java/com/margelo/nitro/queueplayer/TrackPlayerEventsTest.kt +3 -3
- package/android/src/test/java/com/margelo/nitro/queueplayer/TrackPlayerLifecycleTest.kt +7 -7
- package/android/src/test/java/com/margelo/nitro/queueplayer/TrackPlayerLookaheadConfigTest.kt +6 -6
- package/android/src/test/java/com/margelo/nitro/queueplayer/TrackPlayerMutationTest.kt +2 -2
- package/android/src/test/java/com/margelo/nitro/queueplayer/TrackPlayerProgressThrottleTest.kt +1 -1
- package/android/src/test/java/com/margelo/nitro/queueplayer/TrackPlayerQueueChangeTest.kt +180 -0
- package/android/src/test/java/com/margelo/nitro/queueplayer/TrackPlayerQueueTest.kt +1 -1
- package/android/src/test/java/com/margelo/nitro/queueplayer/TrackPlayerReadersTest.kt +1 -1
- package/android/src/test/java/com/margelo/nitro/queueplayer/TrackPlayerSkipCapabilityTest.kt +2 -2
- package/android/src/test/java/com/margelo/nitro/queueplayer/TrackPlayerSkipTest.kt +1 -1
- package/android/src/test/java/com/margelo/nitro/queueplayer/TrackPlayerTransportTest.kt +1 -1
- package/ios/AVQueueBuilder.swift +29 -0
- package/ios/Cast/Core/CastNowPlayingController.swift +7 -4
- package/ios/NowPlayingInfo.swift +7 -9
- package/ios/PlaceholderArtwork.swift +24 -1
- package/ios/QueueState.swift +14 -2
- package/ios/Tests/AVQueueBuilderTests.swift +83 -9
- package/ios/Tests/CastNowPlayingControllerTests.swift +33 -0
- package/ios/Tests/PlaceholderArtworkTests.swift +81 -0
- package/ios/Tests/QueueStateTests.swift +50 -0
- package/ios/TrackPlayer.swift +126 -15
- package/lib/module/hooks/index.js +1 -0
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/useQueue.js +57 -0
- package/lib/module/hooks/useQueue.js.map +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js +7 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/TrackPlayer.nitro.d.ts +27 -1
- package/lib/typescript/TrackPlayer.nitro.d.ts.map +1 -1
- package/lib/typescript/hooks/index.d.ts +2 -0
- package/lib/typescript/hooks/index.d.ts.map +1 -1
- package/lib/typescript/hooks/useQueue.d.ts +20 -0
- package/lib/typescript/hooks/useQueue.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +1 -1
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +22 -0
- package/lib/typescript/types.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_TrackItem__double_QueueChangeReason.hpp +101 -0
- package/nitrogen/generated/android/c++/JHybridTrackPlayerSpec.cpp +18 -0
- package/nitrogen/generated/android/c++/JHybridTrackPlayerSpec.hpp +1 -0
- package/nitrogen/generated/android/c++/JPlayerConfig.hpp +5 -1
- package/nitrogen/generated/android/c++/JQueueChangeReason.hpp +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/queueplayer/Func_void_std__vector_TrackItem__double_QueueChangeReason.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/queueplayer/HybridTrackPlayerSpec.kt +9 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/queueplayer/PlayerConfig.kt +7 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/queueplayer/QueueChangeReason.kt +27 -0
- package/nitrogen/generated/android/queueplayerOnLoad.cpp +2 -0
- package/nitrogen/generated/ios/QueuePlayer-Swift-Cxx-Bridge.cpp +8 -0
- package/nitrogen/generated/ios/QueuePlayer-Swift-Cxx-Bridge.hpp +25 -0
- package/nitrogen/generated/ios/QueuePlayer-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridTrackPlayerSpecSwift.hpp +11 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_TrackItem__double_QueueChangeReason.swift +46 -0
- package/nitrogen/generated/ios/swift/HybridTrackPlayerSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridTrackPlayerSpec_cxx.swift +26 -0
- package/nitrogen/generated/ios/swift/PlayerConfig.swift +19 -1
- package/nitrogen/generated/ios/swift/QueueChangeReason.swift +56 -0
- package/nitrogen/generated/shared/c++/HybridTrackPlayerSpec.cpp +1 -0
- package/nitrogen/generated/shared/c++/HybridTrackPlayerSpec.hpp +4 -0
- package/nitrogen/generated/shared/c++/PlayerConfig.hpp +5 -1
- package/nitrogen/generated/shared/c++/QueueChangeReason.hpp +92 -0
- package/package.json +1 -1
- package/src/TrackPlayer.nitro.ts +33 -0
- package/src/hooks/index.ts +3 -0
- package/src/hooks/useQueue.ts +56 -0
- package/src/index.ts +1 -0
- package/src/types.ts +29 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__vector_TrackItem__double_QueueChangeReason.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.queueplayer
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.jni.HybridData
|
|
12
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import dalvik.annotation.optimization.FastNative
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Represents the JavaScript callback `(queue: array, currentIndex: number, reason: enum) => void`.
|
|
18
|
+
* This can be either implemented in C++ (in which case it might be a callback coming from JS),
|
|
19
|
+
* or in Kotlin/Java (in which case it is a native callback).
|
|
20
|
+
*/
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
@Suppress("ClassName", "RedundantUnitReturnType")
|
|
24
|
+
fun interface Func_void_std__vector_TrackItem__double_QueueChangeReason: (Array<TrackItem>, Double, QueueChangeReason) -> Unit {
|
|
25
|
+
/**
|
|
26
|
+
* Call the given JS callback.
|
|
27
|
+
* @throws Throwable if the JS function itself throws an error, or if the JS function/runtime has already been deleted.
|
|
28
|
+
*/
|
|
29
|
+
@DoNotStrip
|
|
30
|
+
@Keep
|
|
31
|
+
override fun invoke(queue: Array<TrackItem>, currentIndex: Double, reason: QueueChangeReason): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `(queue: array, currentIndex: number, reason: enum) => void`.
|
|
36
|
+
* This is implemented in C++, via a `std::function<...>`.
|
|
37
|
+
* The callback might be coming from JS.
|
|
38
|
+
*/
|
|
39
|
+
@DoNotStrip
|
|
40
|
+
@Keep
|
|
41
|
+
@Suppress(
|
|
42
|
+
"KotlinJniMissingFunction", "unused",
|
|
43
|
+
"RedundantSuppression", "RedundantUnitReturnType", "FunctionName",
|
|
44
|
+
"ConvertSecondaryConstructorToPrimary", "ClassName", "LocalVariableName",
|
|
45
|
+
)
|
|
46
|
+
class Func_void_std__vector_TrackItem__double_QueueChangeReason_cxx: Func_void_std__vector_TrackItem__double_QueueChangeReason {
|
|
47
|
+
@DoNotStrip
|
|
48
|
+
@Keep
|
|
49
|
+
private val mHybridData: HybridData
|
|
50
|
+
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
private constructor(hybridData: HybridData) {
|
|
54
|
+
mHybridData = hybridData
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@DoNotStrip
|
|
58
|
+
@Keep
|
|
59
|
+
override fun invoke(queue: Array<TrackItem>, currentIndex: Double, reason: QueueChangeReason): Unit
|
|
60
|
+
= invoke_cxx(queue,currentIndex,reason)
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(queue: Array<TrackItem>, currentIndex: Double, reason: QueueChangeReason): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `(queue: array, currentIndex: number, reason: enum) => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `(Array<TrackItem>, Double, QueueChangeReason) -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_std__vector_TrackItem__double_QueueChangeReason_java(private val function: (Array<TrackItem>, Double, QueueChangeReason) -> Unit): Func_void_std__vector_TrackItem__double_QueueChangeReason {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(queue: Array<TrackItem>, currentIndex: Double, reason: QueueChangeReason): Unit {
|
|
78
|
+
return this.function(queue, currentIndex, reason)
|
|
79
|
+
}
|
|
80
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/queueplayer/HybridTrackPlayerSpec.kt
CHANGED
|
@@ -212,6 +212,15 @@ abstract class HybridTrackPlayerSpec: HybridObject() {
|
|
|
212
212
|
return Func_void_java(__result)
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
+
abstract fun onQueueChange(callback: (queue: Array<TrackItem>, currentIndex: Double, reason: QueueChangeReason) -> Unit): () -> Unit
|
|
216
|
+
|
|
217
|
+
@DoNotStrip
|
|
218
|
+
@Keep
|
|
219
|
+
private fun onQueueChange_cxx(callback: Func_void_std__vector_TrackItem__double_QueueChangeReason): Func_void {
|
|
220
|
+
val __result = onQueueChange(callback)
|
|
221
|
+
return Func_void_java(__result)
|
|
222
|
+
}
|
|
223
|
+
|
|
215
224
|
abstract fun onProgress(callback: (progress: PlayerProgress) -> Unit): () -> Unit
|
|
216
225
|
|
|
217
226
|
@DoNotStrip
|
|
@@ -26,6 +26,9 @@ data class PlayerConfig(
|
|
|
26
26
|
val userAgent: String?,
|
|
27
27
|
@DoNotStrip
|
|
28
28
|
@Keep
|
|
29
|
+
val placeholderArtworkUri: String?,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
29
32
|
val autoRetries: Double?,
|
|
30
33
|
@DoNotStrip
|
|
31
34
|
@Keep
|
|
@@ -65,6 +68,7 @@ data class PlayerConfig(
|
|
|
65
68
|
if (other !is PlayerConfig) return false
|
|
66
69
|
return Objects.deepEquals(this.httpHeaders, other.httpHeaders)
|
|
67
70
|
&& Objects.deepEquals(this.userAgent, other.userAgent)
|
|
71
|
+
&& Objects.deepEquals(this.placeholderArtworkUri, other.placeholderArtworkUri)
|
|
68
72
|
&& Objects.deepEquals(this.autoRetries, other.autoRetries)
|
|
69
73
|
&& Objects.deepEquals(this.retryBackoffMs, other.retryBackoffMs)
|
|
70
74
|
&& Objects.deepEquals(this.networkTimeoutMs, other.networkTimeoutMs)
|
|
@@ -82,6 +86,7 @@ data class PlayerConfig(
|
|
|
82
86
|
return arrayOf<Any?>(
|
|
83
87
|
httpHeaders,
|
|
84
88
|
userAgent,
|
|
89
|
+
placeholderArtworkUri,
|
|
85
90
|
autoRetries,
|
|
86
91
|
retryBackoffMs,
|
|
87
92
|
networkTimeoutMs,
|
|
@@ -104,8 +109,8 @@ data class PlayerConfig(
|
|
|
104
109
|
@Keep
|
|
105
110
|
@Suppress("unused")
|
|
106
111
|
@JvmStatic
|
|
107
|
-
private fun fromCpp(httpHeaders: Map<String, String>?, userAgent: String?, autoRetries: Double?, retryBackoffMs: Double?, networkTimeoutMs: Double?, audioContentType: AudioContentType?, audioCategoryOptions: AudioCategoryOptions?, visualizationEnabled: Boolean?, clampSeekToBuffered: Boolean?, lookaheadCacheMaxSizeMb: Double?, lookaheadCacheEvictionPolicy: EvictionPolicy?, progressUpdateIntervalMs: Double?, backgroundProgressUpdateIntervalMs: Double?): PlayerConfig {
|
|
108
|
-
return PlayerConfig(httpHeaders, userAgent, autoRetries, retryBackoffMs, networkTimeoutMs, audioContentType, audioCategoryOptions, visualizationEnabled, clampSeekToBuffered, lookaheadCacheMaxSizeMb, lookaheadCacheEvictionPolicy, progressUpdateIntervalMs, backgroundProgressUpdateIntervalMs)
|
|
112
|
+
private fun fromCpp(httpHeaders: Map<String, String>?, userAgent: String?, placeholderArtworkUri: String?, autoRetries: Double?, retryBackoffMs: Double?, networkTimeoutMs: Double?, audioContentType: AudioContentType?, audioCategoryOptions: AudioCategoryOptions?, visualizationEnabled: Boolean?, clampSeekToBuffered: Boolean?, lookaheadCacheMaxSizeMb: Double?, lookaheadCacheEvictionPolicy: EvictionPolicy?, progressUpdateIntervalMs: Double?, backgroundProgressUpdateIntervalMs: Double?): PlayerConfig {
|
|
113
|
+
return PlayerConfig(httpHeaders, userAgent, placeholderArtworkUri, autoRetries, retryBackoffMs, networkTimeoutMs, audioContentType, audioCategoryOptions, visualizationEnabled, clampSeekToBuffered, lookaheadCacheMaxSizeMb, lookaheadCacheEvictionPolicy, progressUpdateIntervalMs, backgroundProgressUpdateIntervalMs)
|
|
109
114
|
}
|
|
110
115
|
}
|
|
111
116
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// QueueChangeReason.kt
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
package com.margelo.nitro.queueplayer
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "QueueChangeReason".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class QueueChangeReason(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
SET_QUEUE(0),
|
|
20
|
+
ADD(1),
|
|
21
|
+
REMOVE(2),
|
|
22
|
+
MOVE(3),
|
|
23
|
+
CLEAR(4),
|
|
24
|
+
SHUFFLE(5);
|
|
25
|
+
|
|
26
|
+
companion object
|
|
27
|
+
}
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
#include "JHybridTrackPlayerSpec.hpp"
|
|
30
30
|
#include "JFunc_void_PlayerState_StateChangeReason.hpp"
|
|
31
31
|
#include "JFunc_void_std__optional_TrackItem__double_TrackChangeReason_std__optional_double_.hpp"
|
|
32
|
+
#include "JFunc_void_std__vector_TrackItem__double_QueueChangeReason.hpp"
|
|
32
33
|
#include "JFunc_void_PlayerProgress.hpp"
|
|
33
34
|
#include "JFunc_void_double_double.hpp"
|
|
34
35
|
#include "JFunc_void_PlaybackError.hpp"
|
|
@@ -106,6 +107,7 @@ void registerAllNatives() {
|
|
|
106
107
|
margelo::nitro::queueplayer::JHybridTrackPlayerSpec::CxxPart::registerNatives();
|
|
107
108
|
margelo::nitro::queueplayer::JFunc_void_PlayerState_StateChangeReason_cxx::registerNatives();
|
|
108
109
|
margelo::nitro::queueplayer::JFunc_void_std__optional_TrackItem__double_TrackChangeReason_std__optional_double__cxx::registerNatives();
|
|
110
|
+
margelo::nitro::queueplayer::JFunc_void_std__vector_TrackItem__double_QueueChangeReason_cxx::registerNatives();
|
|
109
111
|
margelo::nitro::queueplayer::JFunc_void_PlayerProgress_cxx::registerNatives();
|
|
110
112
|
margelo::nitro::queueplayer::JFunc_void_double_double_cxx::registerNatives();
|
|
111
113
|
margelo::nitro::queueplayer::JFunc_void_PlaybackError_cxx::registerNatives();
|
|
@@ -161,6 +161,14 @@ namespace margelo::nitro::queueplayer::bridge::swift {
|
|
|
161
161
|
};
|
|
162
162
|
}
|
|
163
163
|
|
|
164
|
+
// pragma MARK: std::function<void(const std::vector<TrackItem>& /* queue */, double /* currentIndex */, QueueChangeReason /* reason */)>
|
|
165
|
+
Func_void_std__vector_TrackItem__double_QueueChangeReason create_Func_void_std__vector_TrackItem__double_QueueChangeReason(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
166
|
+
auto swiftClosure = QueuePlayer::Func_void_std__vector_TrackItem__double_QueueChangeReason::fromUnsafe(swiftClosureWrapper);
|
|
167
|
+
return [swiftClosure = std::move(swiftClosure)](const std::vector<TrackItem>& queue, double currentIndex, QueueChangeReason reason) mutable -> void {
|
|
168
|
+
swiftClosure.call(queue, currentIndex, static_cast<int>(reason));
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
|
|
164
172
|
// pragma MARK: std::function<void(const PlayerProgress& /* progress */)>
|
|
165
173
|
Func_void_PlayerProgress create_Func_void_PlayerProgress(void* NON_NULL swiftClosureWrapper) noexcept {
|
|
166
174
|
auto swiftClosure = QueuePlayer::Func_void_PlayerProgress::fromUnsafe(swiftClosureWrapper);
|
|
@@ -98,6 +98,8 @@ namespace margelo::nitro::queueplayer { struct PlaybackMode; }
|
|
|
98
98
|
namespace margelo::nitro::queueplayer { struct PlayerProgress; }
|
|
99
99
|
// Forward declaration of `PlayerState` to properly resolve imports.
|
|
100
100
|
namespace margelo::nitro::queueplayer { enum class PlayerState; }
|
|
101
|
+
// Forward declaration of `QueueChangeReason` to properly resolve imports.
|
|
102
|
+
namespace margelo::nitro::queueplayer { enum class QueueChangeReason; }
|
|
101
103
|
// Forward declaration of `RemoteControlOptions` to properly resolve imports.
|
|
102
104
|
namespace margelo::nitro::queueplayer { struct RemoteControlOptions; }
|
|
103
105
|
// Forward declaration of `ReplayGainMode` to properly resolve imports.
|
|
@@ -180,6 +182,7 @@ namespace QueuePlayer { class HybridVisualizerSpec_cxx; }
|
|
|
180
182
|
#include "PlaybackMode.hpp"
|
|
181
183
|
#include "PlayerProgress.hpp"
|
|
182
184
|
#include "PlayerState.hpp"
|
|
185
|
+
#include "QueueChangeReason.hpp"
|
|
183
186
|
#include "RemoteControlOptions.hpp"
|
|
184
187
|
#include "ReplayGainMode.hpp"
|
|
185
188
|
#include "SectionIcon.hpp"
|
|
@@ -916,6 +919,28 @@ namespace margelo::nitro::queueplayer::bridge::swift {
|
|
|
916
919
|
return Func_void_std__optional_TrackItem__double_TrackChangeReason_std__optional_double__Wrapper(std::move(value));
|
|
917
920
|
}
|
|
918
921
|
|
|
922
|
+
// pragma MARK: std::function<void(const std::vector<TrackItem>& /* queue */, double /* currentIndex */, QueueChangeReason /* reason */)>
|
|
923
|
+
/**
|
|
924
|
+
* Specialized version of `std::function<void(const std::vector<TrackItem>&, double, QueueChangeReason)>`.
|
|
925
|
+
*/
|
|
926
|
+
using Func_void_std__vector_TrackItem__double_QueueChangeReason = std::function<void(const std::vector<TrackItem>& /* queue */, double /* currentIndex */, QueueChangeReason /* reason */)>;
|
|
927
|
+
/**
|
|
928
|
+
* Wrapper class for a `std::function<void(const std::vector<TrackItem>& / * queue * /, double / * currentIndex * /, QueueChangeReason / * reason * /)>`, this can be used from Swift.
|
|
929
|
+
*/
|
|
930
|
+
class Func_void_std__vector_TrackItem__double_QueueChangeReason_Wrapper final {
|
|
931
|
+
public:
|
|
932
|
+
explicit Func_void_std__vector_TrackItem__double_QueueChangeReason_Wrapper(std::function<void(const std::vector<TrackItem>& /* queue */, double /* currentIndex */, QueueChangeReason /* reason */)>&& func): _function(std::make_unique<std::function<void(const std::vector<TrackItem>& /* queue */, double /* currentIndex */, QueueChangeReason /* reason */)>>(std::move(func))) {}
|
|
933
|
+
inline void call(std::vector<TrackItem> queue, double currentIndex, int reason) const noexcept {
|
|
934
|
+
_function->operator()(queue, currentIndex, static_cast<QueueChangeReason>(reason));
|
|
935
|
+
}
|
|
936
|
+
private:
|
|
937
|
+
std::unique_ptr<std::function<void(const std::vector<TrackItem>& /* queue */, double /* currentIndex */, QueueChangeReason /* reason */)>> _function;
|
|
938
|
+
} SWIFT_NONCOPYABLE;
|
|
939
|
+
Func_void_std__vector_TrackItem__double_QueueChangeReason create_Func_void_std__vector_TrackItem__double_QueueChangeReason(void* NON_NULL swiftClosureWrapper) noexcept;
|
|
940
|
+
inline Func_void_std__vector_TrackItem__double_QueueChangeReason_Wrapper wrap_Func_void_std__vector_TrackItem__double_QueueChangeReason(Func_void_std__vector_TrackItem__double_QueueChangeReason value) noexcept {
|
|
941
|
+
return Func_void_std__vector_TrackItem__double_QueueChangeReason_Wrapper(std::move(value));
|
|
942
|
+
}
|
|
943
|
+
|
|
919
944
|
// pragma MARK: std::function<void(const PlayerProgress& /* progress */)>
|
|
920
945
|
/**
|
|
921
946
|
* Specialized version of `std::function<void(const PlayerProgress&)>`.
|
|
@@ -108,6 +108,8 @@ namespace margelo::nitro::queueplayer { struct PlayerConfig; }
|
|
|
108
108
|
namespace margelo::nitro::queueplayer { struct PlayerProgress; }
|
|
109
109
|
// Forward declaration of `PlayerState` to properly resolve imports.
|
|
110
110
|
namespace margelo::nitro::queueplayer { enum class PlayerState; }
|
|
111
|
+
// Forward declaration of `QueueChangeReason` to properly resolve imports.
|
|
112
|
+
namespace margelo::nitro::queueplayer { enum class QueueChangeReason; }
|
|
111
113
|
// Forward declaration of `RemoteControlOptions` to properly resolve imports.
|
|
112
114
|
namespace margelo::nitro::queueplayer { struct RemoteControlOptions; }
|
|
113
115
|
// Forward declaration of `RemoteSkipMode` to properly resolve imports.
|
|
@@ -194,6 +196,7 @@ namespace margelo::nitro::queueplayer { struct VoiceVocabulary; }
|
|
|
194
196
|
#include "PlayerConfig.hpp"
|
|
195
197
|
#include "PlayerProgress.hpp"
|
|
196
198
|
#include "PlayerState.hpp"
|
|
199
|
+
#include "QueueChangeReason.hpp"
|
|
197
200
|
#include "RemoteControlOptions.hpp"
|
|
198
201
|
#include "RemoteSkipMode.hpp"
|
|
199
202
|
#include "RepeatMode.hpp"
|
|
@@ -50,6 +50,8 @@ namespace margelo::nitro::queueplayer { struct SleepTimerState; }
|
|
|
50
50
|
namespace margelo::nitro::queueplayer { enum class StateChangeReason; }
|
|
51
51
|
// Forward declaration of `TrackChangeReason` to properly resolve imports.
|
|
52
52
|
namespace margelo::nitro::queueplayer { enum class TrackChangeReason; }
|
|
53
|
+
// Forward declaration of `QueueChangeReason` to properly resolve imports.
|
|
54
|
+
namespace margelo::nitro::queueplayer { enum class QueueChangeReason; }
|
|
53
55
|
// Forward declaration of `PlayerProgress` to properly resolve imports.
|
|
54
56
|
namespace margelo::nitro::queueplayer { struct PlayerProgress; }
|
|
55
57
|
// Forward declaration of `PlaybackError` to properly resolve imports.
|
|
@@ -124,6 +126,7 @@ namespace margelo::nitro::queueplayer { struct NowPlayingFormatAndroidExtras; }
|
|
|
124
126
|
#include <functional>
|
|
125
127
|
#include "StateChangeReason.hpp"
|
|
126
128
|
#include "TrackChangeReason.hpp"
|
|
129
|
+
#include "QueueChangeReason.hpp"
|
|
127
130
|
#include "PlayerProgress.hpp"
|
|
128
131
|
#include "PlaybackError.hpp"
|
|
129
132
|
#include "PlaybackErrorCode.hpp"
|
|
@@ -545,6 +548,14 @@ namespace margelo::nitro::queueplayer {
|
|
|
545
548
|
auto __value = std::move(__result.value());
|
|
546
549
|
return __value;
|
|
547
550
|
}
|
|
551
|
+
inline std::function<void()> onQueueChange(const std::function<void(const std::vector<TrackItem>& /* queue */, double /* currentIndex */, QueueChangeReason /* reason */)>& callback) override {
|
|
552
|
+
auto __result = _swiftPart.onQueueChange(callback);
|
|
553
|
+
if (__result.hasError()) [[unlikely]] {
|
|
554
|
+
std::rethrow_exception(__result.error());
|
|
555
|
+
}
|
|
556
|
+
auto __value = std::move(__result.value());
|
|
557
|
+
return __value;
|
|
558
|
+
}
|
|
548
559
|
inline std::function<void()> onProgress(const std::function<void(const PlayerProgress& /* progress */)>& callback) override {
|
|
549
560
|
auto __result = _swiftPart.onProgress(callback);
|
|
550
561
|
if (__result.hasError()) [[unlikely]] {
|
package/nitrogen/generated/ios/swift/Func_void_std__vector_TrackItem__double_QueueChangeReason.swift
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__vector_TrackItem__double_QueueChangeReason.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
import NitroModules
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Wraps a Swift `(_ queue: [TrackItem], _ currentIndex: Double, _ reason: QueueChangeReason) -> Void` as a class.
|
|
12
|
+
* This class can be used from C++, e.g. to wrap the Swift closure as a `std::function`.
|
|
13
|
+
*/
|
|
14
|
+
public final class Func_void_std__vector_TrackItem__double_QueueChangeReason {
|
|
15
|
+
public typealias bridge = margelo.nitro.queueplayer.bridge.swift
|
|
16
|
+
|
|
17
|
+
private let closure: (_ queue: [TrackItem], _ currentIndex: Double, _ reason: QueueChangeReason) -> Void
|
|
18
|
+
|
|
19
|
+
public init(_ closure: @escaping (_ queue: [TrackItem], _ currentIndex: Double, _ reason: QueueChangeReason) -> Void) {
|
|
20
|
+
self.closure = closure
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@inline(__always)
|
|
24
|
+
public func call(queue: bridge.std__vector_TrackItem_, currentIndex: Double, reason: Int32) -> Void {
|
|
25
|
+
self.closure(queue.map({ __item in __item }), currentIndex, margelo.nitro.queueplayer.QueueChangeReason(rawValue: reason)!)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Casts this instance to a retained unsafe raw pointer.
|
|
30
|
+
* This acquires one additional strong reference on the object!
|
|
31
|
+
*/
|
|
32
|
+
@inline(__always)
|
|
33
|
+
public func toUnsafe() -> UnsafeMutableRawPointer {
|
|
34
|
+
return Unmanaged.passRetained(self).toOpaque()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Casts an unsafe pointer to a `Func_void_std__vector_TrackItem__double_QueueChangeReason`.
|
|
39
|
+
* The pointer has to be a retained opaque `Unmanaged<Func_void_std__vector_TrackItem__double_QueueChangeReason>`.
|
|
40
|
+
* This removes one strong reference from the object!
|
|
41
|
+
*/
|
|
42
|
+
@inline(__always)
|
|
43
|
+
public static func fromUnsafe(_ pointer: UnsafeMutableRawPointer) -> Func_void_std__vector_TrackItem__double_QueueChangeReason {
|
|
44
|
+
return Unmanaged<Func_void_std__vector_TrackItem__double_QueueChangeReason>.fromOpaque(pointer).takeRetainedValue()
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -56,6 +56,7 @@ public protocol HybridTrackPlayerSpec_protocol: HybridObject {
|
|
|
56
56
|
func getSleepTimer() throws -> SleepTimerState
|
|
57
57
|
func onStateChange(callback: @escaping (_ state: PlayerState, _ reason: StateChangeReason) -> Void) throws -> () -> Void
|
|
58
58
|
func onTrackChange(callback: @escaping (_ track: TrackItem?, _ index: Double, _ reason: TrackChangeReason, _ transitionGapMs: Double?) -> Void) throws -> () -> Void
|
|
59
|
+
func onQueueChange(callback: @escaping (_ queue: [TrackItem], _ currentIndex: Double, _ reason: QueueChangeReason) -> Void) throws -> () -> Void
|
|
59
60
|
func onProgress(callback: @escaping (_ progress: PlayerProgress) -> Void) throws -> () -> Void
|
|
60
61
|
func onPlaybackMilestone(callback: @escaping (_ milestone: Double, _ trackIndex: Double) -> Void) throws -> () -> Void
|
|
61
62
|
func onError(callback: @escaping (_ error: PlaybackError) -> Void) throws -> () -> Void
|
|
@@ -869,6 +869,32 @@ open class HybridTrackPlayerSpec_cxx {
|
|
|
869
869
|
}
|
|
870
870
|
}
|
|
871
871
|
|
|
872
|
+
@inline(__always)
|
|
873
|
+
public final func onQueueChange(callback: bridge.Func_void_std__vector_TrackItem__double_QueueChangeReason) -> bridge.Result_std__function_void____ {
|
|
874
|
+
do {
|
|
875
|
+
let __result = try self.__implementation.onQueueChange(callback: { () -> ([TrackItem], Double, QueueChangeReason) -> Void in
|
|
876
|
+
let __wrappedFunction = bridge.wrap_Func_void_std__vector_TrackItem__double_QueueChangeReason(callback)
|
|
877
|
+
return { (__queue: [TrackItem], __currentIndex: Double, __reason: QueueChangeReason) -> Void in
|
|
878
|
+
__wrappedFunction.call({ () -> bridge.std__vector_TrackItem_ in
|
|
879
|
+
var __vector = bridge.create_std__vector_TrackItem_(__queue.count)
|
|
880
|
+
for __item in __queue {
|
|
881
|
+
__vector.push_back(__item)
|
|
882
|
+
}
|
|
883
|
+
return __vector
|
|
884
|
+
}(), __currentIndex, __reason.rawValue)
|
|
885
|
+
}
|
|
886
|
+
}())
|
|
887
|
+
let __resultCpp = { () -> bridge.Func_void in
|
|
888
|
+
let __closureWrapper = Func_void(__result)
|
|
889
|
+
return bridge.create_Func_void(__closureWrapper.toUnsafe())
|
|
890
|
+
}()
|
|
891
|
+
return bridge.create_Result_std__function_void____(__resultCpp)
|
|
892
|
+
} catch (let __error) {
|
|
893
|
+
let __exceptionPtr = __error.toCpp()
|
|
894
|
+
return bridge.create_Result_std__function_void____(__exceptionPtr)
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
|
|
872
898
|
@inline(__always)
|
|
873
899
|
public final func onProgress(callback: bridge.Func_void_PlayerProgress) -> bridge.Result_std__function_void____ {
|
|
874
900
|
do {
|
|
@@ -18,7 +18,7 @@ public extension PlayerConfig {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `PlayerConfig`.
|
|
20
20
|
*/
|
|
21
|
-
init(httpHeaders: Dictionary<String, String>?, userAgent: String?, autoRetries: Double?, retryBackoffMs: Double?, networkTimeoutMs: Double?, audioContentType: AudioContentType?, audioCategoryOptions: AudioCategoryOptions?, visualizationEnabled: Bool?, clampSeekToBuffered: Bool?, lookaheadCacheMaxSizeMb: Double?, lookaheadCacheEvictionPolicy: EvictionPolicy?, progressUpdateIntervalMs: Double?, backgroundProgressUpdateIntervalMs: Double?) {
|
|
21
|
+
init(httpHeaders: Dictionary<String, String>?, userAgent: String?, placeholderArtworkUri: String?, autoRetries: Double?, retryBackoffMs: Double?, networkTimeoutMs: Double?, audioContentType: AudioContentType?, audioCategoryOptions: AudioCategoryOptions?, visualizationEnabled: Bool?, clampSeekToBuffered: Bool?, lookaheadCacheMaxSizeMb: Double?, lookaheadCacheEvictionPolicy: EvictionPolicy?, progressUpdateIntervalMs: Double?, backgroundProgressUpdateIntervalMs: Double?) {
|
|
22
22
|
self.init({ () -> bridge.std__optional_std__unordered_map_std__string__std__string__ in
|
|
23
23
|
if let __unwrappedValue = httpHeaders {
|
|
24
24
|
return bridge.create_std__optional_std__unordered_map_std__string__std__string__({ () -> bridge.std__unordered_map_std__string__std__string_ in
|
|
@@ -37,6 +37,12 @@ public extension PlayerConfig {
|
|
|
37
37
|
} else {
|
|
38
38
|
return .init()
|
|
39
39
|
}
|
|
40
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
41
|
+
if let __unwrappedValue = placeholderArtworkUri {
|
|
42
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
43
|
+
} else {
|
|
44
|
+
return .init()
|
|
45
|
+
}
|
|
40
46
|
}(), { () -> bridge.std__optional_double_ in
|
|
41
47
|
if let __unwrappedValue = autoRetries {
|
|
42
48
|
return bridge.create_std__optional_double_(__unwrappedValue)
|
|
@@ -138,6 +144,18 @@ public extension PlayerConfig {
|
|
|
138
144
|
}()
|
|
139
145
|
}
|
|
140
146
|
|
|
147
|
+
@inline(__always)
|
|
148
|
+
var placeholderArtworkUri: String? {
|
|
149
|
+
return { () -> String? in
|
|
150
|
+
if bridge.has_value_std__optional_std__string_(self.__placeholderArtworkUri) {
|
|
151
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__placeholderArtworkUri)
|
|
152
|
+
return String(__unwrapped)
|
|
153
|
+
} else {
|
|
154
|
+
return nil
|
|
155
|
+
}
|
|
156
|
+
}()
|
|
157
|
+
}
|
|
158
|
+
|
|
141
159
|
@inline(__always)
|
|
142
160
|
var autoRetries: Double? {
|
|
143
161
|
return { () -> Double? in
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// QueueChangeReason.swift
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Represents the JS union `QueueChangeReason`, backed by a C++ enum.
|
|
10
|
+
*/
|
|
11
|
+
public typealias QueueChangeReason = margelo.nitro.queueplayer.QueueChangeReason
|
|
12
|
+
|
|
13
|
+
public extension QueueChangeReason {
|
|
14
|
+
/**
|
|
15
|
+
* Get a QueueChangeReason for the given String value, or
|
|
16
|
+
* return `nil` if the given value was invalid/unknown.
|
|
17
|
+
*/
|
|
18
|
+
init?(fromString string: String) {
|
|
19
|
+
switch string {
|
|
20
|
+
case "set-queue":
|
|
21
|
+
self = .setQueue
|
|
22
|
+
case "add":
|
|
23
|
+
self = .add
|
|
24
|
+
case "remove":
|
|
25
|
+
self = .remove
|
|
26
|
+
case "move":
|
|
27
|
+
self = .move
|
|
28
|
+
case "clear":
|
|
29
|
+
self = .clear
|
|
30
|
+
case "shuffle":
|
|
31
|
+
self = .shuffle
|
|
32
|
+
default:
|
|
33
|
+
return nil
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Get the String value this QueueChangeReason represents.
|
|
39
|
+
*/
|
|
40
|
+
var stringValue: String {
|
|
41
|
+
switch self {
|
|
42
|
+
case .setQueue:
|
|
43
|
+
return "set-queue"
|
|
44
|
+
case .add:
|
|
45
|
+
return "add"
|
|
46
|
+
case .remove:
|
|
47
|
+
return "remove"
|
|
48
|
+
case .move:
|
|
49
|
+
return "move"
|
|
50
|
+
case .clear:
|
|
51
|
+
return "clear"
|
|
52
|
+
case .shuffle:
|
|
53
|
+
return "shuffle"
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -57,6 +57,7 @@ namespace margelo::nitro::queueplayer {
|
|
|
57
57
|
prototype.registerHybridMethod("getSleepTimer", &HybridTrackPlayerSpec::getSleepTimer);
|
|
58
58
|
prototype.registerHybridMethod("onStateChange", &HybridTrackPlayerSpec::onStateChange);
|
|
59
59
|
prototype.registerHybridMethod("onTrackChange", &HybridTrackPlayerSpec::onTrackChange);
|
|
60
|
+
prototype.registerHybridMethod("onQueueChange", &HybridTrackPlayerSpec::onQueueChange);
|
|
60
61
|
prototype.registerHybridMethod("onProgress", &HybridTrackPlayerSpec::onProgress);
|
|
61
62
|
prototype.registerHybridMethod("onPlaybackMilestone", &HybridTrackPlayerSpec::onPlaybackMilestone);
|
|
62
63
|
prototype.registerHybridMethod("onError", &HybridTrackPlayerSpec::onError);
|
|
@@ -41,6 +41,8 @@ namespace margelo::nitro::queueplayer { struct SleepTimerState; }
|
|
|
41
41
|
namespace margelo::nitro::queueplayer { enum class StateChangeReason; }
|
|
42
42
|
// Forward declaration of `TrackChangeReason` to properly resolve imports.
|
|
43
43
|
namespace margelo::nitro::queueplayer { enum class TrackChangeReason; }
|
|
44
|
+
// Forward declaration of `QueueChangeReason` to properly resolve imports.
|
|
45
|
+
namespace margelo::nitro::queueplayer { enum class QueueChangeReason; }
|
|
44
46
|
// Forward declaration of `PlayerProgress` to properly resolve imports.
|
|
45
47
|
namespace margelo::nitro::queueplayer { struct PlayerProgress; }
|
|
46
48
|
// Forward declaration of `PlaybackError` to properly resolve imports.
|
|
@@ -82,6 +84,7 @@ namespace margelo::nitro::queueplayer { struct NowPlayingFormat; }
|
|
|
82
84
|
#include <functional>
|
|
83
85
|
#include "StateChangeReason.hpp"
|
|
84
86
|
#include "TrackChangeReason.hpp"
|
|
87
|
+
#include "QueueChangeReason.hpp"
|
|
85
88
|
#include "PlayerProgress.hpp"
|
|
86
89
|
#include "PlaybackError.hpp"
|
|
87
90
|
#include "BrowseSnapshot.hpp"
|
|
@@ -171,6 +174,7 @@ namespace margelo::nitro::queueplayer {
|
|
|
171
174
|
virtual SleepTimerState getSleepTimer() = 0;
|
|
172
175
|
virtual std::function<void()> onStateChange(const std::function<void(PlayerState /* state */, StateChangeReason /* reason */)>& callback) = 0;
|
|
173
176
|
virtual std::function<void()> onTrackChange(const std::function<void(const std::optional<TrackItem>& /* track */, double /* index */, TrackChangeReason /* reason */, std::optional<double> /* transitionGapMs */)>& callback) = 0;
|
|
177
|
+
virtual std::function<void()> onQueueChange(const std::function<void(const std::vector<TrackItem>& /* queue */, double /* currentIndex */, QueueChangeReason /* reason */)>& callback) = 0;
|
|
174
178
|
virtual std::function<void()> onProgress(const std::function<void(const PlayerProgress& /* progress */)>& callback) = 0;
|
|
175
179
|
virtual std::function<void()> onPlaybackMilestone(const std::function<void(double /* milestone */, double /* trackIndex */)>& callback) = 0;
|
|
176
180
|
virtual std::function<void()> onError(const std::function<void(const PlaybackError& /* error */)>& callback) = 0;
|
|
@@ -51,6 +51,7 @@ namespace margelo::nitro::queueplayer {
|
|
|
51
51
|
public:
|
|
52
52
|
std::optional<std::unordered_map<std::string, std::string>> httpHeaders SWIFT_PRIVATE;
|
|
53
53
|
std::optional<std::string> userAgent SWIFT_PRIVATE;
|
|
54
|
+
std::optional<std::string> placeholderArtworkUri SWIFT_PRIVATE;
|
|
54
55
|
std::optional<double> autoRetries SWIFT_PRIVATE;
|
|
55
56
|
std::optional<double> retryBackoffMs SWIFT_PRIVATE;
|
|
56
57
|
std::optional<double> networkTimeoutMs SWIFT_PRIVATE;
|
|
@@ -65,7 +66,7 @@ namespace margelo::nitro::queueplayer {
|
|
|
65
66
|
|
|
66
67
|
public:
|
|
67
68
|
PlayerConfig() = default;
|
|
68
|
-
explicit PlayerConfig(std::optional<std::unordered_map<std::string, std::string>> httpHeaders, std::optional<std::string> userAgent, std::optional<double> autoRetries, std::optional<double> retryBackoffMs, std::optional<double> networkTimeoutMs, std::optional<AudioContentType> audioContentType, std::optional<AudioCategoryOptions> audioCategoryOptions, std::optional<bool> visualizationEnabled, std::optional<bool> clampSeekToBuffered, std::optional<double> lookaheadCacheMaxSizeMb, std::optional<EvictionPolicy> lookaheadCacheEvictionPolicy, std::optional<double> progressUpdateIntervalMs, std::optional<double> backgroundProgressUpdateIntervalMs): httpHeaders(httpHeaders), userAgent(userAgent), autoRetries(autoRetries), retryBackoffMs(retryBackoffMs), networkTimeoutMs(networkTimeoutMs), audioContentType(audioContentType), audioCategoryOptions(audioCategoryOptions), visualizationEnabled(visualizationEnabled), clampSeekToBuffered(clampSeekToBuffered), lookaheadCacheMaxSizeMb(lookaheadCacheMaxSizeMb), lookaheadCacheEvictionPolicy(lookaheadCacheEvictionPolicy), progressUpdateIntervalMs(progressUpdateIntervalMs), backgroundProgressUpdateIntervalMs(backgroundProgressUpdateIntervalMs) {}
|
|
69
|
+
explicit PlayerConfig(std::optional<std::unordered_map<std::string, std::string>> httpHeaders, std::optional<std::string> userAgent, std::optional<std::string> placeholderArtworkUri, std::optional<double> autoRetries, std::optional<double> retryBackoffMs, std::optional<double> networkTimeoutMs, std::optional<AudioContentType> audioContentType, std::optional<AudioCategoryOptions> audioCategoryOptions, std::optional<bool> visualizationEnabled, std::optional<bool> clampSeekToBuffered, std::optional<double> lookaheadCacheMaxSizeMb, std::optional<EvictionPolicy> lookaheadCacheEvictionPolicy, std::optional<double> progressUpdateIntervalMs, std::optional<double> backgroundProgressUpdateIntervalMs): httpHeaders(httpHeaders), userAgent(userAgent), placeholderArtworkUri(placeholderArtworkUri), autoRetries(autoRetries), retryBackoffMs(retryBackoffMs), networkTimeoutMs(networkTimeoutMs), audioContentType(audioContentType), audioCategoryOptions(audioCategoryOptions), visualizationEnabled(visualizationEnabled), clampSeekToBuffered(clampSeekToBuffered), lookaheadCacheMaxSizeMb(lookaheadCacheMaxSizeMb), lookaheadCacheEvictionPolicy(lookaheadCacheEvictionPolicy), progressUpdateIntervalMs(progressUpdateIntervalMs), backgroundProgressUpdateIntervalMs(backgroundProgressUpdateIntervalMs) {}
|
|
69
70
|
|
|
70
71
|
public:
|
|
71
72
|
friend bool operator==(const PlayerConfig& lhs, const PlayerConfig& rhs) = default;
|
|
@@ -83,6 +84,7 @@ namespace margelo::nitro {
|
|
|
83
84
|
return margelo::nitro::queueplayer::PlayerConfig(
|
|
84
85
|
JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "httpHeaders"))),
|
|
85
86
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "userAgent"))),
|
|
87
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "placeholderArtworkUri"))),
|
|
86
88
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "autoRetries"))),
|
|
87
89
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "retryBackoffMs"))),
|
|
88
90
|
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "networkTimeoutMs"))),
|
|
@@ -100,6 +102,7 @@ namespace margelo::nitro {
|
|
|
100
102
|
jsi::Object obj(runtime);
|
|
101
103
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "httpHeaders"), JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::toJSI(runtime, arg.httpHeaders));
|
|
102
104
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "userAgent"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.userAgent));
|
|
105
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "placeholderArtworkUri"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.placeholderArtworkUri));
|
|
103
106
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "autoRetries"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.autoRetries));
|
|
104
107
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "retryBackoffMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.retryBackoffMs));
|
|
105
108
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "networkTimeoutMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.networkTimeoutMs));
|
|
@@ -123,6 +126,7 @@ namespace margelo::nitro {
|
|
|
123
126
|
}
|
|
124
127
|
if (!JSIConverter<std::optional<std::unordered_map<std::string, std::string>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "httpHeaders")))) return false;
|
|
125
128
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "userAgent")))) return false;
|
|
129
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "placeholderArtworkUri")))) return false;
|
|
126
130
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "autoRetries")))) return false;
|
|
127
131
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "retryBackoffMs")))) return false;
|
|
128
132
|
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "networkTimeoutMs")))) return false;
|