react-native-nitro-player 1.7.0-alpha.3 → 1.7.0-alpha.5
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 +9 -0
- package/android/src/main/AndroidManifest.xml +8 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/HybridAndroidAutoMediaLibrary.kt +51 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/HybridPlayerQueue.kt +45 -7
- package/android/src/main/java/com/margelo/nitro/nitroplayer/connection/AndroidAutoConnectionDetector.kt +2 -2
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/ExoPlayerCore.kt +17 -2
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/NitroPlayerLogger.kt +2 -2
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerAndroidAuto.kt +41 -31
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerAudioFocus.kt +65 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerCast.kt +1 -1
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerCore.kt +92 -15
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerListener.kt +12 -17
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerNotify.kt +5 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerPlayback.kt +39 -13
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerQueue.kt +1 -1
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerQueueBuild.kt +25 -4
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerRecovery.kt +97 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerSetup.kt +0 -5
- package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerUrlLoader.kt +22 -5
- package/android/src/main/java/com/margelo/nitro/nitroplayer/download/DownloadDatabase.kt +3 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/download/TrackItemJson.kt +6 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/AudioFocusController.kt +87 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/CastSessionController.kt +2 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/ExoPlayerBuilder.kt +3 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/MediaBrowserService.kt +96 -45
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/MediaLibrary.kt +2 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/MediaLibraryManager.kt +147 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/MediaLibraryParser.kt +3 -0
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/MediaSessionCallbackFactory.kt +102 -24
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/MediaSessionManager.kt +51 -3
- package/android/src/main/java/com/margelo/nitro/nitroplayer/media/PlaybackService.kt +82 -1
- package/android/src/main/java/com/margelo/nitro/nitroplayer/playlist/PlaylistManager.kt +75 -0
- package/ios/cast/CastQueueDiff.swift +58 -0
- package/ios/cast/CastQueueReconciler.swift +228 -0
- package/ios/core/CastSessionManager.swift +215 -31
- package/ios/core/TrackPlayerCast.swift +96 -65
- package/ios/core/TrackPlayerCore.swift +31 -0
- package/ios/core/TrackPlayerListener.swift +19 -3
- package/ios/core/TrackPlayerPlayback.swift +12 -10
- package/ios/core/TrackPlayerQueue.swift +10 -2
- package/ios/core/TrackPlayerQueueBuild.swift +21 -9
- package/ios/core/TrackPlayerTempQueue.swift +27 -15
- package/ios/core/TrackPlayerUrlLoader.swift +6 -2
- package/ios/playlist/PlaylistManager.swift +60 -1
- package/ios/queue/HybridPlayerQueue.swift +40 -13
- package/lib/hooks/callbackManager.d.ts +2 -0
- package/lib/hooks/callbackManager.js +23 -8
- package/lib/index.js +5 -1
- package/lib/specs/AndroidAutoMediaLibrary.nitro.d.ts +12 -0
- package/lib/specs/TrackPlayer.nitro.d.ts +5 -1
- package/lib/types/AndroidAutoMediaLibrary.d.ts +11 -0
- package/lib/types/PlayerQueue.d.ts +14 -0
- package/lib/utils/androidAutoMediaLibrary.d.ts +13 -1
- package/lib/utils/androidAutoMediaLibrary.js +23 -0
- package/nitrogen/generated/android/NitroPlayerOnLoad.cpp +6 -0
- package/nitrogen/generated/android/c++/JAndroidAudioFocusMode.hpp +61 -0
- package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__string_std__string.hpp +76 -0
- package/nitrogen/generated/android/c++/JHybridAndroidAutoMediaLibrarySpec.cpp +29 -0
- package/nitrogen/generated/android/c++/JHybridAndroidAutoMediaLibrarySpec.hpp +6 -0
- package/nitrogen/generated/android/c++/JHybridPlayerQueueSpec.cpp +43 -0
- package/nitrogen/generated/android/c++/JHybridPlayerQueueSpec.hpp +2 -0
- package/nitrogen/generated/android/c++/JHybridTrackPlayerSpec.cpp +4 -0
- package/nitrogen/generated/android/c++/JPlayerConfig.hpp +9 -3
- package/nitrogen/generated/android/c++/JShufflePlaylistOptions.hpp +57 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/AndroidAudioFocusMode.kt +24 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/Func_void.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/Func_void_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/Func_void_std__string_std__string.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/HybridAndroidAutoMediaLibrarySpec.kt +44 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/HybridPlayerQueueSpec.kt +8 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/PlayerConfig.kt +6 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/ShufflePlaylistOptions.kt +38 -0
- package/nitrogen/generated/ios/NitroPlayer-Swift-Cxx-Bridge.hpp +36 -0
- package/nitrogen/generated/ios/NitroPlayer-Swift-Cxx-Umbrella.hpp +6 -0
- package/nitrogen/generated/ios/c++/HybridPlayerQueueSpecSwift.hpp +19 -0
- package/nitrogen/generated/ios/c++/HybridTrackPlayerSpecSwift.hpp +3 -0
- package/nitrogen/generated/ios/swift/AndroidAudioFocusMode.swift +44 -0
- package/nitrogen/generated/ios/swift/HybridPlayerQueueSpec.swift +2 -0
- package/nitrogen/generated/ios/swift/HybridPlayerQueueSpec_cxx.swift +38 -0
- package/nitrogen/generated/ios/swift/PlayerConfig.swift +12 -1
- package/nitrogen/generated/ios/swift/ShufflePlaylistOptions.swift +42 -0
- package/nitrogen/generated/shared/c++/AndroidAudioFocusMode.hpp +80 -0
- package/nitrogen/generated/shared/c++/HybridAndroidAutoMediaLibrarySpec.cpp +6 -0
- package/nitrogen/generated/shared/c++/HybridAndroidAutoMediaLibrarySpec.hpp +7 -0
- package/nitrogen/generated/shared/c++/HybridPlayerQueueSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridPlayerQueueSpec.hpp +5 -0
- package/nitrogen/generated/shared/c++/PlayerConfig.hpp +9 -3
- package/nitrogen/generated/shared/c++/ShufflePlaylistOptions.hpp +83 -0
- package/package.json +1 -1
- package/src/hooks/callbackManager.ts +25 -10
- package/src/index.ts +9 -1
- package/src/specs/AndroidAutoMediaLibrary.nitro.ts +18 -0
- package/src/specs/TrackPlayer.nitro.ts +11 -0
- package/src/types/AndroidAutoMediaLibrary.ts +24 -0
- package/src/types/PlayerQueue.ts +17 -0
- package/src/utils/androidAutoMediaLibrary.ts +48 -1
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JFunc_void_std__string_std__string.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include <functional>
|
|
12
|
+
|
|
13
|
+
#include <string>
|
|
14
|
+
#include <functional>
|
|
15
|
+
#include <NitroModules/JNICallable.hpp>
|
|
16
|
+
|
|
17
|
+
namespace margelo::nitro::nitroplayer {
|
|
18
|
+
|
|
19
|
+
using namespace facebook;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Represents the Java/Kotlin callback `(requestId: String, parentId: String) -> Unit`.
|
|
23
|
+
* This can be passed around between C++ and Java/Kotlin.
|
|
24
|
+
*/
|
|
25
|
+
struct JFunc_void_std__string_std__string: public jni::JavaClass<JFunc_void_std__string_std__string> {
|
|
26
|
+
public:
|
|
27
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroplayer/Func_void_std__string_std__string;";
|
|
28
|
+
|
|
29
|
+
public:
|
|
30
|
+
/**
|
|
31
|
+
* Invokes the function this `JFunc_void_std__string_std__string` instance holds through JNI.
|
|
32
|
+
*/
|
|
33
|
+
void invoke(const std::string& requestId, const std::string& parentId) const {
|
|
34
|
+
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* requestId */, jni::alias_ref<jni::JString> /* parentId */)>("invoke");
|
|
35
|
+
method(self(), jni::make_jstring(requestId), jni::make_jstring(parentId));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* An implementation of Func_void_std__string_std__string that is backed by a C++ implementation (using `std::function<...>`)
|
|
41
|
+
*/
|
|
42
|
+
class JFunc_void_std__string_std__string_cxx final: public jni::HybridClass<JFunc_void_std__string_std__string_cxx, JFunc_void_std__string_std__string> {
|
|
43
|
+
public:
|
|
44
|
+
static jni::local_ref<JFunc_void_std__string_std__string::javaobject> fromCpp(const std::function<void(const std::string& /* requestId */, const std::string& /* parentId */)>& func) {
|
|
45
|
+
return JFunc_void_std__string_std__string_cxx::newObjectCxxArgs(func);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
/**
|
|
50
|
+
* Invokes the C++ `std::function<...>` this `JFunc_void_std__string_std__string_cxx` instance holds.
|
|
51
|
+
*/
|
|
52
|
+
void invoke_cxx(jni::alias_ref<jni::JString> requestId, jni::alias_ref<jni::JString> parentId) {
|
|
53
|
+
_func(requestId->toStdString(), parentId->toStdString());
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
public:
|
|
57
|
+
[[nodiscard]]
|
|
58
|
+
inline const std::function<void(const std::string& /* requestId */, const std::string& /* parentId */)>& getFunction() const {
|
|
59
|
+
return _func;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
public:
|
|
63
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroplayer/Func_void_std__string_std__string_cxx;";
|
|
64
|
+
static void registerNatives() {
|
|
65
|
+
registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_std__string_cxx::invoke_cxx)});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
private:
|
|
69
|
+
explicit JFunc_void_std__string_std__string_cxx(const std::function<void(const std::string& /* requestId */, const std::string& /* parentId */)>& func): _func(func) { }
|
|
70
|
+
|
|
71
|
+
private:
|
|
72
|
+
friend HybridBase;
|
|
73
|
+
std::function<void(const std::string& /* requestId */, const std::string& /* parentId */)> _func;
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
} // namespace margelo::nitro::nitroplayer
|
|
@@ -13,6 +13,11 @@
|
|
|
13
13
|
#include <NitroModules/JPromise.hpp>
|
|
14
14
|
#include <NitroModules/JUnit.hpp>
|
|
15
15
|
#include <string>
|
|
16
|
+
#include <functional>
|
|
17
|
+
#include "JFunc_void_std__string_std__string.hpp"
|
|
18
|
+
#include <NitroModules/JNICallable.hpp>
|
|
19
|
+
#include "JFunc_void_std__string.hpp"
|
|
20
|
+
#include "JFunc_void.hpp"
|
|
16
21
|
|
|
17
22
|
namespace margelo::nitro::nitroplayer {
|
|
18
23
|
|
|
@@ -77,5 +82,29 @@ namespace margelo::nitro::nitroplayer {
|
|
|
77
82
|
return __promise;
|
|
78
83
|
}();
|
|
79
84
|
}
|
|
85
|
+
void JHybridAndroidAutoMediaLibrarySpec::onLoadChildren(const std::function<void(const std::string& /* requestId */, const std::string& /* parentId */)>& callback) {
|
|
86
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string_std__string::javaobject> /* callback */)>("onLoadChildren_cxx");
|
|
87
|
+
method(_javaPart, JFunc_void_std__string_std__string_cxx::fromCpp(callback));
|
|
88
|
+
}
|
|
89
|
+
void JHybridAndroidAutoMediaLibrarySpec::onSearch(const std::function<void(const std::string& /* requestId */, const std::string& /* query */)>& callback) {
|
|
90
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string_std__string::javaobject> /* callback */)>("onSearch_cxx");
|
|
91
|
+
method(_javaPart, JFunc_void_std__string_std__string_cxx::fromCpp(callback));
|
|
92
|
+
}
|
|
93
|
+
void JHybridAndroidAutoMediaLibrarySpec::resolveRequest(const std::string& requestId, const std::string& itemsJson) {
|
|
94
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* requestId */, jni::alias_ref<jni::JString> /* itemsJson */)>("resolveRequest");
|
|
95
|
+
method(_javaPart, jni::make_jstring(requestId), jni::make_jstring(itemsJson));
|
|
96
|
+
}
|
|
97
|
+
void JHybridAndroidAutoMediaLibrarySpec::setSessionButtons(const std::string& buttonsJson) {
|
|
98
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* buttonsJson */)>("setSessionButtons");
|
|
99
|
+
method(_javaPart, jni::make_jstring(buttonsJson));
|
|
100
|
+
}
|
|
101
|
+
void JHybridAndroidAutoMediaLibrarySpec::onSessionButtonPress(const std::function<void(const std::string& /* action */)>& callback) {
|
|
102
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void_std__string::javaobject> /* callback */)>("onSessionButtonPress_cxx");
|
|
103
|
+
method(_javaPart, JFunc_void_std__string_cxx::fromCpp(callback));
|
|
104
|
+
}
|
|
105
|
+
void JHybridAndroidAutoMediaLibrarySpec::onPlaybackResumption(const std::function<void()>& callback) {
|
|
106
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JFunc_void::javaobject> /* callback */)>("onPlaybackResumption_cxx");
|
|
107
|
+
method(_javaPart, JFunc_void_cxx::fromCpp(callback));
|
|
108
|
+
}
|
|
80
109
|
|
|
81
110
|
} // namespace margelo::nitro::nitroplayer
|
|
@@ -56,6 +56,12 @@ namespace margelo::nitro::nitroplayer {
|
|
|
56
56
|
// Methods
|
|
57
57
|
std::shared_ptr<Promise<void>> setMediaLibrary(const std::string& libraryJson) override;
|
|
58
58
|
std::shared_ptr<Promise<void>> clearMediaLibrary() override;
|
|
59
|
+
void onLoadChildren(const std::function<void(const std::string& /* requestId */, const std::string& /* parentId */)>& callback) override;
|
|
60
|
+
void onSearch(const std::function<void(const std::string& /* requestId */, const std::string& /* query */)>& callback) override;
|
|
61
|
+
void resolveRequest(const std::string& requestId, const std::string& itemsJson) override;
|
|
62
|
+
void setSessionButtons(const std::string& buttonsJson) override;
|
|
63
|
+
void onSessionButtonPress(const std::function<void(const std::string& /* action */)>& callback) override;
|
|
64
|
+
void onPlaybackResumption(const std::function<void()>& callback) override;
|
|
59
65
|
|
|
60
66
|
private:
|
|
61
67
|
jni::global_ref<JHybridAndroidAutoMediaLibrarySpec::JavaPart> _javaPart;
|
|
@@ -11,6 +11,8 @@
|
|
|
11
11
|
namespace margelo::nitro::nitroplayer { struct Playlist; }
|
|
12
12
|
// Forward declaration of `TrackItem` to properly resolve imports.
|
|
13
13
|
namespace margelo::nitro::nitroplayer { struct TrackItem; }
|
|
14
|
+
// Forward declaration of `ShufflePlaylistOptions` to properly resolve imports.
|
|
15
|
+
namespace margelo::nitro::nitroplayer { struct ShufflePlaylistOptions; }
|
|
14
16
|
// Forward declaration of `QueueOperation` to properly resolve imports.
|
|
15
17
|
namespace margelo::nitro::nitroplayer { enum class QueueOperation; }
|
|
16
18
|
|
|
@@ -31,6 +33,8 @@ namespace margelo::nitro::nitroplayer { enum class QueueOperation; }
|
|
|
31
33
|
#include "JTrackItem.hpp"
|
|
32
34
|
#include <NitroModules/AnyMap.hpp>
|
|
33
35
|
#include <NitroModules/JAnyMap.hpp>
|
|
36
|
+
#include "ShufflePlaylistOptions.hpp"
|
|
37
|
+
#include "JShufflePlaylistOptions.hpp"
|
|
34
38
|
#include "QueueOperation.hpp"
|
|
35
39
|
#include <functional>
|
|
36
40
|
#include "JFunc_void_std__vector_Playlist__std__optional_QueueOperation_.hpp"
|
|
@@ -205,6 +209,45 @@ namespace margelo::nitro::nitroplayer {
|
|
|
205
209
|
return __promise;
|
|
206
210
|
}();
|
|
207
211
|
}
|
|
212
|
+
std::shared_ptr<Promise<void>> JHybridPlayerQueueSpec::removeTracksFromPlaylist(const std::string& playlistId, const std::vector<std::string>& trackIds) {
|
|
213
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* playlistId */, jni::alias_ref<jni::JArrayClass<jni::JString>> /* trackIds */)>("removeTracksFromPlaylist");
|
|
214
|
+
auto __result = method(_javaPart, jni::make_jstring(playlistId), [&]() {
|
|
215
|
+
size_t __size = trackIds.size();
|
|
216
|
+
jni::local_ref<jni::JArrayClass<jni::JString>> __array = jni::JArrayClass<jni::JString>::newArray(__size);
|
|
217
|
+
for (size_t __i = 0; __i < __size; __i++) {
|
|
218
|
+
const auto& __element = trackIds[__i];
|
|
219
|
+
auto __elementJni = jni::make_jstring(__element);
|
|
220
|
+
__array->setElement(__i, *__elementJni);
|
|
221
|
+
}
|
|
222
|
+
return __array;
|
|
223
|
+
}());
|
|
224
|
+
return [&]() {
|
|
225
|
+
auto __promise = Promise<void>::create();
|
|
226
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
|
|
227
|
+
__promise->resolve();
|
|
228
|
+
});
|
|
229
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
230
|
+
jni::JniException __jniError(__throwable);
|
|
231
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
232
|
+
});
|
|
233
|
+
return __promise;
|
|
234
|
+
}();
|
|
235
|
+
}
|
|
236
|
+
std::shared_ptr<Promise<void>> JHybridPlayerQueueSpec::shufflePlaylist(const std::string& playlistId, const std::optional<ShufflePlaylistOptions>& options) {
|
|
237
|
+
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* playlistId */, jni::alias_ref<JShufflePlaylistOptions> /* options */)>("shufflePlaylist");
|
|
238
|
+
auto __result = method(_javaPart, jni::make_jstring(playlistId), options.has_value() ? JShufflePlaylistOptions::fromCpp(options.value()) : nullptr);
|
|
239
|
+
return [&]() {
|
|
240
|
+
auto __promise = Promise<void>::create();
|
|
241
|
+
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
|
|
242
|
+
__promise->resolve();
|
|
243
|
+
});
|
|
244
|
+
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
245
|
+
jni::JniException __jniError(__throwable);
|
|
246
|
+
__promise->reject(std::make_exception_ptr(__jniError));
|
|
247
|
+
});
|
|
248
|
+
return __promise;
|
|
249
|
+
}();
|
|
250
|
+
}
|
|
208
251
|
std::shared_ptr<Promise<void>> JHybridPlayerQueueSpec::loadPlaylist(const std::string& playlistId, std::optional<double> index) {
|
|
209
252
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<jni::JString> /* playlistId */, jni::alias_ref<jni::JDouble> /* index */)>("loadPlaylist");
|
|
210
253
|
auto __result = method(_javaPart, jni::make_jstring(playlistId), index.has_value() ? jni::JDouble::valueOf(index.value()) : nullptr);
|
|
@@ -63,6 +63,8 @@ namespace margelo::nitro::nitroplayer {
|
|
|
63
63
|
std::shared_ptr<Promise<void>> addTracksToPlaylist(const std::string& playlistId, const std::vector<TrackItem>& tracks, std::optional<double> index) override;
|
|
64
64
|
std::shared_ptr<Promise<void>> removeTrackFromPlaylist(const std::string& playlistId, const std::string& trackId) override;
|
|
65
65
|
std::shared_ptr<Promise<void>> reorderTrackInPlaylist(const std::string& playlistId, const std::string& trackId, double newIndex) override;
|
|
66
|
+
std::shared_ptr<Promise<void>> removeTracksFromPlaylist(const std::string& playlistId, const std::vector<std::string>& trackIds) override;
|
|
67
|
+
std::shared_ptr<Promise<void>> shufflePlaylist(const std::string& playlistId, const std::optional<ShufflePlaylistOptions>& options) override;
|
|
66
68
|
std::shared_ptr<Promise<void>> loadPlaylist(const std::string& playlistId, std::optional<double> index) override;
|
|
67
69
|
std::variant<nitro::NullType, std::string> getCurrentPlaylistId() override;
|
|
68
70
|
void onPlaylistsChanged(const std::function<void(const std::vector<Playlist>& /* playlists */, std::optional<QueueOperation> /* operation */)>& callback) override;
|
|
@@ -19,6 +19,8 @@ namespace margelo::nitro::nitroplayer { enum class CurrentPlayingType; }
|
|
|
19
19
|
namespace margelo::nitro::nitroplayer { enum class RepeatMode; }
|
|
20
20
|
// Forward declaration of `PlayerConfig` to properly resolve imports.
|
|
21
21
|
namespace margelo::nitro::nitroplayer { struct PlayerConfig; }
|
|
22
|
+
// Forward declaration of `AndroidAudioFocusMode` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::nitroplayer { enum class AndroidAudioFocusMode; }
|
|
22
24
|
// Forward declaration of `Reason` to properly resolve imports.
|
|
23
25
|
namespace margelo::nitro::nitroplayer { enum class Reason; }
|
|
24
26
|
// Forward declaration of `TimedMetadata` to properly resolve imports.
|
|
@@ -49,6 +51,8 @@ namespace margelo::nitro::nitroplayer { struct TimedMetadata; }
|
|
|
49
51
|
#include "JRepeatMode.hpp"
|
|
50
52
|
#include "PlayerConfig.hpp"
|
|
51
53
|
#include "JPlayerConfig.hpp"
|
|
54
|
+
#include "AndroidAudioFocusMode.hpp"
|
|
55
|
+
#include "JAndroidAudioFocusMode.hpp"
|
|
52
56
|
#include "Reason.hpp"
|
|
53
57
|
#include <functional>
|
|
54
58
|
#include "JFunc_void_TrackItem_std__optional_Reason_.hpp"
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
#include <fbjni/fbjni.h>
|
|
11
11
|
#include "PlayerConfig.hpp"
|
|
12
12
|
|
|
13
|
+
#include "AndroidAudioFocusMode.hpp"
|
|
14
|
+
#include "JAndroidAudioFocusMode.hpp"
|
|
13
15
|
#include <optional>
|
|
14
16
|
#include <string>
|
|
15
17
|
|
|
@@ -46,6 +48,8 @@ namespace margelo::nitro::nitroplayer {
|
|
|
46
48
|
jni::local_ref<jni::JDouble> lookaheadCount = this->getFieldValue(fieldLookaheadCount);
|
|
47
49
|
static const auto fieldAndroidNotificationIcon = clazz->getField<jni::JString>("androidNotificationIcon");
|
|
48
50
|
jni::local_ref<jni::JString> androidNotificationIcon = this->getFieldValue(fieldAndroidNotificationIcon);
|
|
51
|
+
static const auto fieldAndroidAudioFocus = clazz->getField<JAndroidAudioFocusMode>("androidAudioFocus");
|
|
52
|
+
jni::local_ref<JAndroidAudioFocusMode> androidAudioFocus = this->getFieldValue(fieldAndroidAudioFocus);
|
|
49
53
|
return PlayerConfig(
|
|
50
54
|
androidAutoEnabled != nullptr ? std::make_optional(static_cast<bool>(androidAutoEnabled->value())) : std::nullopt,
|
|
51
55
|
carPlayEnabled != nullptr ? std::make_optional(static_cast<bool>(carPlayEnabled->value())) : std::nullopt,
|
|
@@ -53,7 +57,8 @@ namespace margelo::nitro::nitroplayer {
|
|
|
53
57
|
remoteSkipForwardInterval != nullptr ? std::make_optional(remoteSkipForwardInterval->value()) : std::nullopt,
|
|
54
58
|
remoteSkipBackwardInterval != nullptr ? std::make_optional(remoteSkipBackwardInterval->value()) : std::nullopt,
|
|
55
59
|
lookaheadCount != nullptr ? std::make_optional(lookaheadCount->value()) : std::nullopt,
|
|
56
|
-
androidNotificationIcon != nullptr ? std::make_optional(androidNotificationIcon->toStdString()) : std::nullopt
|
|
60
|
+
androidNotificationIcon != nullptr ? std::make_optional(androidNotificationIcon->toStdString()) : std::nullopt,
|
|
61
|
+
androidAudioFocus != nullptr ? std::make_optional(androidAudioFocus->toCpp()) : std::nullopt
|
|
57
62
|
);
|
|
58
63
|
}
|
|
59
64
|
|
|
@@ -63,7 +68,7 @@ namespace margelo::nitro::nitroplayer {
|
|
|
63
68
|
*/
|
|
64
69
|
[[maybe_unused]]
|
|
65
70
|
static jni::local_ref<JPlayerConfig::javaobject> fromCpp(const PlayerConfig& value) {
|
|
66
|
-
using JSignature = JPlayerConfig(jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>);
|
|
71
|
+
using JSignature = JPlayerConfig(jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<JAndroidAudioFocusMode>);
|
|
67
72
|
static const auto clazz = javaClassStatic();
|
|
68
73
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
69
74
|
return create(
|
|
@@ -74,7 +79,8 @@ namespace margelo::nitro::nitroplayer {
|
|
|
74
79
|
value.remoteSkipForwardInterval.has_value() ? jni::JDouble::valueOf(value.remoteSkipForwardInterval.value()) : nullptr,
|
|
75
80
|
value.remoteSkipBackwardInterval.has_value() ? jni::JDouble::valueOf(value.remoteSkipBackwardInterval.value()) : nullptr,
|
|
76
81
|
value.lookaheadCount.has_value() ? jni::JDouble::valueOf(value.lookaheadCount.value()) : nullptr,
|
|
77
|
-
value.androidNotificationIcon.has_value() ? jni::make_jstring(value.androidNotificationIcon.value()) : nullptr
|
|
82
|
+
value.androidNotificationIcon.has_value() ? jni::make_jstring(value.androidNotificationIcon.value()) : nullptr,
|
|
83
|
+
value.androidAudioFocus.has_value() ? JAndroidAudioFocusMode::fromCpp(value.androidAudioFocus.value()) : nullptr
|
|
78
84
|
);
|
|
79
85
|
}
|
|
80
86
|
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JShufflePlaylistOptions.hpp
|
|
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
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <fbjni/fbjni.h>
|
|
11
|
+
#include "ShufflePlaylistOptions.hpp"
|
|
12
|
+
|
|
13
|
+
#include <optional>
|
|
14
|
+
|
|
15
|
+
namespace margelo::nitro::nitroplayer {
|
|
16
|
+
|
|
17
|
+
using namespace facebook;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* The C++ JNI bridge between the C++ struct "ShufflePlaylistOptions" and the the Kotlin data class "ShufflePlaylistOptions".
|
|
21
|
+
*/
|
|
22
|
+
struct JShufflePlaylistOptions final: public jni::JavaClass<JShufflePlaylistOptions> {
|
|
23
|
+
public:
|
|
24
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroplayer/ShufflePlaylistOptions;";
|
|
25
|
+
|
|
26
|
+
public:
|
|
27
|
+
/**
|
|
28
|
+
* Convert this Java/Kotlin-based struct to the C++ struct ShufflePlaylistOptions by copying all values to C++.
|
|
29
|
+
*/
|
|
30
|
+
[[maybe_unused]]
|
|
31
|
+
[[nodiscard]]
|
|
32
|
+
ShufflePlaylistOptions toCpp() const {
|
|
33
|
+
static const auto clazz = javaClassStatic();
|
|
34
|
+
static const auto fieldKeepCurrentTrackFirst = clazz->getField<jni::JBoolean>("keepCurrentTrackFirst");
|
|
35
|
+
jni::local_ref<jni::JBoolean> keepCurrentTrackFirst = this->getFieldValue(fieldKeepCurrentTrackFirst);
|
|
36
|
+
return ShufflePlaylistOptions(
|
|
37
|
+
keepCurrentTrackFirst != nullptr ? std::make_optional(static_cast<bool>(keepCurrentTrackFirst->value())) : std::nullopt
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
public:
|
|
42
|
+
/**
|
|
43
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
44
|
+
*/
|
|
45
|
+
[[maybe_unused]]
|
|
46
|
+
static jni::local_ref<JShufflePlaylistOptions::javaobject> fromCpp(const ShufflePlaylistOptions& value) {
|
|
47
|
+
using JSignature = JShufflePlaylistOptions(jni::alias_ref<jni::JBoolean>);
|
|
48
|
+
static const auto clazz = javaClassStatic();
|
|
49
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
50
|
+
return create(
|
|
51
|
+
clazz,
|
|
52
|
+
value.keepCurrentTrackFirst.has_value() ? jni::JBoolean::valueOf(value.keepCurrentTrackFirst.value()) : nullptr
|
|
53
|
+
);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
} // namespace margelo::nitro::nitroplayer
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/AndroidAudioFocusMode.kt
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// AndroidAudioFocusMode.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.nitroplayer
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Represents the JavaScript enum/union "AndroidAudioFocusMode".
|
|
15
|
+
*/
|
|
16
|
+
@DoNotStrip
|
|
17
|
+
@Keep
|
|
18
|
+
enum class AndroidAudioFocusMode(@DoNotStrip @Keep val value: Int) {
|
|
19
|
+
PAUSE(0),
|
|
20
|
+
DUCK(1),
|
|
21
|
+
IGNORE(2);
|
|
22
|
+
|
|
23
|
+
companion object
|
|
24
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void.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.nitroplayer
|
|
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 `() => 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: () -> 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(): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `() => 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_cxx: Func_void {
|
|
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(): Unit
|
|
60
|
+
= invoke_cxx()
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `() => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `() -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_java(private val function: () -> Unit): Func_void {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(): Unit {
|
|
78
|
+
return this.function()
|
|
79
|
+
}
|
|
80
|
+
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/Func_void_std__string.kt
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string.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.nitroplayer
|
|
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 `(action: string) => 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__string: (String) -> 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(action: String): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `(action: string) => 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__string_cxx: Func_void_std__string {
|
|
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(action: String): Unit
|
|
60
|
+
= invoke_cxx(action)
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(action: String): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `(action: string) => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `(String) -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_std__string_java(private val function: (String) -> Unit): Func_void_std__string {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(action: String): Unit {
|
|
78
|
+
return this.function(action)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// Func_void_std__string_std__string.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.nitroplayer
|
|
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 `(requestId: string, parentId: string) => 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__string_std__string: (String, String) -> 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(requestId: String, parentId: String): Unit
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Represents the JavaScript callback `(requestId: string, parentId: string) => 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__string_std__string_cxx: Func_void_std__string_std__string {
|
|
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(requestId: String, parentId: String): Unit
|
|
60
|
+
= invoke_cxx(requestId,parentId)
|
|
61
|
+
|
|
62
|
+
@FastNative
|
|
63
|
+
private external fun invoke_cxx(requestId: String, parentId: String): Unit
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* Represents the JavaScript callback `(requestId: string, parentId: string) => void`.
|
|
68
|
+
* This is implemented in Java/Kotlin, via a `(String, String) -> Unit`.
|
|
69
|
+
* The callback is always coming from native.
|
|
70
|
+
*/
|
|
71
|
+
@DoNotStrip
|
|
72
|
+
@Keep
|
|
73
|
+
@Suppress("ClassName", "RedundantUnitReturnType", "unused")
|
|
74
|
+
class Func_void_std__string_std__string_java(private val function: (String, String) -> Unit): Func_void_std__string_std__string {
|
|
75
|
+
@DoNotStrip
|
|
76
|
+
@Keep
|
|
77
|
+
override fun invoke(requestId: String, parentId: String): Unit {
|
|
78
|
+
return this.function(requestId, parentId)
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -36,6 +36,50 @@ abstract class HybridAndroidAutoMediaLibrarySpec: HybridObject() {
|
|
|
36
36
|
@DoNotStrip
|
|
37
37
|
@Keep
|
|
38
38
|
abstract fun clearMediaLibrary(): Promise<Unit>
|
|
39
|
+
|
|
40
|
+
abstract fun onLoadChildren(callback: (requestId: String, parentId: String) -> Unit): Unit
|
|
41
|
+
|
|
42
|
+
@DoNotStrip
|
|
43
|
+
@Keep
|
|
44
|
+
private fun onLoadChildren_cxx(callback: Func_void_std__string_std__string): Unit {
|
|
45
|
+
val __result = onLoadChildren(callback)
|
|
46
|
+
return __result
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
abstract fun onSearch(callback: (requestId: String, query: String) -> Unit): Unit
|
|
50
|
+
|
|
51
|
+
@DoNotStrip
|
|
52
|
+
@Keep
|
|
53
|
+
private fun onSearch_cxx(callback: Func_void_std__string_std__string): Unit {
|
|
54
|
+
val __result = onSearch(callback)
|
|
55
|
+
return __result
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
@DoNotStrip
|
|
59
|
+
@Keep
|
|
60
|
+
abstract fun resolveRequest(requestId: String, itemsJson: String): Unit
|
|
61
|
+
|
|
62
|
+
@DoNotStrip
|
|
63
|
+
@Keep
|
|
64
|
+
abstract fun setSessionButtons(buttonsJson: String): Unit
|
|
65
|
+
|
|
66
|
+
abstract fun onSessionButtonPress(callback: (action: String) -> Unit): Unit
|
|
67
|
+
|
|
68
|
+
@DoNotStrip
|
|
69
|
+
@Keep
|
|
70
|
+
private fun onSessionButtonPress_cxx(callback: Func_void_std__string): Unit {
|
|
71
|
+
val __result = onSessionButtonPress(callback)
|
|
72
|
+
return __result
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
abstract fun onPlaybackResumption(callback: () -> Unit): Unit
|
|
76
|
+
|
|
77
|
+
@DoNotStrip
|
|
78
|
+
@Keep
|
|
79
|
+
private fun onPlaybackResumption_cxx(callback: Func_void): Unit {
|
|
80
|
+
val __result = onPlaybackResumption(callback)
|
|
81
|
+
return __result
|
|
82
|
+
}
|
|
39
83
|
|
|
40
84
|
// Default implementation of `HybridObject.toString()`
|
|
41
85
|
override fun toString(): String {
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/HybridPlayerQueueSpec.kt
CHANGED
|
@@ -66,6 +66,14 @@ abstract class HybridPlayerQueueSpec: HybridObject() {
|
|
|
66
66
|
@Keep
|
|
67
67
|
abstract fun reorderTrackInPlaylist(playlistId: String, trackId: String, newIndex: Double): Promise<Unit>
|
|
68
68
|
|
|
69
|
+
@DoNotStrip
|
|
70
|
+
@Keep
|
|
71
|
+
abstract fun removeTracksFromPlaylist(playlistId: String, trackIds: Array<String>): Promise<Unit>
|
|
72
|
+
|
|
73
|
+
@DoNotStrip
|
|
74
|
+
@Keep
|
|
75
|
+
abstract fun shufflePlaylist(playlistId: String, options: ShufflePlaylistOptions?): Promise<Unit>
|
|
76
|
+
|
|
69
77
|
@DoNotStrip
|
|
70
78
|
@Keep
|
|
71
79
|
abstract fun loadPlaylist(playlistId: String, index: Double?): Promise<Unit>
|