mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-06-21 17:34:18 +00:00
125 lines
5.5 KiB
C++
Generated
125 lines
5.5 KiB
C++
Generated
///
|
|
/// JHybridVideoPlayerSourceSpec.cpp
|
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
/// https://github.com/mrousavy/nitro
|
|
/// Copyright © Marc Rousavy @ Margelo
|
|
///
|
|
|
|
#include "JHybridVideoPlayerSourceSpec.hpp"
|
|
|
|
// Forward declaration of `NativeVideoConfig` to properly resolve imports.
|
|
namespace margelo::nitro::video { struct NativeVideoConfig; }
|
|
// Forward declaration of `NativeExternalSubtitle` to properly resolve imports.
|
|
namespace margelo::nitro::video { struct NativeExternalSubtitle; }
|
|
// Forward declaration of `SubtitleType` to properly resolve imports.
|
|
namespace margelo::nitro::video { enum class SubtitleType; }
|
|
// Forward declaration of `NativeDrmParams` to properly resolve imports.
|
|
namespace margelo::nitro::video { struct NativeDrmParams; }
|
|
// Forward declaration of `OnGetLicensePayload` to properly resolve imports.
|
|
namespace margelo::nitro::video { struct OnGetLicensePayload; }
|
|
// Forward declaration of `BufferConfig` to properly resolve imports.
|
|
namespace margelo::nitro::video { struct BufferConfig; }
|
|
// Forward declaration of `LivePlaybackParams` to properly resolve imports.
|
|
namespace margelo::nitro::video { struct LivePlaybackParams; }
|
|
// Forward declaration of `Resolution` to properly resolve imports.
|
|
namespace margelo::nitro::video { struct Resolution; }
|
|
// Forward declaration of `CustomVideoMetadata` to properly resolve imports.
|
|
namespace margelo::nitro::video { struct CustomVideoMetadata; }
|
|
// Forward declaration of `VideoInformation` to properly resolve imports.
|
|
namespace margelo::nitro::video { struct VideoInformation; }
|
|
// Forward declaration of `VideoOrientation` to properly resolve imports.
|
|
namespace margelo::nitro::video { enum class VideoOrientation; }
|
|
|
|
#include <string>
|
|
#include "NativeVideoConfig.hpp"
|
|
#include "JNativeVideoConfig.hpp"
|
|
#include "NativeExternalSubtitle.hpp"
|
|
#include <vector>
|
|
#include <optional>
|
|
#include "JNativeExternalSubtitle.hpp"
|
|
#include "SubtitleType.hpp"
|
|
#include "JSubtitleType.hpp"
|
|
#include "NativeDrmParams.hpp"
|
|
#include "JNativeDrmParams.hpp"
|
|
#include <unordered_map>
|
|
#include <NitroModules/Promise.hpp>
|
|
#include "OnGetLicensePayload.hpp"
|
|
#include <functional>
|
|
#include "JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.hpp"
|
|
#include <NitroModules/JNICallable.hpp>
|
|
#include <NitroModules/JPromise.hpp>
|
|
#include "JOnGetLicensePayload.hpp"
|
|
#include "BufferConfig.hpp"
|
|
#include "JBufferConfig.hpp"
|
|
#include "LivePlaybackParams.hpp"
|
|
#include "JLivePlaybackParams.hpp"
|
|
#include "Resolution.hpp"
|
|
#include "JResolution.hpp"
|
|
#include "CustomVideoMetadata.hpp"
|
|
#include "JCustomVideoMetadata.hpp"
|
|
#include "VideoInformation.hpp"
|
|
#include "JVideoInformation.hpp"
|
|
#include "VideoOrientation.hpp"
|
|
#include "JVideoOrientation.hpp"
|
|
|
|
namespace margelo::nitro::video {
|
|
|
|
std::shared_ptr<JHybridVideoPlayerSourceSpec> JHybridVideoPlayerSourceSpec::JavaPart::getJHybridVideoPlayerSourceSpec() {
|
|
auto hybridObject = JHybridObject::JavaPart::getJHybridObject();
|
|
auto castHybridObject = std::dynamic_pointer_cast<JHybridVideoPlayerSourceSpec>(hybridObject);
|
|
if (castHybridObject == nullptr) [[unlikely]] {
|
|
throw std::runtime_error("Failed to downcast JHybridObject to JHybridVideoPlayerSourceSpec!");
|
|
}
|
|
return castHybridObject;
|
|
}
|
|
|
|
jni::local_ref<JHybridVideoPlayerSourceSpec::CxxPart::jhybriddata> JHybridVideoPlayerSourceSpec::CxxPart::initHybrid(jni::alias_ref<jhybridobject> jThis) {
|
|
return makeCxxInstance(jThis);
|
|
}
|
|
|
|
std::shared_ptr<JHybridObject> JHybridVideoPlayerSourceSpec::CxxPart::createHybridObject(const jni::local_ref<JHybridObject::JavaPart>& javaPart) {
|
|
auto castJavaPart = jni::dynamic_ref_cast<JHybridVideoPlayerSourceSpec::JavaPart>(javaPart);
|
|
if (castJavaPart == nullptr) [[unlikely]] {
|
|
throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridVideoPlayerSourceSpec::JavaPart!");
|
|
}
|
|
return std::make_shared<JHybridVideoPlayerSourceSpec>(castJavaPart);
|
|
}
|
|
|
|
void JHybridVideoPlayerSourceSpec::CxxPart::registerNatives() {
|
|
registerHybrid({
|
|
makeNativeMethod("initHybrid", JHybridVideoPlayerSourceSpec::CxxPart::initHybrid),
|
|
});
|
|
}
|
|
|
|
// Properties
|
|
std::string JHybridVideoPlayerSourceSpec::getUri() {
|
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getUri");
|
|
auto __result = method(_javaPart);
|
|
return __result->toStdString();
|
|
}
|
|
NativeVideoConfig JHybridVideoPlayerSourceSpec::getConfig() {
|
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JNativeVideoConfig>()>("getConfig");
|
|
auto __result = method(_javaPart);
|
|
return __result->toCpp();
|
|
}
|
|
|
|
// Methods
|
|
std::shared_ptr<Promise<VideoInformation>> JHybridVideoPlayerSourceSpec::getAssetInformationAsync() {
|
|
static const auto method = _javaPart->javaClassStatic()->getMethod<jni::local_ref<JPromise::javaobject>()>("getAssetInformationAsync");
|
|
auto __result = method(_javaPart);
|
|
return [&]() {
|
|
auto __promise = Promise<VideoInformation>::create();
|
|
__result->cthis()->addOnResolvedListener([=](const jni::alias_ref<jni::JObject>& __boxedResult) {
|
|
auto __result = jni::static_ref_cast<JVideoInformation>(__boxedResult);
|
|
__promise->resolve(__result->toCpp());
|
|
});
|
|
__result->cthis()->addOnRejectedListener([=](const jni::alias_ref<jni::JThrowable>& __throwable) {
|
|
jni::JniException __jniError(__throwable);
|
|
__promise->reject(std::make_exception_ptr(__jniError));
|
|
});
|
|
return __promise;
|
|
}();
|
|
}
|
|
|
|
} // namespace margelo::nitro::video
|