/// /// 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 #include "NativeVideoConfig.hpp" #include "JNativeVideoConfig.hpp" #include "NativeExternalSubtitle.hpp" #include #include #include "JNativeExternalSubtitle.hpp" #include "SubtitleType.hpp" #include "JSubtitleType.hpp" #include "NativeDrmParams.hpp" #include "JNativeDrmParams.hpp" #include #include #include "OnGetLicensePayload.hpp" #include #include "JFunc_std__shared_ptr_Promise_std__shared_ptr_Promise_std__string_____OnGetLicensePayload.hpp" #include #include #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::JavaPart::getJHybridVideoPlayerSourceSpec() { auto hybridObject = JHybridObject::JavaPart::getJHybridObject(); auto castHybridObject = std::dynamic_pointer_cast(hybridObject); if (castHybridObject == nullptr) [[unlikely]] { throw std::runtime_error("Failed to downcast JHybridObject to JHybridVideoPlayerSourceSpec!"); } return castHybridObject; } jni::local_ref JHybridVideoPlayerSourceSpec::CxxPart::initHybrid(jni::alias_ref jThis) { return makeCxxInstance(jThis); } std::shared_ptr JHybridVideoPlayerSourceSpec::CxxPart::createHybridObject(const jni::local_ref& javaPart) { auto castJavaPart = jni::dynamic_ref_cast(javaPart); if (castJavaPart == nullptr) [[unlikely]] { throw std::runtime_error("Failed to cast JHybridObject::JavaPart to JHybridVideoPlayerSourceSpec::JavaPart!"); } return std::make_shared(castJavaPart); } void JHybridVideoPlayerSourceSpec::CxxPart::registerNatives() { registerHybrid({ makeNativeMethod("initHybrid", JHybridVideoPlayerSourceSpec::CxxPart::initHybrid), }); } // Properties std::string JHybridVideoPlayerSourceSpec::getUri() { static const auto method = _javaPart->javaClassStatic()->getMethod()>("getUri"); auto __result = method(_javaPart); return __result->toStdString(); } NativeVideoConfig JHybridVideoPlayerSourceSpec::getConfig() { static const auto method = _javaPart->javaClassStatic()->getMethod()>("getConfig"); auto __result = method(_javaPart); return __result->toCpp(); } // Methods std::shared_ptr> JHybridVideoPlayerSourceSpec::getAssetInformationAsync() { static const auto method = _javaPart->javaClassStatic()->getMethod()>("getAssetInformationAsync"); auto __result = method(_javaPart); return [&]() { auto __promise = Promise::create(); __result->cthis()->addOnResolvedListener([=](const jni::alias_ref& __boxedResult) { auto __result = jni::static_ref_cast(__boxedResult); __promise->resolve(__result->toCpp()); }); __result->cthis()->addOnRejectedListener([=](const jni::alias_ref& __throwable) { jni::JniException __jniError(__throwable); __promise->reject(std::make_exception_ptr(__jniError)); }); return __promise; }(); } } // namespace margelo::nitro::video