mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-06-10 05:41:10 +00:00
91 lines
3.9 KiB
C++
91 lines
3.9 KiB
C++
///
|
|
/// NitroVideoOnLoad.cpp
|
|
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
/// https://github.com/mrousavy/nitro
|
|
/// Copyright © 2024 Marc Rousavy @ Margelo
|
|
///
|
|
|
|
#include "NitroVideoOnLoad.hpp"
|
|
|
|
#include <jni.h>
|
|
#include <fbjni/fbjni.h>
|
|
#include <NitroModules/HybridObjectRegistry.hpp>
|
|
|
|
#include "JHybridVideoPlayerSpec.hpp"
|
|
#include "JHybridVideoPlayerFactorySpec.hpp"
|
|
#include "JHybridVideoPlayerSourceSpec.hpp"
|
|
#include "JHybridVideoPlayerSourceFactorySpec.hpp"
|
|
#include "JHybridVideoViewViewManagerSpec.hpp"
|
|
#include "JHybridVideoViewViewManagerFactorySpec.hpp"
|
|
#include <NitroModules/JNISharedPtr.hpp>
|
|
|
|
namespace margelo::nitro::video {
|
|
|
|
int initialize(JavaVM* vm) {
|
|
using namespace margelo::nitro;
|
|
using namespace margelo::nitro::video;
|
|
using namespace facebook;
|
|
|
|
return facebook::jni::initialize(vm, [] {
|
|
// Register native JNI methods
|
|
margelo::nitro::video::JHybridVideoPlayerSpec::registerNatives();
|
|
margelo::nitro::video::JHybridVideoPlayerFactorySpec::registerNatives();
|
|
margelo::nitro::video::JHybridVideoPlayerSourceSpec::registerNatives();
|
|
margelo::nitro::video::JHybridVideoPlayerSourceFactorySpec::registerNatives();
|
|
margelo::nitro::video::JHybridVideoViewViewManagerSpec::registerNatives();
|
|
margelo::nitro::video::JHybridVideoViewViewManagerFactorySpec::registerNatives();
|
|
|
|
// Register Nitro Hybrid Objects
|
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
"VideoPlayerFactory",
|
|
[]() -> std::shared_ptr<HybridObject> {
|
|
static auto javaClass = jni::findClassStatic("com/margelo/nitro/video/HybridVideoPlayerFactory");
|
|
static auto defaultConstructor = javaClass->getConstructor<JHybridVideoPlayerFactorySpec::javaobject()>();
|
|
|
|
auto instance = javaClass->newObject(defaultConstructor);
|
|
#ifdef NITRO_DEBUG
|
|
if (instance == nullptr) [[unlikely]] {
|
|
throw std::runtime_error("Failed to create an instance of \"JHybridVideoPlayerFactorySpec\" - the constructor returned null!");
|
|
}
|
|
#endif
|
|
auto globalRef = jni::make_global(instance);
|
|
return JNISharedPtr::make_shared_from_jni<JHybridVideoPlayerFactorySpec>(globalRef);
|
|
}
|
|
);
|
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
"VideoPlayerSourceFactory",
|
|
[]() -> std::shared_ptr<HybridObject> {
|
|
static auto javaClass = jni::findClassStatic("com/margelo/nitro/video/HybridVideoPlayerSourceFactory");
|
|
static auto defaultConstructor = javaClass->getConstructor<JHybridVideoPlayerSourceFactorySpec::javaobject()>();
|
|
|
|
auto instance = javaClass->newObject(defaultConstructor);
|
|
#ifdef NITRO_DEBUG
|
|
if (instance == nullptr) [[unlikely]] {
|
|
throw std::runtime_error("Failed to create an instance of \"JHybridVideoPlayerSourceFactorySpec\" - the constructor returned null!");
|
|
}
|
|
#endif
|
|
auto globalRef = jni::make_global(instance);
|
|
return JNISharedPtr::make_shared_from_jni<JHybridVideoPlayerSourceFactorySpec>(globalRef);
|
|
}
|
|
);
|
|
HybridObjectRegistry::registerHybridObjectConstructor(
|
|
"VideoViewViewManagerFactory",
|
|
[]() -> std::shared_ptr<HybridObject> {
|
|
static auto javaClass = jni::findClassStatic("com/margelo/nitro/video/HybridVideoViewViewManagerFactory");
|
|
static auto defaultConstructor = javaClass->getConstructor<JHybridVideoViewViewManagerFactorySpec::javaobject()>();
|
|
|
|
auto instance = javaClass->newObject(defaultConstructor);
|
|
#ifdef NITRO_DEBUG
|
|
if (instance == nullptr) [[unlikely]] {
|
|
throw std::runtime_error("Failed to create an instance of \"JHybridVideoViewViewManagerFactorySpec\" - the constructor returned null!");
|
|
}
|
|
#endif
|
|
auto globalRef = jni::make_global(instance);
|
|
return JNISharedPtr::make_shared_from_jni<JHybridVideoViewViewManagerFactorySpec>(globalRef);
|
|
}
|
|
);
|
|
});
|
|
}
|
|
|
|
} // namespace margelo::nitro::video
|