react-native-audio-browser 0.2.0-next.50 → 0.2.0-next.52
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/build.gradle +15 -0
- package/android/src/cast/java/com/audiobrowser/cast/CastSupport.kt +215 -0
- package/android/src/main/AndroidManifest.xml +11 -0
- package/android/src/main/java/com/audiobrowser/AudioBrowser.kt +0 -4
- package/android/src/main/java/com/audiobrowser/RemoteOutputs.kt +47 -10
- package/android/src/main/java/com/audiobrowser/model/PlayerSetupOptions.kt +12 -3
- package/android/src/main/java/com/audiobrowser/player/EqualizerController.kt +4 -1
- package/android/src/main/java/com/audiobrowser/player/LocalEngine.kt +49 -0
- package/android/src/main/java/com/audiobrowser/player/Player.kt +170 -119
- package/android/src/main/java/com/audiobrowser/player/PlayerListener.kt +18 -13
- package/android/src/main/java/com/audiobrowser/player/TransformingDataSource.kt +10 -13
- package/android/src/main/java/com/audiobrowser/remote/RemoteItem.kt +64 -0
- package/android/src/main/java/com/audiobrowser/remote/RemoteOutputsController.kt +98 -0
- package/android/src/main/java/com/audiobrowser/remote/RemotePlayback.kt +42 -0
- package/android/src/main/java/com/audiobrowser/remote/RemoteQueue.kt +110 -0
- package/android/src/main/java/com/audiobrowser/remote/RemoteSwitchingPlayer.kt +696 -0
- package/android/src/main/java/com/audiobrowser/sonos/DeviceDescriptionParser.kt +113 -0
- package/android/src/main/java/com/audiobrowser/sonos/DidlLite.kt +39 -0
- package/android/src/main/java/com/audiobrowser/sonos/SoapClient.kt +59 -0
- package/android/src/main/java/com/audiobrowser/sonos/SoapEnvelopes.kt +92 -0
- package/android/src/main/java/com/audiobrowser/sonos/SoapResponseParser.kt +105 -0
- package/android/src/main/java/com/audiobrowser/sonos/SonosDiscoverer.kt +69 -0
- package/android/src/main/java/com/audiobrowser/sonos/SonosOutputs.kt +128 -0
- package/android/src/main/java/com/audiobrowser/sonos/SonosPlayer.kt +550 -0
- package/android/src/main/java/com/audiobrowser/sonos/SonosRemote.kt +99 -0
- package/android/src/main/java/com/audiobrowser/sonos/SonosRouteProviderService.kt +201 -0
- package/android/src/main/java/com/audiobrowser/sonos/SonosStreamUri.kt +15 -0
- package/android/src/main/java/com/audiobrowser/sonos/SonosTransport.kt +66 -0
- package/android/src/main/java/com/audiobrowser/sonos/SpeakerXml.kt +26 -0
- package/android/src/main/java/com/audiobrowser/sonos/SsdpDiscovery.kt +63 -0
- package/android/src/main/java/com/audiobrowser/sonos/SsdpMessages.kt +63 -0
- package/android/src/main/java/com/audiobrowser/sonos/ZoneGroupState.kt +68 -0
- package/android/src/main/java/com/audiobrowser/util/OutputMonitor.kt +2 -1
- package/android/src/main/java/com/audiobrowser/util/TrackFactory.kt +1 -1
- package/android/src/nocast/java/com/audiobrowser/cast/CastSupport.kt +18 -0
- package/android/src/test/java/com/audiobrowser/RemoteOutputsTest.kt +20 -3
- package/android/src/test/java/com/audiobrowser/model/PlayerSetupOptionsTest.kt +35 -0
- package/android/src/test/java/com/audiobrowser/player/EqualizerControllerTest.kt +12 -0
- package/android/src/test/java/com/audiobrowser/player/PlayerCastTest.kt +136 -0
- package/android/src/test/java/com/audiobrowser/player/PlayerSonosTest.kt +213 -0
- package/android/src/test/java/com/audiobrowser/remote/FakeRemote.kt +275 -0
- package/android/src/test/java/com/audiobrowser/remote/RemoteItemTest.kt +61 -0
- package/android/src/test/java/com/audiobrowser/remote/RemoteOutputsControllerTest.kt +77 -0
- package/android/src/test/java/com/audiobrowser/remote/RemoteQueueTest.kt +101 -0
- package/android/src/test/java/com/audiobrowser/remote/RemoteSwitchingPlayerTest.kt +815 -0
- package/android/src/test/java/com/audiobrowser/sonos/DeviceDescriptionParserTest.kt +203 -0
- package/android/src/test/java/com/audiobrowser/sonos/DidlLiteTest.kt +90 -0
- package/android/src/test/java/com/audiobrowser/sonos/SoapClientTest.kt +73 -0
- package/android/src/test/java/com/audiobrowser/sonos/SoapEnvelopesTest.kt +135 -0
- package/android/src/test/java/com/audiobrowser/sonos/SoapResponseParserTest.kt +170 -0
- package/android/src/test/java/com/audiobrowser/sonos/SonosDiscovererTest.kt +174 -0
- package/android/src/test/java/com/audiobrowser/sonos/SonosPlayerTest.kt +691 -0
- package/android/src/test/java/com/audiobrowser/sonos/SonosRemoteTest.kt +129 -0
- package/android/src/test/java/com/audiobrowser/sonos/SonosRoutesTest.kt +165 -0
- package/android/src/test/java/com/audiobrowser/sonos/SonosStreamUriTest.kt +64 -0
- package/android/src/test/java/com/audiobrowser/sonos/SonosTransportTest.kt +204 -0
- package/android/src/test/java/com/audiobrowser/sonos/SsdpMessagesTest.kt +99 -0
- package/android/src/test/java/com/audiobrowser/sonos/ZoneGroupStateTest.kt +139 -0
- package/android/src/test/java/com/audiobrowser/util/OutputMonitorTest.kt +12 -10
- package/android/src/test/resources/sonos/device_description.xml +78 -0
- package/android/src/testCast/java/com/audiobrowser/cast/CastEndsTest.kt +56 -0
- package/android/src/testCast/java/com/audiobrowser/cast/SendingMediaItemConverterTest.kt +79 -0
- package/lib/commonjs/features/player/setup.js +2 -0
- package/lib/commonjs/features/player/setup.js.map +1 -1
- package/lib/module/features/player/setup.js +2 -0
- package/lib/module/features/player/setup.js.map +1 -1
- package/lib/typescript/src/features/player/setup.d.ts +37 -7
- package/lib/typescript/src/features/player/setup.d.ts.map +1 -1
- package/lib/typescript/src/specs/audio-browser.nitro.d.ts +3 -3
- package/lib/typescript/src/specs/audio-browser.nitro.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JHybridAudioBrowserSpec.cpp +4 -0
- package/nitrogen/generated/android/c++/JNativeSetupPlayerOptions.hpp +7 -5
- package/nitrogen/generated/android/c++/JOutputType.hpp +3 -0
- package/nitrogen/generated/android/c++/JRemoteOutputsOptions.hpp +66 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/audiobrowser/NativeSetupPlayerOptions.kt +3 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/audiobrowser/OutputType.kt +3 -2
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/audiobrowser/RemoteOutputsOptions.kt +61 -0
- package/nitrogen/generated/ios/AudioBrowser-Swift-Cxx-Bridge.hpp +18 -0
- package/nitrogen/generated/ios/AudioBrowser-Swift-Cxx-Umbrella.hpp +3 -0
- package/nitrogen/generated/ios/c++/HybridAudioBrowserSpecSwift.hpp +3 -0
- package/nitrogen/generated/ios/swift/NativeSetupPlayerOptions.swift +5 -12
- package/nitrogen/generated/ios/swift/OutputType.swift +4 -0
- package/nitrogen/generated/ios/swift/RemoteOutputsOptions.swift +78 -0
- package/nitrogen/generated/shared/c++/NativeSetupPlayerOptions.hpp +8 -5
- package/nitrogen/generated/shared/c++/OutputType.hpp +6 -2
- package/nitrogen/generated/shared/c++/RemoteOutputsOptions.hpp +92 -0
- package/package.json +3 -2
- package/src/features/player/setup.ts +38 -7
- package/src/specs/audio-browser.nitro.ts +4 -3
- package/website/guide/audio-output.md +185 -4
- package/website/guide/configuration.md +6 -0
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JRemoteOutputsOptions.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 "RemoteOutputsOptions.hpp"
|
|
12
|
+
|
|
13
|
+
#include <optional>
|
|
14
|
+
#include <string>
|
|
15
|
+
|
|
16
|
+
namespace margelo::nitro::audiobrowser {
|
|
17
|
+
|
|
18
|
+
using namespace facebook;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The C++ JNI bridge between the C++ struct "RemoteOutputsOptions" and the Kotlin data class "RemoteOutputsOptions".
|
|
22
|
+
*/
|
|
23
|
+
struct JRemoteOutputsOptions final: public jni::JavaClass<JRemoteOutputsOptions> {
|
|
24
|
+
public:
|
|
25
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/audiobrowser/RemoteOutputsOptions;";
|
|
26
|
+
|
|
27
|
+
public:
|
|
28
|
+
/**
|
|
29
|
+
* Convert this Java/Kotlin-based struct to the C++ struct RemoteOutputsOptions by copying all values to C++.
|
|
30
|
+
*/
|
|
31
|
+
[[maybe_unused]]
|
|
32
|
+
[[nodiscard]]
|
|
33
|
+
RemoteOutputsOptions toCpp() const {
|
|
34
|
+
static const auto clazz = javaClassStatic();
|
|
35
|
+
static const auto fieldCast = clazz->getField<jni::JBoolean>("cast");
|
|
36
|
+
jni::local_ref<jni::JBoolean> cast = this->getFieldValue(fieldCast);
|
|
37
|
+
static const auto fieldCastReceiverApplicationId = clazz->getField<jni::JString>("castReceiverApplicationId");
|
|
38
|
+
jni::local_ref<jni::JString> castReceiverApplicationId = this->getFieldValue(fieldCastReceiverApplicationId);
|
|
39
|
+
static const auto fieldSonos = clazz->getField<jni::JBoolean>("sonos");
|
|
40
|
+
jni::local_ref<jni::JBoolean> sonos = this->getFieldValue(fieldSonos);
|
|
41
|
+
return RemoteOutputsOptions(
|
|
42
|
+
cast != nullptr ? std::make_optional(static_cast<bool>(cast->value())) : std::nullopt,
|
|
43
|
+
castReceiverApplicationId != nullptr ? std::make_optional(castReceiverApplicationId->toStdString()) : std::nullopt,
|
|
44
|
+
sonos != nullptr ? std::make_optional(static_cast<bool>(sonos->value())) : std::nullopt
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
public:
|
|
49
|
+
/**
|
|
50
|
+
* Create a Java/Kotlin-based struct by copying all values from the given C++ struct to Java.
|
|
51
|
+
*/
|
|
52
|
+
[[maybe_unused]]
|
|
53
|
+
static jni::local_ref<JRemoteOutputsOptions::javaobject> fromCpp(const RemoteOutputsOptions& value) {
|
|
54
|
+
using JSignature = JRemoteOutputsOptions(jni::alias_ref<jni::JBoolean>, jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>);
|
|
55
|
+
static const auto clazz = javaClassStatic();
|
|
56
|
+
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
57
|
+
return create(
|
|
58
|
+
clazz,
|
|
59
|
+
value.cast.has_value() ? jni::JBoolean::valueOf(value.cast.value()) : nullptr,
|
|
60
|
+
value.castReceiverApplicationId.has_value() ? jni::make_jstring(value.castReceiverApplicationId.value()) : nullptr,
|
|
61
|
+
value.sonos.has_value() ? jni::JBoolean::valueOf(value.sonos.value()) : nullptr
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
} // namespace margelo::nitro::audiobrowser
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/audiobrowser/NativeSetupPlayerOptions.kt
CHANGED
|
@@ -47,12 +47,12 @@ data class NativeSetupPlayerOptions(
|
|
|
47
47
|
val keepSessionAliveOnError: Boolean?,
|
|
48
48
|
@DoNotStrip
|
|
49
49
|
@Keep
|
|
50
|
-
val remoteOutputs:
|
|
50
|
+
val remoteOutputs: RemoteOutputsOptions?
|
|
51
51
|
) {
|
|
52
52
|
/**
|
|
53
53
|
* Create a new instance of NativeSetupPlayerOptions from Kotlin
|
|
54
54
|
*/
|
|
55
|
-
constructor(android: NativeAndroidSetupOptions?, ios: NativeIOSSetupOptions?, options: NativeUpdateOptions?, autoUpdateNowPlayingMetadata: Boolean?, nowPlayingMetadataFormatter: ((params: FormatNowPlayingParams) -> Promise<NowPlayingUpdate?>)?, playWhenReady: Boolean?, repeatMode: RepeatMode?, retry: Variant_Boolean_RetryConfig?, keepSessionAliveOnError: Boolean?, remoteOutputs:
|
|
55
|
+
constructor(android: NativeAndroidSetupOptions?, ios: NativeIOSSetupOptions?, options: NativeUpdateOptions?, autoUpdateNowPlayingMetadata: Boolean?, nowPlayingMetadataFormatter: ((params: FormatNowPlayingParams) -> Promise<NowPlayingUpdate?>)?, playWhenReady: Boolean?, repeatMode: RepeatMode?, retry: Variant_Boolean_RetryConfig?, keepSessionAliveOnError: Boolean?, remoteOutputs: RemoteOutputsOptions?):
|
|
56
56
|
this(android, ios, options, autoUpdateNowPlayingMetadata, nowPlayingMetadataFormatter?.let { Func_std__shared_ptr_Promise_std__optional_NowPlayingUpdate____FormatNowPlayingParams_java(it) }, playWhenReady, repeatMode, retry, keepSessionAliveOnError, remoteOutputs)
|
|
57
57
|
|
|
58
58
|
override fun equals(other: Any?): Boolean {
|
|
@@ -93,7 +93,7 @@ data class NativeSetupPlayerOptions(
|
|
|
93
93
|
@Keep
|
|
94
94
|
@Suppress("unused")
|
|
95
95
|
@JvmStatic
|
|
96
|
-
private fun fromCpp(android: NativeAndroidSetupOptions?, ios: NativeIOSSetupOptions?, options: NativeUpdateOptions?, autoUpdateNowPlayingMetadata: Boolean?, nowPlayingMetadataFormatter: Func_std__shared_ptr_Promise_std__optional_NowPlayingUpdate____FormatNowPlayingParams?, playWhenReady: Boolean?, repeatMode: RepeatMode?, retry: Variant_Boolean_RetryConfig?, keepSessionAliveOnError: Boolean?, remoteOutputs:
|
|
96
|
+
private fun fromCpp(android: NativeAndroidSetupOptions?, ios: NativeIOSSetupOptions?, options: NativeUpdateOptions?, autoUpdateNowPlayingMetadata: Boolean?, nowPlayingMetadataFormatter: Func_std__shared_ptr_Promise_std__optional_NowPlayingUpdate____FormatNowPlayingParams?, playWhenReady: Boolean?, repeatMode: RepeatMode?, retry: Variant_Boolean_RetryConfig?, keepSessionAliveOnError: Boolean?, remoteOutputs: RemoteOutputsOptions?): NativeSetupPlayerOptions {
|
|
97
97
|
return NativeSetupPlayerOptions(android, ios, options, autoUpdateNowPlayingMetadata, nowPlayingMetadataFormatter, playWhenReady, repeatMode, retry, keepSessionAliveOnError, remoteOutputs)
|
|
98
98
|
}
|
|
99
99
|
}
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/audiobrowser/RemoteOutputsOptions.kt
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RemoteOutputsOptions.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.audiobrowser
|
|
9
|
+
|
|
10
|
+
import androidx.annotation.Keep
|
|
11
|
+
import com.facebook.proguard.annotations.DoNotStrip
|
|
12
|
+
import java.util.Objects
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Represents the JavaScript object/struct "RemoteOutputsOptions".
|
|
17
|
+
*/
|
|
18
|
+
@DoNotStrip
|
|
19
|
+
@Keep
|
|
20
|
+
data class RemoteOutputsOptions(
|
|
21
|
+
@DoNotStrip
|
|
22
|
+
@Keep
|
|
23
|
+
val cast: Boolean?,
|
|
24
|
+
@DoNotStrip
|
|
25
|
+
@Keep
|
|
26
|
+
val castReceiverApplicationId: String?,
|
|
27
|
+
@DoNotStrip
|
|
28
|
+
@Keep
|
|
29
|
+
val sonos: Boolean?
|
|
30
|
+
) {
|
|
31
|
+
/* primary constructor */
|
|
32
|
+
|
|
33
|
+
override fun equals(other: Any?): Boolean {
|
|
34
|
+
if (this === other) return true
|
|
35
|
+
if (other !is RemoteOutputsOptions) return false
|
|
36
|
+
return Objects.deepEquals(this.cast, other.cast)
|
|
37
|
+
&& Objects.deepEquals(this.castReceiverApplicationId, other.castReceiverApplicationId)
|
|
38
|
+
&& Objects.deepEquals(this.sonos, other.sonos)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override fun hashCode(): Int {
|
|
42
|
+
return arrayOf<Any?>(
|
|
43
|
+
cast,
|
|
44
|
+
castReceiverApplicationId,
|
|
45
|
+
sonos
|
|
46
|
+
).contentDeepHashCode()
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
companion object {
|
|
50
|
+
/**
|
|
51
|
+
* Constructor called from C++
|
|
52
|
+
*/
|
|
53
|
+
@DoNotStrip
|
|
54
|
+
@Keep
|
|
55
|
+
@Suppress("unused")
|
|
56
|
+
@JvmStatic
|
|
57
|
+
private fun fromCpp(cast: Boolean?, castReceiverApplicationId: String?, sonos: Boolean?): RemoteOutputsOptions {
|
|
58
|
+
return RemoteOutputsOptions(cast, castReceiverApplicationId, sonos)
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -156,6 +156,8 @@ namespace margelo::nitro::audiobrowser { enum class RemoteButton; }
|
|
|
156
156
|
namespace margelo::nitro::audiobrowser { struct RemoteJumpBackwardEvent; }
|
|
157
157
|
// Forward declaration of `RemoteJumpForwardEvent` to properly resolve imports.
|
|
158
158
|
namespace margelo::nitro::audiobrowser { struct RemoteJumpForwardEvent; }
|
|
159
|
+
// Forward declaration of `RemoteOutputsOptions` to properly resolve imports.
|
|
160
|
+
namespace margelo::nitro::audiobrowser { struct RemoteOutputsOptions; }
|
|
159
161
|
// Forward declaration of `RemotePlayIdEvent` to properly resolve imports.
|
|
160
162
|
namespace margelo::nitro::audiobrowser { struct RemotePlayIdEvent; }
|
|
161
163
|
// Forward declaration of `RemotePlaySearchEvent` to properly resolve imports.
|
|
@@ -284,6 +286,7 @@ namespace AudioBrowser { class HybridAudioBrowserSpec_cxx; }
|
|
|
284
286
|
#include "RemoteButtonLayout.hpp"
|
|
285
287
|
#include "RemoteJumpBackwardEvent.hpp"
|
|
286
288
|
#include "RemoteJumpForwardEvent.hpp"
|
|
289
|
+
#include "RemoteOutputsOptions.hpp"
|
|
287
290
|
#include "RemotePlayIdEvent.hpp"
|
|
288
291
|
#include "RemotePlaySearchEvent.hpp"
|
|
289
292
|
#include "RemoteSeekEvent.hpp"
|
|
@@ -2698,6 +2701,21 @@ namespace margelo::nitro::audiobrowser::bridge::swift {
|
|
|
2698
2701
|
return optional.value();
|
|
2699
2702
|
}
|
|
2700
2703
|
|
|
2704
|
+
// pragma MARK: std::optional<RemoteOutputsOptions>
|
|
2705
|
+
/**
|
|
2706
|
+
* Specialized version of `std::optional<RemoteOutputsOptions>`.
|
|
2707
|
+
*/
|
|
2708
|
+
using std__optional_RemoteOutputsOptions_ = std::optional<RemoteOutputsOptions>;
|
|
2709
|
+
inline std::optional<RemoteOutputsOptions> create_std__optional_RemoteOutputsOptions_(const RemoteOutputsOptions& value) noexcept {
|
|
2710
|
+
return std::optional<RemoteOutputsOptions>(value);
|
|
2711
|
+
}
|
|
2712
|
+
inline bool has_value_std__optional_RemoteOutputsOptions_(const std::optional<RemoteOutputsOptions>& optional) noexcept {
|
|
2713
|
+
return optional.has_value();
|
|
2714
|
+
}
|
|
2715
|
+
inline RemoteOutputsOptions get_std__optional_RemoteOutputsOptions_(const std::optional<RemoteOutputsOptions>& optional) noexcept {
|
|
2716
|
+
return optional.value();
|
|
2717
|
+
}
|
|
2718
|
+
|
|
2701
2719
|
// pragma MARK: std::optional<AndroidOptions>
|
|
2702
2720
|
/**
|
|
2703
2721
|
* Specialized version of `std::optional<AndroidOptions>`.
|
|
@@ -160,6 +160,8 @@ namespace margelo::nitro::audiobrowser { enum class RemoteButton; }
|
|
|
160
160
|
namespace margelo::nitro::audiobrowser { struct RemoteJumpBackwardEvent; }
|
|
161
161
|
// Forward declaration of `RemoteJumpForwardEvent` to properly resolve imports.
|
|
162
162
|
namespace margelo::nitro::audiobrowser { struct RemoteJumpForwardEvent; }
|
|
163
|
+
// Forward declaration of `RemoteOutputsOptions` to properly resolve imports.
|
|
164
|
+
namespace margelo::nitro::audiobrowser { struct RemoteOutputsOptions; }
|
|
163
165
|
// Forward declaration of `RemotePlayIdEvent` to properly resolve imports.
|
|
164
166
|
namespace margelo::nitro::audiobrowser { struct RemotePlayIdEvent; }
|
|
165
167
|
// Forward declaration of `RemotePlaySearchEvent` to properly resolve imports.
|
|
@@ -286,6 +288,7 @@ namespace margelo::nitro::audiobrowser { struct TransformableRequestConfig; }
|
|
|
286
288
|
#include "RemoteButtonLayout.hpp"
|
|
287
289
|
#include "RemoteJumpBackwardEvent.hpp"
|
|
288
290
|
#include "RemoteJumpForwardEvent.hpp"
|
|
291
|
+
#include "RemoteOutputsOptions.hpp"
|
|
289
292
|
#include "RemotePlayIdEvent.hpp"
|
|
290
293
|
#include "RemotePlaySearchEvent.hpp"
|
|
291
294
|
#include "RemoteSeekEvent.hpp"
|
|
@@ -208,6 +208,8 @@ namespace margelo::nitro::audiobrowser { struct FormatNowPlayingParams; }
|
|
|
208
208
|
namespace margelo::nitro::audiobrowser { enum class StallReason; }
|
|
209
209
|
// Forward declaration of `RetryConfig` to properly resolve imports.
|
|
210
210
|
namespace margelo::nitro::audiobrowser { struct RetryConfig; }
|
|
211
|
+
// Forward declaration of `RemoteOutputsOptions` to properly resolve imports.
|
|
212
|
+
namespace margelo::nitro::audiobrowser { struct RemoteOutputsOptions; }
|
|
211
213
|
// Forward declaration of `Progress` to properly resolve imports.
|
|
212
214
|
namespace margelo::nitro::audiobrowser { struct Progress; }
|
|
213
215
|
|
|
@@ -317,6 +319,7 @@ namespace margelo::nitro::audiobrowser { struct Progress; }
|
|
|
317
319
|
#include "FormatNowPlayingParams.hpp"
|
|
318
320
|
#include "StallReason.hpp"
|
|
319
321
|
#include "RetryConfig.hpp"
|
|
322
|
+
#include "RemoteOutputsOptions.hpp"
|
|
320
323
|
#include "Progress.hpp"
|
|
321
324
|
|
|
322
325
|
#include "AudioBrowser-Swift-Cxx-Umbrella.hpp"
|
|
@@ -18,7 +18,7 @@ public extension NativeSetupPlayerOptions {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `NativeSetupPlayerOptions`.
|
|
20
20
|
*/
|
|
21
|
-
init(android: NativeAndroidSetupOptions?, ios: NativeIOSSetupOptions?, options: NativeUpdateOptions?, autoUpdateNowPlayingMetadata: Bool?, nowPlayingMetadataFormatter: ((_ params: FormatNowPlayingParams) -> Promise<NowPlayingUpdate?>)?, playWhenReady: Bool?, repeatMode: RepeatMode?, retry: Variant_Bool_RetryConfig?, keepSessionAliveOnError: Bool?, remoteOutputs:
|
|
21
|
+
init(android: NativeAndroidSetupOptions?, ios: NativeIOSSetupOptions?, options: NativeUpdateOptions?, autoUpdateNowPlayingMetadata: Bool?, nowPlayingMetadataFormatter: ((_ params: FormatNowPlayingParams) -> Promise<NowPlayingUpdate?>)?, playWhenReady: Bool?, repeatMode: RepeatMode?, retry: Variant_Bool_RetryConfig?, keepSessionAliveOnError: Bool?, remoteOutputs: RemoteOutputsOptions?) {
|
|
22
22
|
self.init({ () -> bridge.std__optional_NativeAndroidSetupOptions_ in
|
|
23
23
|
if let __unwrappedValue = android {
|
|
24
24
|
return bridge.create_std__optional_NativeAndroidSetupOptions_(__unwrappedValue)
|
|
@@ -83,9 +83,9 @@ public extension NativeSetupPlayerOptions {
|
|
|
83
83
|
} else {
|
|
84
84
|
return .init()
|
|
85
85
|
}
|
|
86
|
-
}(), { () -> bridge.
|
|
86
|
+
}(), { () -> bridge.std__optional_RemoteOutputsOptions_ in
|
|
87
87
|
if let __unwrappedValue = remoteOutputs {
|
|
88
|
-
return bridge.
|
|
88
|
+
return bridge.create_std__optional_RemoteOutputsOptions_(__unwrappedValue)
|
|
89
89
|
} else {
|
|
90
90
|
return .init()
|
|
91
91
|
}
|
|
@@ -211,14 +211,7 @@ public extension NativeSetupPlayerOptions {
|
|
|
211
211
|
}
|
|
212
212
|
|
|
213
213
|
@inline(__always)
|
|
214
|
-
var remoteOutputs:
|
|
215
|
-
return
|
|
216
|
-
if bridge.has_value_std__optional_bool_(self.__remoteOutputs) {
|
|
217
|
-
let __unwrapped = bridge.get_std__optional_bool_(self.__remoteOutputs)
|
|
218
|
-
return __unwrapped
|
|
219
|
-
} else {
|
|
220
|
-
return nil
|
|
221
|
-
}
|
|
222
|
-
}()
|
|
214
|
+
var remoteOutputs: RemoteOutputsOptions? {
|
|
215
|
+
return self.__remoteOutputs.value
|
|
223
216
|
}
|
|
224
217
|
}
|
|
@@ -35,6 +35,8 @@ public extension OutputType {
|
|
|
35
35
|
self = .usb
|
|
36
36
|
case "cast":
|
|
37
37
|
self = .cast
|
|
38
|
+
case "sonos":
|
|
39
|
+
self = .sonos
|
|
38
40
|
case "remote":
|
|
39
41
|
self = .remote
|
|
40
42
|
case "other":
|
|
@@ -67,6 +69,8 @@ public extension OutputType {
|
|
|
67
69
|
return "usb"
|
|
68
70
|
case .cast:
|
|
69
71
|
return "cast"
|
|
72
|
+
case .sonos:
|
|
73
|
+
return "sonos"
|
|
70
74
|
case .remote:
|
|
71
75
|
return "remote"
|
|
72
76
|
case .other:
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RemoteOutputsOptions.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
|
+
* Represents an instance of `RemoteOutputsOptions`, backed by a C++ struct.
|
|
12
|
+
*/
|
|
13
|
+
public typealias RemoteOutputsOptions = margelo.nitro.audiobrowser.RemoteOutputsOptions
|
|
14
|
+
|
|
15
|
+
public extension RemoteOutputsOptions {
|
|
16
|
+
private typealias bridge = margelo.nitro.audiobrowser.bridge.swift
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Create a new instance of `RemoteOutputsOptions`.
|
|
20
|
+
*/
|
|
21
|
+
init(cast: Bool?, castReceiverApplicationId: String?, sonos: Bool?) {
|
|
22
|
+
self.init({ () -> bridge.std__optional_bool_ in
|
|
23
|
+
if let __unwrappedValue = cast {
|
|
24
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
25
|
+
} else {
|
|
26
|
+
return .init()
|
|
27
|
+
}
|
|
28
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
29
|
+
if let __unwrappedValue = castReceiverApplicationId {
|
|
30
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
31
|
+
} else {
|
|
32
|
+
return .init()
|
|
33
|
+
}
|
|
34
|
+
}(), { () -> bridge.std__optional_bool_ in
|
|
35
|
+
if let __unwrappedValue = sonos {
|
|
36
|
+
return bridge.create_std__optional_bool_(__unwrappedValue)
|
|
37
|
+
} else {
|
|
38
|
+
return .init()
|
|
39
|
+
}
|
|
40
|
+
}())
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
@inline(__always)
|
|
44
|
+
var cast: Bool? {
|
|
45
|
+
return { () -> Bool? in
|
|
46
|
+
if bridge.has_value_std__optional_bool_(self.__cast) {
|
|
47
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__cast)
|
|
48
|
+
return __unwrapped
|
|
49
|
+
} else {
|
|
50
|
+
return nil
|
|
51
|
+
}
|
|
52
|
+
}()
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@inline(__always)
|
|
56
|
+
var castReceiverApplicationId: String? {
|
|
57
|
+
return { () -> String? in
|
|
58
|
+
if bridge.has_value_std__optional_std__string_(self.__castReceiverApplicationId) {
|
|
59
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__castReceiverApplicationId)
|
|
60
|
+
return String(__unwrapped)
|
|
61
|
+
} else {
|
|
62
|
+
return nil
|
|
63
|
+
}
|
|
64
|
+
}()
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@inline(__always)
|
|
68
|
+
var sonos: Bool? {
|
|
69
|
+
return { () -> Bool? in
|
|
70
|
+
if bridge.has_value_std__optional_bool_(self.__sonos) {
|
|
71
|
+
let __unwrapped = bridge.get_std__optional_bool_(self.__sonos)
|
|
72
|
+
return __unwrapped
|
|
73
|
+
} else {
|
|
74
|
+
return nil
|
|
75
|
+
}
|
|
76
|
+
}()
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -42,6 +42,8 @@ namespace margelo::nitro::audiobrowser { struct FormatNowPlayingParams; }
|
|
|
42
42
|
namespace margelo::nitro::audiobrowser { enum class RepeatMode; }
|
|
43
43
|
// Forward declaration of `RetryConfig` to properly resolve imports.
|
|
44
44
|
namespace margelo::nitro::audiobrowser { struct RetryConfig; }
|
|
45
|
+
// Forward declaration of `RemoteOutputsOptions` to properly resolve imports.
|
|
46
|
+
namespace margelo::nitro::audiobrowser { struct RemoteOutputsOptions; }
|
|
45
47
|
|
|
46
48
|
#include "NativeAndroidSetupOptions.hpp"
|
|
47
49
|
#include <optional>
|
|
@@ -54,6 +56,7 @@ namespace margelo::nitro::audiobrowser { struct RetryConfig; }
|
|
|
54
56
|
#include "RepeatMode.hpp"
|
|
55
57
|
#include "RetryConfig.hpp"
|
|
56
58
|
#include <variant>
|
|
59
|
+
#include "RemoteOutputsOptions.hpp"
|
|
57
60
|
|
|
58
61
|
namespace margelo::nitro::audiobrowser {
|
|
59
62
|
|
|
@@ -71,11 +74,11 @@ namespace margelo::nitro::audiobrowser {
|
|
|
71
74
|
std::optional<RepeatMode> repeatMode SWIFT_PRIVATE;
|
|
72
75
|
std::optional<std::variant<bool, RetryConfig>> retry SWIFT_PRIVATE;
|
|
73
76
|
std::optional<bool> keepSessionAliveOnError SWIFT_PRIVATE;
|
|
74
|
-
std::optional<
|
|
77
|
+
std::optional<RemoteOutputsOptions> remoteOutputs SWIFT_PRIVATE;
|
|
75
78
|
|
|
76
79
|
public:
|
|
77
80
|
NativeSetupPlayerOptions() = default;
|
|
78
|
-
explicit NativeSetupPlayerOptions(std::optional<NativeAndroidSetupOptions> android, std::optional<NativeIOSSetupOptions> ios, std::optional<NativeUpdateOptions> options, std::optional<bool> autoUpdateNowPlayingMetadata, std::optional<std::function<std::shared_ptr<Promise<std::optional<NowPlayingUpdate>>>(const FormatNowPlayingParams& /* params */)>> nowPlayingMetadataFormatter, std::optional<bool> playWhenReady, std::optional<RepeatMode> repeatMode, std::optional<std::variant<bool, RetryConfig>> retry, std::optional<bool> keepSessionAliveOnError, std::optional<
|
|
81
|
+
explicit NativeSetupPlayerOptions(std::optional<NativeAndroidSetupOptions> android, std::optional<NativeIOSSetupOptions> ios, std::optional<NativeUpdateOptions> options, std::optional<bool> autoUpdateNowPlayingMetadata, std::optional<std::function<std::shared_ptr<Promise<std::optional<NowPlayingUpdate>>>(const FormatNowPlayingParams& /* params */)>> nowPlayingMetadataFormatter, std::optional<bool> playWhenReady, std::optional<RepeatMode> repeatMode, std::optional<std::variant<bool, RetryConfig>> retry, std::optional<bool> keepSessionAliveOnError, std::optional<RemoteOutputsOptions> remoteOutputs): android(android), ios(ios), options(options), autoUpdateNowPlayingMetadata(autoUpdateNowPlayingMetadata), nowPlayingMetadataFormatter(nowPlayingMetadataFormatter), playWhenReady(playWhenReady), repeatMode(repeatMode), retry(retry), keepSessionAliveOnError(keepSessionAliveOnError), remoteOutputs(remoteOutputs) {}
|
|
79
82
|
|
|
80
83
|
public:
|
|
81
84
|
// NativeSetupPlayerOptions is not equatable because these properties are not equatable: nowPlayingMetadataFormatter
|
|
@@ -100,7 +103,7 @@ namespace margelo::nitro {
|
|
|
100
103
|
JSIConverter<std::optional<margelo::nitro::audiobrowser::RepeatMode>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "repeatMode"))),
|
|
101
104
|
JSIConverter<std::optional<std::variant<bool, margelo::nitro::audiobrowser::RetryConfig>>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "retry"))),
|
|
102
105
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "keepSessionAliveOnError"))),
|
|
103
|
-
JSIConverter<std::optional<
|
|
106
|
+
JSIConverter<std::optional<margelo::nitro::audiobrowser::RemoteOutputsOptions>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "remoteOutputs")))
|
|
104
107
|
);
|
|
105
108
|
}
|
|
106
109
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::audiobrowser::NativeSetupPlayerOptions& arg) {
|
|
@@ -114,7 +117,7 @@ namespace margelo::nitro {
|
|
|
114
117
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "repeatMode"), JSIConverter<std::optional<margelo::nitro::audiobrowser::RepeatMode>>::toJSI(runtime, arg.repeatMode));
|
|
115
118
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "retry"), JSIConverter<std::optional<std::variant<bool, margelo::nitro::audiobrowser::RetryConfig>>>::toJSI(runtime, arg.retry));
|
|
116
119
|
obj.setProperty(runtime, PropNameIDCache::get(runtime, "keepSessionAliveOnError"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.keepSessionAliveOnError));
|
|
117
|
-
obj.setProperty(runtime, PropNameIDCache::get(runtime, "remoteOutputs"), JSIConverter<std::optional<
|
|
120
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "remoteOutputs"), JSIConverter<std::optional<margelo::nitro::audiobrowser::RemoteOutputsOptions>>::toJSI(runtime, arg.remoteOutputs));
|
|
118
121
|
return obj;
|
|
119
122
|
}
|
|
120
123
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -134,7 +137,7 @@ namespace margelo::nitro {
|
|
|
134
137
|
if (!JSIConverter<std::optional<margelo::nitro::audiobrowser::RepeatMode>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "repeatMode")))) return false;
|
|
135
138
|
if (!JSIConverter<std::optional<std::variant<bool, margelo::nitro::audiobrowser::RetryConfig>>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "retry")))) return false;
|
|
136
139
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "keepSessionAliveOnError")))) return false;
|
|
137
|
-
if (!JSIConverter<std::optional<
|
|
140
|
+
if (!JSIConverter<std::optional<margelo::nitro::audiobrowser::RemoteOutputsOptions>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "remoteOutputs")))) return false;
|
|
138
141
|
return true;
|
|
139
142
|
}
|
|
140
143
|
};
|
|
@@ -38,8 +38,9 @@ namespace margelo::nitro::audiobrowser {
|
|
|
38
38
|
HDMI SWIFT_NAME(hdmi) = 6,
|
|
39
39
|
USB SWIFT_NAME(usb) = 7,
|
|
40
40
|
CAST SWIFT_NAME(cast) = 8,
|
|
41
|
-
|
|
42
|
-
|
|
41
|
+
SONOS SWIFT_NAME(sonos) = 9,
|
|
42
|
+
REMOTE SWIFT_NAME(remote) = 10,
|
|
43
|
+
OTHER SWIFT_NAME(other) = 11,
|
|
43
44
|
} CLOSED_ENUM;
|
|
44
45
|
|
|
45
46
|
} // namespace margelo::nitro::audiobrowser
|
|
@@ -61,6 +62,7 @@ namespace margelo::nitro {
|
|
|
61
62
|
case hashString("hdmi"): return margelo::nitro::audiobrowser::OutputType::HDMI;
|
|
62
63
|
case hashString("usb"): return margelo::nitro::audiobrowser::OutputType::USB;
|
|
63
64
|
case hashString("cast"): return margelo::nitro::audiobrowser::OutputType::CAST;
|
|
65
|
+
case hashString("sonos"): return margelo::nitro::audiobrowser::OutputType::SONOS;
|
|
64
66
|
case hashString("remote"): return margelo::nitro::audiobrowser::OutputType::REMOTE;
|
|
65
67
|
case hashString("other"): return margelo::nitro::audiobrowser::OutputType::OTHER;
|
|
66
68
|
default: [[unlikely]]
|
|
@@ -78,6 +80,7 @@ namespace margelo::nitro {
|
|
|
78
80
|
case margelo::nitro::audiobrowser::OutputType::HDMI: return JSIConverter<std::string>::toJSI(runtime, "hdmi");
|
|
79
81
|
case margelo::nitro::audiobrowser::OutputType::USB: return JSIConverter<std::string>::toJSI(runtime, "usb");
|
|
80
82
|
case margelo::nitro::audiobrowser::OutputType::CAST: return JSIConverter<std::string>::toJSI(runtime, "cast");
|
|
83
|
+
case margelo::nitro::audiobrowser::OutputType::SONOS: return JSIConverter<std::string>::toJSI(runtime, "sonos");
|
|
81
84
|
case margelo::nitro::audiobrowser::OutputType::REMOTE: return JSIConverter<std::string>::toJSI(runtime, "remote");
|
|
82
85
|
case margelo::nitro::audiobrowser::OutputType::OTHER: return JSIConverter<std::string>::toJSI(runtime, "other");
|
|
83
86
|
default: [[unlikely]]
|
|
@@ -100,6 +103,7 @@ namespace margelo::nitro {
|
|
|
100
103
|
case hashString("hdmi"):
|
|
101
104
|
case hashString("usb"):
|
|
102
105
|
case hashString("cast"):
|
|
106
|
+
case hashString("sonos"):
|
|
103
107
|
case hashString("remote"):
|
|
104
108
|
case hashString("other"):
|
|
105
109
|
return true;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// RemoteOutputsOptions.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
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
#include <optional>
|
|
34
|
+
#include <string>
|
|
35
|
+
|
|
36
|
+
namespace margelo::nitro::audiobrowser {
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* A struct which can be represented as a JavaScript object (RemoteOutputsOptions).
|
|
40
|
+
*/
|
|
41
|
+
struct RemoteOutputsOptions final {
|
|
42
|
+
public:
|
|
43
|
+
std::optional<bool> cast SWIFT_PRIVATE;
|
|
44
|
+
std::optional<std::string> castReceiverApplicationId SWIFT_PRIVATE;
|
|
45
|
+
std::optional<bool> sonos SWIFT_PRIVATE;
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
RemoteOutputsOptions() = default;
|
|
49
|
+
explicit RemoteOutputsOptions(std::optional<bool> cast, std::optional<std::string> castReceiverApplicationId, std::optional<bool> sonos): cast(cast), castReceiverApplicationId(castReceiverApplicationId), sonos(sonos) {}
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
friend bool operator==(const RemoteOutputsOptions& lhs, const RemoteOutputsOptions& rhs) = default;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
} // namespace margelo::nitro::audiobrowser
|
|
56
|
+
|
|
57
|
+
namespace margelo::nitro {
|
|
58
|
+
|
|
59
|
+
// C++ RemoteOutputsOptions <> JS RemoteOutputsOptions (object)
|
|
60
|
+
template <>
|
|
61
|
+
struct JSIConverter<margelo::nitro::audiobrowser::RemoteOutputsOptions> final {
|
|
62
|
+
static inline margelo::nitro::audiobrowser::RemoteOutputsOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
63
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
64
|
+
return margelo::nitro::audiobrowser::RemoteOutputsOptions(
|
|
65
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cast"))),
|
|
66
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "castReceiverApplicationId"))),
|
|
67
|
+
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sonos")))
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::audiobrowser::RemoteOutputsOptions& arg) {
|
|
71
|
+
jsi::Object obj(runtime);
|
|
72
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "cast"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.cast));
|
|
73
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "castReceiverApplicationId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.castReceiverApplicationId));
|
|
74
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sonos"), JSIConverter<std::optional<bool>>::toJSI(runtime, arg.sonos));
|
|
75
|
+
return obj;
|
|
76
|
+
}
|
|
77
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
78
|
+
if (!value.isObject()) {
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
jsi::Object obj = value.getObject(runtime);
|
|
82
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
85
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "cast")))) return false;
|
|
86
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "castReceiverApplicationId")))) return false;
|
|
87
|
+
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sonos")))) return false;
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
|
|
92
|
+
} // namespace margelo::nitro
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-audio-browser",
|
|
3
|
-
"version": "0.2.0-next.
|
|
3
|
+
"version": "0.2.0-next.52",
|
|
4
4
|
"description": "react-native-audio-browser is a react native package built with Nitro",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -71,7 +71,8 @@
|
|
|
71
71
|
"lint": "oxlint --fix",
|
|
72
72
|
"release": "semantic-release",
|
|
73
73
|
"test": "vitest run",
|
|
74
|
-
"types": "tsc --noEmit"
|
|
74
|
+
"types": "tsc --noEmit",
|
|
75
|
+
"vocab-check": "node scripts/vocab-check.ts"
|
|
75
76
|
},
|
|
76
77
|
"devDependencies": {
|
|
77
78
|
"@react-native-community/cli": "15.0.0-alpha.2",
|
|
@@ -483,6 +483,33 @@ export interface IOSSetupOptions extends IOSUpdateOptions {
|
|
|
483
483
|
categoryPolicy?: IOSCategoryPolicy
|
|
484
484
|
}
|
|
485
485
|
|
|
486
|
+
/** Which remote outputs `setupPlayer({ remoteOutputs })` turns on. */
|
|
487
|
+
export interface RemoteOutputsOptions {
|
|
488
|
+
/**
|
|
489
|
+
* Plays on Cast devices selected in the Output Switcher, through the Default Media Receiver:
|
|
490
|
+
* the receiver fetches the track's media URL itself, so it gets the URL the media transform
|
|
491
|
+
* resolves, without its headers. Needs the app built with `AudioBrowser_castEnabled=true` in
|
|
492
|
+
* its `gradle.properties` and Google Play services on the device; without either, playback
|
|
493
|
+
* stays on the phone and a warning is logged.
|
|
494
|
+
* @default false
|
|
495
|
+
*/
|
|
496
|
+
cast?: boolean
|
|
497
|
+
/**
|
|
498
|
+
* The Cast receiver application `cast` loads, as registered in the Google Cast SDK Developer
|
|
499
|
+
* Console: a Styled Media Receiver shows the app's own name on the device and in its
|
|
500
|
+
* notifications. Cast takes it once per app process: a change takes effect after a restart.
|
|
501
|
+
* @default the Default Media Receiver, `'CC1AD845'`
|
|
502
|
+
*/
|
|
503
|
+
castReceiverApplicationId?: string
|
|
504
|
+
/**
|
|
505
|
+
* Plays on Sonos rooms selected in the Output Switcher, over the speakers' UPnP control: the
|
|
506
|
+
* speaker fetches the media URL the media transform resolves, without its headers. Sonos calls
|
|
507
|
+
* UPnP unsupported and lets the listener switch it off; then no rooms are listed.
|
|
508
|
+
* @default false
|
|
509
|
+
*/
|
|
510
|
+
sonos?: boolean
|
|
511
|
+
}
|
|
512
|
+
|
|
486
513
|
/**
|
|
487
514
|
* @internal The wire shape `setupPlayer` sends across the bridge: the platform bags hold only
|
|
488
515
|
* construction fields, the runtime options nest under `options`, and the public `nowPlaying`
|
|
@@ -606,16 +633,20 @@ export type SetupPlayerOptions = Pick<
|
|
|
606
633
|
|
|
607
634
|
/**
|
|
608
635
|
* Offers remote speakers and TVs in the system Output Switcher (`openOutputPicker`), and
|
|
609
|
-
* reports the selected one as the `Output`, with `type: 'remote'
|
|
610
|
-
*
|
|
611
|
-
*
|
|
612
|
-
*
|
|
613
|
-
*
|
|
636
|
+
* reports the selected one as the `Output`, with `type: 'remote'`, or `'cast'` for a Cast
|
|
637
|
+
* device and `'sonos'` for a Sonos room. `{}` reports the selection only: the library keeps
|
|
638
|
+
* playing locally, and rendering the audio on the speaker is the provider's job. The speakers
|
|
639
|
+
* come from media route providers that declare the library's remote-output control category
|
|
640
|
+
* (`RemoteOutputs.CATEGORY` on Android). The app declares AndroidX's `MediaTransferReceiver` in
|
|
641
|
+
* its manifest for the switcher to move the session.
|
|
642
|
+
*
|
|
643
|
+
* Each `setupPlayer` sets it: left out, remote outputs are off, and playback on one comes back
|
|
644
|
+
* to the phone.
|
|
614
645
|
*
|
|
615
646
|
* Android 11+ only for now; ignored on iOS, whose route picker already lists AirPlay devices.
|
|
616
|
-
* @default
|
|
647
|
+
* @default off
|
|
617
648
|
*/
|
|
618
|
-
remoteOutputs?:
|
|
649
|
+
remoteOutputs?: RemoteOutputsOptions
|
|
619
650
|
|
|
620
651
|
/** Android-specific options: engine construction and runtime, merged. */
|
|
621
652
|
android?: AndroidSetupOptions
|