react-native-nitro-player 1.7.0-alpha.4 → 1.7.0-alpha.6

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.
Files changed (57) hide show
  1. package/android/src/main/AndroidManifest.xml +8 -0
  2. package/android/src/main/java/com/margelo/nitro/nitroplayer/HybridAndroidAutoMediaLibrary.kt +51 -0
  3. package/android/src/main/java/com/margelo/nitro/nitroplayer/connection/AndroidAutoConnectionDetector.kt +2 -2
  4. package/android/src/main/java/com/margelo/nitro/nitroplayer/core/ExoPlayerCore.kt +17 -2
  5. package/android/src/main/java/com/margelo/nitro/nitroplayer/core/NitroPlayerLogger.kt +2 -2
  6. package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerAndroidAuto.kt +41 -31
  7. package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerCast.kt +1 -1
  8. package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerCore.kt +47 -2
  9. package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerListener.kt +10 -17
  10. package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerNotify.kt +5 -0
  11. package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerPlayback.kt +3 -1
  12. package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerQueueBuild.kt +16 -1
  13. package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerRecovery.kt +97 -0
  14. package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerSetup.kt +0 -5
  15. package/android/src/main/java/com/margelo/nitro/nitroplayer/core/TrackPlayerUrlLoader.kt +15 -2
  16. package/android/src/main/java/com/margelo/nitro/nitroplayer/download/DownloadDatabase.kt +3 -0
  17. package/android/src/main/java/com/margelo/nitro/nitroplayer/download/TrackItemJson.kt +6 -0
  18. package/android/src/main/java/com/margelo/nitro/nitroplayer/media/CastSessionController.kt +2 -0
  19. package/android/src/main/java/com/margelo/nitro/nitroplayer/media/MediaBrowserService.kt +96 -45
  20. package/android/src/main/java/com/margelo/nitro/nitroplayer/media/MediaLibrary.kt +2 -0
  21. package/android/src/main/java/com/margelo/nitro/nitroplayer/media/MediaLibraryManager.kt +147 -0
  22. package/android/src/main/java/com/margelo/nitro/nitroplayer/media/MediaLibraryParser.kt +3 -0
  23. package/android/src/main/java/com/margelo/nitro/nitroplayer/media/MediaSessionCallbackFactory.kt +102 -24
  24. package/android/src/main/java/com/margelo/nitro/nitroplayer/media/MediaSessionManager.kt +44 -2
  25. package/android/src/main/java/com/margelo/nitro/nitroplayer/media/PlaybackService.kt +57 -1
  26. package/android/src/main/java/com/margelo/nitro/nitroplayer/playlist/PlaylistManager.kt +15 -0
  27. package/ios/HybridTrackPlayer.swift +2 -1
  28. package/ios/core/TrackPlayerPlayback.swift +7 -3
  29. package/ios/media/MediaSessionManager.swift +8 -2
  30. package/lib/index.js +5 -1
  31. package/lib/specs/AndroidAutoMediaLibrary.nitro.d.ts +12 -0
  32. package/lib/types/AndroidAutoMediaLibrary.d.ts +11 -0
  33. package/lib/types/PlayerQueue.d.ts +4 -0
  34. package/lib/utils/androidAutoMediaLibrary.d.ts +13 -1
  35. package/lib/utils/androidAutoMediaLibrary.js +23 -0
  36. package/nitrogen/generated/android/NitroPlayerOnLoad.cpp +6 -0
  37. package/nitrogen/generated/android/c++/JFunc_void.hpp +75 -0
  38. package/nitrogen/generated/android/c++/JFunc_void_std__string.hpp +76 -0
  39. package/nitrogen/generated/android/c++/JFunc_void_std__string_std__string.hpp +76 -0
  40. package/nitrogen/generated/android/c++/JHybridAndroidAutoMediaLibrarySpec.cpp +29 -0
  41. package/nitrogen/generated/android/c++/JHybridAndroidAutoMediaLibrarySpec.hpp +6 -0
  42. package/nitrogen/generated/android/c++/JPlayerConfig.hpp +5 -1
  43. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/Func_void.kt +80 -0
  44. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/Func_void_std__string.kt +80 -0
  45. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/Func_void_std__string_std__string.kt +80 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/HybridAndroidAutoMediaLibrarySpec.kt +44 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitroplayer/PlayerConfig.kt +5 -2
  48. package/nitrogen/generated/ios/swift/PlayerConfig.swift +19 -1
  49. package/nitrogen/generated/shared/c++/HybridAndroidAutoMediaLibrarySpec.cpp +6 -0
  50. package/nitrogen/generated/shared/c++/HybridAndroidAutoMediaLibrarySpec.hpp +7 -0
  51. package/nitrogen/generated/shared/c++/PlayerConfig.hpp +5 -1
  52. package/package.json +1 -1
  53. package/src/index.ts +9 -1
  54. package/src/specs/AndroidAutoMediaLibrary.nitro.ts +18 -0
  55. package/src/types/AndroidAutoMediaLibrary.ts +24 -0
  56. package/src/types/PlayerQueue.ts +4 -0
  57. package/src/utils/androidAutoMediaLibrary.ts +48 -1
@@ -0,0 +1,75 @@
1
+ ///
2
+ /// JFunc_void.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 <functional>
14
+ #include <NitroModules/JNICallable.hpp>
15
+
16
+ namespace margelo::nitro::nitroplayer {
17
+
18
+ using namespace facebook;
19
+
20
+ /**
21
+ * Represents the Java/Kotlin callback `() -> Unit`.
22
+ * This can be passed around between C++ and Java/Kotlin.
23
+ */
24
+ struct JFunc_void: public jni::JavaClass<JFunc_void> {
25
+ public:
26
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroplayer/Func_void;";
27
+
28
+ public:
29
+ /**
30
+ * Invokes the function this `JFunc_void` instance holds through JNI.
31
+ */
32
+ void invoke() const {
33
+ static const auto method = javaClassStatic()->getMethod<void()>("invoke");
34
+ method(self());
35
+ }
36
+ };
37
+
38
+ /**
39
+ * An implementation of Func_void that is backed by a C++ implementation (using `std::function<...>`)
40
+ */
41
+ class JFunc_void_cxx final: public jni::HybridClass<JFunc_void_cxx, JFunc_void> {
42
+ public:
43
+ static jni::local_ref<JFunc_void::javaobject> fromCpp(const std::function<void()>& func) {
44
+ return JFunc_void_cxx::newObjectCxxArgs(func);
45
+ }
46
+
47
+ public:
48
+ /**
49
+ * Invokes the C++ `std::function<...>` this `JFunc_void_cxx` instance holds.
50
+ */
51
+ void invoke_cxx() {
52
+ _func();
53
+ }
54
+
55
+ public:
56
+ [[nodiscard]]
57
+ inline const std::function<void()>& getFunction() const {
58
+ return _func;
59
+ }
60
+
61
+ public:
62
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroplayer/Func_void_cxx;";
63
+ static void registerNatives() {
64
+ registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_cxx::invoke_cxx)});
65
+ }
66
+
67
+ private:
68
+ explicit JFunc_void_cxx(const std::function<void()>& func): _func(func) { }
69
+
70
+ private:
71
+ friend HybridBase;
72
+ std::function<void()> _func;
73
+ };
74
+
75
+ } // namespace margelo::nitro::nitroplayer
@@ -0,0 +1,76 @@
1
+ ///
2
+ /// JFunc_void_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 `(action: String) -> Unit`.
23
+ * This can be passed around between C++ and Java/Kotlin.
24
+ */
25
+ struct JFunc_void_std__string: public jni::JavaClass<JFunc_void_std__string> {
26
+ public:
27
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroplayer/Func_void_std__string;";
28
+
29
+ public:
30
+ /**
31
+ * Invokes the function this `JFunc_void_std__string` instance holds through JNI.
32
+ */
33
+ void invoke(const std::string& action) const {
34
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* action */)>("invoke");
35
+ method(self(), jni::make_jstring(action));
36
+ }
37
+ };
38
+
39
+ /**
40
+ * An implementation of Func_void_std__string that is backed by a C++ implementation (using `std::function<...>`)
41
+ */
42
+ class JFunc_void_std__string_cxx final: public jni::HybridClass<JFunc_void_std__string_cxx, JFunc_void_std__string> {
43
+ public:
44
+ static jni::local_ref<JFunc_void_std__string::javaobject> fromCpp(const std::function<void(const std::string& /* action */)>& func) {
45
+ return JFunc_void_std__string_cxx::newObjectCxxArgs(func);
46
+ }
47
+
48
+ public:
49
+ /**
50
+ * Invokes the C++ `std::function<...>` this `JFunc_void_std__string_cxx` instance holds.
51
+ */
52
+ void invoke_cxx(jni::alias_ref<jni::JString> action) {
53
+ _func(action->toStdString());
54
+ }
55
+
56
+ public:
57
+ [[nodiscard]]
58
+ inline const std::function<void(const std::string& /* action */)>& getFunction() const {
59
+ return _func;
60
+ }
61
+
62
+ public:
63
+ static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/nitroplayer/Func_void_std__string_cxx;";
64
+ static void registerNatives() {
65
+ registerHybrid({makeNativeMethod("invoke_cxx", JFunc_void_std__string_cxx::invoke_cxx)});
66
+ }
67
+
68
+ private:
69
+ explicit JFunc_void_std__string_cxx(const std::function<void(const std::string& /* action */)>& func): _func(func) { }
70
+
71
+ private:
72
+ friend HybridBase;
73
+ std::function<void(const std::string& /* action */)> _func;
74
+ };
75
+
76
+ } // namespace margelo::nitro::nitroplayer
@@ -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;
@@ -44,6 +44,8 @@ namespace margelo::nitro::nitroplayer {
44
44
  jni::local_ref<jni::JDouble> remoteSkipForwardInterval = this->getFieldValue(fieldRemoteSkipForwardInterval);
45
45
  static const auto fieldRemoteSkipBackwardInterval = clazz->getField<jni::JDouble>("remoteSkipBackwardInterval");
46
46
  jni::local_ref<jni::JDouble> remoteSkipBackwardInterval = this->getFieldValue(fieldRemoteSkipBackwardInterval);
47
+ static const auto fieldPreferRemoteSkipIntervals = clazz->getField<jni::JBoolean>("preferRemoteSkipIntervals");
48
+ jni::local_ref<jni::JBoolean> preferRemoteSkipIntervals = this->getFieldValue(fieldPreferRemoteSkipIntervals);
47
49
  static const auto fieldLookaheadCount = clazz->getField<jni::JDouble>("lookaheadCount");
48
50
  jni::local_ref<jni::JDouble> lookaheadCount = this->getFieldValue(fieldLookaheadCount);
49
51
  static const auto fieldAndroidNotificationIcon = clazz->getField<jni::JString>("androidNotificationIcon");
@@ -56,6 +58,7 @@ namespace margelo::nitro::nitroplayer {
56
58
  showInNotification != nullptr ? std::make_optional(static_cast<bool>(showInNotification->value())) : std::nullopt,
57
59
  remoteSkipForwardInterval != nullptr ? std::make_optional(remoteSkipForwardInterval->value()) : std::nullopt,
58
60
  remoteSkipBackwardInterval != nullptr ? std::make_optional(remoteSkipBackwardInterval->value()) : std::nullopt,
61
+ preferRemoteSkipIntervals != nullptr ? std::make_optional(static_cast<bool>(preferRemoteSkipIntervals->value())) : std::nullopt,
59
62
  lookaheadCount != nullptr ? std::make_optional(lookaheadCount->value()) : std::nullopt,
60
63
  androidNotificationIcon != nullptr ? std::make_optional(androidNotificationIcon->toStdString()) : std::nullopt,
61
64
  androidAudioFocus != nullptr ? std::make_optional(androidAudioFocus->toCpp()) : std::nullopt
@@ -68,7 +71,7 @@ namespace margelo::nitro::nitroplayer {
68
71
  */
69
72
  [[maybe_unused]]
70
73
  static jni::local_ref<JPlayerConfig::javaobject> fromCpp(const PlayerConfig& value) {
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>);
74
+ 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::JBoolean>, jni::alias_ref<jni::JDouble>, jni::alias_ref<jni::JString>, jni::alias_ref<JAndroidAudioFocusMode>);
72
75
  static const auto clazz = javaClassStatic();
73
76
  static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
74
77
  return create(
@@ -78,6 +81,7 @@ namespace margelo::nitro::nitroplayer {
78
81
  value.showInNotification.has_value() ? jni::JBoolean::valueOf(value.showInNotification.value()) : nullptr,
79
82
  value.remoteSkipForwardInterval.has_value() ? jni::JDouble::valueOf(value.remoteSkipForwardInterval.value()) : nullptr,
80
83
  value.remoteSkipBackwardInterval.has_value() ? jni::JDouble::valueOf(value.remoteSkipBackwardInterval.value()) : nullptr,
84
+ value.preferRemoteSkipIntervals.has_value() ? jni::JBoolean::valueOf(value.preferRemoteSkipIntervals.value()) : nullptr,
81
85
  value.lookaheadCount.has_value() ? jni::JDouble::valueOf(value.lookaheadCount.value()) : nullptr,
82
86
  value.androidNotificationIcon.has_value() ? jni::make_jstring(value.androidNotificationIcon.value()) : nullptr,
83
87
  value.androidAudioFocus.has_value() ? JAndroidAudioFocusMode::fromCpp(value.androidAudioFocus.value()) : nullptr
@@ -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
+ }
@@ -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 {
@@ -34,6 +34,9 @@ data class PlayerConfig(
34
34
  val remoteSkipBackwardInterval: Double?,
35
35
  @DoNotStrip
36
36
  @Keep
37
+ val preferRemoteSkipIntervals: Boolean?,
38
+ @DoNotStrip
39
+ @Keep
37
40
  val lookaheadCount: Double?,
38
41
  @DoNotStrip
39
42
  @Keep
@@ -52,8 +55,8 @@ data class PlayerConfig(
52
55
  @Keep
53
56
  @Suppress("unused")
54
57
  @JvmStatic
55
- private fun fromCpp(androidAutoEnabled: Boolean?, carPlayEnabled: Boolean?, showInNotification: Boolean?, remoteSkipForwardInterval: Double?, remoteSkipBackwardInterval: Double?, lookaheadCount: Double?, androidNotificationIcon: String?, androidAudioFocus: AndroidAudioFocusMode?): PlayerConfig {
56
- return PlayerConfig(androidAutoEnabled, carPlayEnabled, showInNotification, remoteSkipForwardInterval, remoteSkipBackwardInterval, lookaheadCount, androidNotificationIcon, androidAudioFocus)
58
+ private fun fromCpp(androidAutoEnabled: Boolean?, carPlayEnabled: Boolean?, showInNotification: Boolean?, remoteSkipForwardInterval: Double?, remoteSkipBackwardInterval: Double?, preferRemoteSkipIntervals: Boolean?, lookaheadCount: Double?, androidNotificationIcon: String?, androidAudioFocus: AndroidAudioFocusMode?): PlayerConfig {
59
+ return PlayerConfig(androidAutoEnabled, carPlayEnabled, showInNotification, remoteSkipForwardInterval, remoteSkipBackwardInterval, preferRemoteSkipIntervals, lookaheadCount, androidNotificationIcon, androidAudioFocus)
57
60
  }
58
61
  }
59
62
  }
@@ -18,7 +18,7 @@ public extension PlayerConfig {
18
18
  /**
19
19
  * Create a new instance of `PlayerConfig`.
20
20
  */
21
- init(androidAutoEnabled: Bool?, carPlayEnabled: Bool?, showInNotification: Bool?, remoteSkipForwardInterval: Double?, remoteSkipBackwardInterval: Double?, lookaheadCount: Double?, androidNotificationIcon: String?, androidAudioFocus: AndroidAudioFocusMode?) {
21
+ init(androidAutoEnabled: Bool?, carPlayEnabled: Bool?, showInNotification: Bool?, remoteSkipForwardInterval: Double?, remoteSkipBackwardInterval: Double?, preferRemoteSkipIntervals: Bool?, lookaheadCount: Double?, androidNotificationIcon: String?, androidAudioFocus: AndroidAudioFocusMode?) {
22
22
  self.init({ () -> bridge.std__optional_bool_ in
23
23
  if let __unwrappedValue = androidAutoEnabled {
24
24
  return bridge.create_std__optional_bool_(__unwrappedValue)
@@ -49,6 +49,12 @@ public extension PlayerConfig {
49
49
  } else {
50
50
  return .init()
51
51
  }
52
+ }(), { () -> bridge.std__optional_bool_ in
53
+ if let __unwrappedValue = preferRemoteSkipIntervals {
54
+ return bridge.create_std__optional_bool_(__unwrappedValue)
55
+ } else {
56
+ return .init()
57
+ }
52
58
  }(), { () -> bridge.std__optional_double_ in
53
59
  if let __unwrappedValue = lookaheadCount {
54
60
  return bridge.create_std__optional_double_(__unwrappedValue)
@@ -130,6 +136,18 @@ public extension PlayerConfig {
130
136
  }()
131
137
  }
132
138
 
139
+ @inline(__always)
140
+ var preferRemoteSkipIntervals: Bool? {
141
+ return { () -> Bool? in
142
+ if bridge.has_value_std__optional_bool_(self.__preferRemoteSkipIntervals) {
143
+ let __unwrapped = bridge.get_std__optional_bool_(self.__preferRemoteSkipIntervals)
144
+ return __unwrapped
145
+ } else {
146
+ return nil
147
+ }
148
+ }()
149
+ }
150
+
133
151
  @inline(__always)
134
152
  var lookaheadCount: Double? {
135
153
  return { () -> Double? in