mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-06-10 05:41:10 +00:00
268 lines
12 KiB
C++
Generated
268 lines
12 KiB
C++
Generated
///
|
|
/// JHybridVideoPlayerSpec.cpp
|
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
/// https://github.com/mrousavy/nitro
|
|
/// Copyright © 2025 Marc Rousavy @ Margelo
|
|
///
|
|
|
|
#include "JHybridVideoPlayerSpec.hpp"
|
|
|
|
// Forward declaration of `HybridVideoPlayerSourceSpec` to properly resolve imports.
|
|
namespace margelo::nitro::video { class HybridVideoPlayerSourceSpec; }
|
|
// Forward declaration of `HybridVideoPlayerEventEmitterSpec` to properly resolve imports.
|
|
namespace margelo::nitro::video { class HybridVideoPlayerEventEmitterSpec; }
|
|
// Forward declaration of `VideoPlayerStatus` to properly resolve imports.
|
|
namespace margelo::nitro::video { enum class VideoPlayerStatus; }
|
|
// Forward declaration of `MixAudioMode` to properly resolve imports.
|
|
namespace margelo::nitro::video { enum class MixAudioMode; }
|
|
// Forward declaration of `IgnoreSilentSwitchMode` to properly resolve imports.
|
|
namespace margelo::nitro::video { enum class IgnoreSilentSwitchMode; }
|
|
// Forward declaration of `TextTrack` to properly resolve imports.
|
|
namespace margelo::nitro::video { struct TextTrack; }
|
|
|
|
#include <memory>
|
|
#include "HybridVideoPlayerSourceSpec.hpp"
|
|
#include "JHybridVideoPlayerSourceSpec.hpp"
|
|
#include "HybridVideoPlayerEventEmitterSpec.hpp"
|
|
#include "JHybridVideoPlayerEventEmitterSpec.hpp"
|
|
#include "VideoPlayerStatus.hpp"
|
|
#include "JVideoPlayerStatus.hpp"
|
|
#include "MixAudioMode.hpp"
|
|
#include "JMixAudioMode.hpp"
|
|
#include "IgnoreSilentSwitchMode.hpp"
|
|
#include "JIgnoreSilentSwitchMode.hpp"
|
|
#include "TextTrack.hpp"
|
|
#include <optional>
|
|
#include "JTextTrack.hpp"
|
|
#include <string>
|
|
#include <NitroModules/Promise.hpp>
|
|
#include <NitroModules/JPromise.hpp>
|
|
#include <vector>
|
|
|
|
namespace margelo::nitro::video {
|
|
|
|
jni::local_ref<JHybridVideoPlayerSpec::jhybriddata> JHybridVideoPlayerSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
return makeCxxInstance(jThis);
|
|
}
|
|
|
|
void JHybridVideoPlayerSpec::registerNatives() {
|
|
registerHybrid({
|
|
makeNativeMethod("initHybrid", JHybridVideoPlayerSpec::initHybrid),
|
|
});
|
|
}
|
|
|
|
size_t JHybridVideoPlayerSpec::getExternalMemorySize() noexcept {
|
|
static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
|
|
return method(_javaPart);
|
|
}
|
|
|
|
void JHybridVideoPlayerSpec::dispose() noexcept {
|
|
static const auto method = javaClassStatic()->getMethod<void()>("dispose");
|
|
method(_javaPart);
|
|
}
|
|
|
|
// Properties
|
|
std::shared_ptr<HybridVideoPlayerSourceSpec> JHybridVideoPlayerSpec::getSource() {
|
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JHybridVideoPlayerSourceSpec::javaobject>()>("getSource");
|
|
auto __result = method(_javaPart);
|
|
return __result->cthis()->shared_cast<JHybridVideoPlayerSourceSpec>();
|
|
}
|
|
std::shared_ptr<HybridVideoPlayerEventEmitterSpec> JHybridVideoPlayerSpec::getEventEmitter() {
|
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JHybridVideoPlayerEventEmitterSpec::javaobject>()>("getEventEmitter");
|
|
auto __result = method(_javaPart);
|
|
return __result->cthis()->shared_cast<JHybridVideoPlayerEventEmitterSpec>();
|
|
}
|
|
bool JHybridVideoPlayerSpec::getShowNotificationControls() {
|
|
static const auto method = javaClassStatic()->getMethod<jboolean()>("getShowNotificationControls");
|
|
auto __result = method(_javaPart);
|
|
return static_cast<bool>(__result);
|
|
}
|
|
void JHybridVideoPlayerSpec::setShowNotificationControls(bool showNotificationControls) {
|
|
static const auto method = javaClassStatic()->getMethod<void(jboolean /* showNotificationControls */)>("setShowNotificationControls");
|
|
method(_javaPart, showNotificationControls);
|
|
}
|
|
VideoPlayerStatus JHybridVideoPlayerSpec::getStatus() {
|
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JVideoPlayerStatus>()>("getStatus");
|
|
auto __result = method(_javaPart);
|
|
return __result->toCpp();
|
|
}
|
|
double JHybridVideoPlayerSpec::getDuration() {
|
|
static const auto method = javaClassStatic()->getMethod<double()>("getDuration");
|
|
auto __result = method(_javaPart);
|
|
return __result;
|
|
}
|
|
double JHybridVideoPlayerSpec::getVolume() {
|
|
static const auto method = javaClassStatic()->getMethod<double()>("getVolume");
|
|
auto __result = method(_javaPart);
|
|
return __result;
|
|
}
|
|
void JHybridVideoPlayerSpec::setVolume(double volume) {
|
|
static const auto method = javaClassStatic()->getMethod<void(double /* volume */)>("setVolume");
|
|
method(_javaPart, volume);
|
|
}
|
|
double JHybridVideoPlayerSpec::getCurrentTime() {
|
|
static const auto method = javaClassStatic()->getMethod<double()>("getCurrentTime");
|
|
auto __result = method(_javaPart);
|
|
return __result;
|
|
}
|
|
void JHybridVideoPlayerSpec::setCurrentTime(double currentTime) {
|
|
static const auto method = javaClassStatic()->getMethod<void(double /* currentTime */)>("setCurrentTime");
|
|
method(_javaPart, currentTime);
|
|
}
|
|
bool JHybridVideoPlayerSpec::getMuted() {
|
|
static const auto method = javaClassStatic()->getMethod<jboolean()>("getMuted");
|
|
auto __result = method(_javaPart);
|
|
return static_cast<bool>(__result);
|
|
}
|
|
void JHybridVideoPlayerSpec::setMuted(bool muted) {
|
|
static const auto method = javaClassStatic()->getMethod<void(jboolean /* muted */)>("setMuted");
|
|
method(_javaPart, muted);
|
|
}
|
|
bool JHybridVideoPlayerSpec::getLoop() {
|
|
static const auto method = javaClassStatic()->getMethod<jboolean()>("getLoop");
|
|
auto __result = method(_javaPart);
|
|
return static_cast<bool>(__result);
|
|
}
|
|
void JHybridVideoPlayerSpec::setLoop(bool loop) {
|
|
static const auto method = javaClassStatic()->getMethod<void(jboolean /* loop */)>("setLoop");
|
|
method(_javaPart, loop);
|
|
}
|
|
double JHybridVideoPlayerSpec::getRate() {
|
|
static const auto method = javaClassStatic()->getMethod<double()>("getRate");
|
|
auto __result = method(_javaPart);
|
|
return __result;
|
|
}
|
|
void JHybridVideoPlayerSpec::setRate(double rate) {
|
|
static const auto method = javaClassStatic()->getMethod<void(double /* rate */)>("setRate");
|
|
method(_javaPart, rate);
|
|
}
|
|
MixAudioMode JHybridVideoPlayerSpec::getMixAudioMode() {
|
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JMixAudioMode>()>("getMixAudioMode");
|
|
auto __result = method(_javaPart);
|
|
return __result->toCpp();
|
|
}
|
|
void JHybridVideoPlayerSpec::setMixAudioMode(MixAudioMode mixAudioMode) {
|
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JMixAudioMode> /* mixAudioMode */)>("setMixAudioMode");
|
|
method(_javaPart, JMixAudioMode::fromCpp(mixAudioMode));
|
|
}
|
|
IgnoreSilentSwitchMode JHybridVideoPlayerSpec::getIgnoreSilentSwitchMode() {
|
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JIgnoreSilentSwitchMode>()>("getIgnoreSilentSwitchMode");
|
|
auto __result = method(_javaPart);
|
|
return __result->toCpp();
|
|
}
|
|
void JHybridVideoPlayerSpec::setIgnoreSilentSwitchMode(IgnoreSilentSwitchMode ignoreSilentSwitchMode) {
|
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JIgnoreSilentSwitchMode> /* ignoreSilentSwitchMode */)>("setIgnoreSilentSwitchMode");
|
|
method(_javaPart, JIgnoreSilentSwitchMode::fromCpp(ignoreSilentSwitchMode));
|
|
}
|
|
bool JHybridVideoPlayerSpec::getPlayInBackground() {
|
|
static const auto method = javaClassStatic()->getMethod<jboolean()>("getPlayInBackground");
|
|
auto __result = method(_javaPart);
|
|
return static_cast<bool>(__result);
|
|
}
|
|
void JHybridVideoPlayerSpec::setPlayInBackground(bool playInBackground) {
|
|
static const auto method = javaClassStatic()->getMethod<void(jboolean /* playInBackground */)>("setPlayInBackground");
|
|
method(_javaPart, playInBackground);
|
|
}
|
|
bool JHybridVideoPlayerSpec::getPlayWhenInactive() {
|
|
static const auto method = javaClassStatic()->getMethod<jboolean()>("getPlayWhenInactive");
|
|
auto __result = method(_javaPart);
|
|
return static_cast<bool>(__result);
|
|
}
|
|
void JHybridVideoPlayerSpec::setPlayWhenInactive(bool playWhenInactive) {
|
|
static const auto method = javaClassStatic()->getMethod<void(jboolean /* playWhenInactive */)>("setPlayWhenInactive");
|
|
method(_javaPart, playWhenInactive);
|
|
}
|
|
bool JHybridVideoPlayerSpec::getIsPlaying() {
|
|
static const auto method = javaClassStatic()->getMethod<jboolean()>("isPlaying");
|
|
auto __result = method(_javaPart);
|
|
return static_cast<bool>(__result);
|
|
}
|
|
std::optional<TextTrack> JHybridVideoPlayerSpec::getSelectedTrack() {
|
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JTextTrack>()>("getSelectedTrack");
|
|
auto __result = method(_javaPart);
|
|
return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
|
|
}
|
|
|
|
// Methods
|
|
std::shared_ptr<Promise<void>> JHybridVideoPlayerSpec::replaceSourceAsync(const std::optional<std::shared_ptr<HybridVideoPlayerSourceSpec>>& source) {
|
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>(jni::alias_ref<JHybridVideoPlayerSourceSpec::javaobject> /* source */)>("replaceSourceAsync");
|
|
auto __result = method(_javaPart, source.has_value() ? std::dynamic_pointer_cast<JHybridVideoPlayerSourceSpec>(source.value())->getJavaPart() : nullptr);
|
|
return [&]() {
|
|
auto __promise = Promise<void>::create();
|
|
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
|
|
__promise->resolve();
|
|
});
|
|
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
jni::JniException __jniError(__throwable);
|
|
__promise->reject(std::make_exception_ptr(__jniError));
|
|
});
|
|
return __promise;
|
|
}();
|
|
}
|
|
std::vector<TextTrack> JHybridVideoPlayerSpec::getAvailableTextTracks() {
|
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JArrayClass<JTextTrack>>()>("getAvailableTextTracks");
|
|
auto __result = method(_javaPart);
|
|
return [&]() {
|
|
size_t __size = __result->size();
|
|
std::vector<TextTrack> __vector;
|
|
__vector.reserve(__size);
|
|
for (size_t __i = 0; __i < __size; __i++) {
|
|
auto __element = __result->getElement(__i);
|
|
__vector.push_back(__element->toCpp());
|
|
}
|
|
return __vector;
|
|
}();
|
|
}
|
|
void JHybridVideoPlayerSpec::selectTextTrack(const std::optional<TextTrack>& textTrack) {
|
|
static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JTextTrack> /* textTrack */)>("selectTextTrack");
|
|
method(_javaPart, textTrack.has_value() ? JTextTrack::fromCpp(textTrack.value()) : nullptr);
|
|
}
|
|
std::shared_ptr<Promise<void>> JHybridVideoPlayerSpec::initialize() {
|
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("initialize");
|
|
auto __result = method(_javaPart);
|
|
return [&]() {
|
|
auto __promise = Promise<void>::create();
|
|
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
|
|
__promise->resolve();
|
|
});
|
|
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
jni::JniException __jniError(__throwable);
|
|
__promise->reject(std::make_exception_ptr(__jniError));
|
|
});
|
|
return __promise;
|
|
}();
|
|
}
|
|
std::shared_ptr<Promise<void>> JHybridVideoPlayerSpec::preload() {
|
|
static const auto method = javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("preload");
|
|
auto __result = method(_javaPart);
|
|
return [&]() {
|
|
auto __promise = Promise<void>::create();
|
|
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& /* unit */) {
|
|
__promise->resolve();
|
|
});
|
|
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
jni::JniException __jniError(__throwable);
|
|
__promise->reject(std::make_exception_ptr(__jniError));
|
|
});
|
|
return __promise;
|
|
}();
|
|
}
|
|
void JHybridVideoPlayerSpec::play() {
|
|
static const auto method = javaClassStatic()->getMethod<void()>("play");
|
|
method(_javaPart);
|
|
}
|
|
void JHybridVideoPlayerSpec::pause() {
|
|
static const auto method = javaClassStatic()->getMethod<void()>("pause");
|
|
method(_javaPart);
|
|
}
|
|
void JHybridVideoPlayerSpec::seekBy(double time) {
|
|
static const auto method = javaClassStatic()->getMethod<void(double /* time */)>("seekBy");
|
|
method(_javaPart, time);
|
|
}
|
|
void JHybridVideoPlayerSpec::seekTo(double time) {
|
|
static const auto method = javaClassStatic()->getMethod<void(double /* time */)>("seekTo");
|
|
method(_javaPart, time);
|
|
}
|
|
|
|
} // namespace margelo::nitro::video
|