mirror of
https://github.com/zoriya/react-native-video.git
synced 2026-06-08 04:42:51 +00:00
.
This commit is contained in:
+115
@@ -0,0 +1,115 @@
|
||||
///
|
||||
/// HybridVideoPlayerSpec.hpp
|
||||
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
||||
/// https://github.com/mrousavy/nitro
|
||||
/// Copyright © 2025 Marc Rousavy @ Margelo
|
||||
///
|
||||
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<NitroModules/HybridObject.hpp>)
|
||||
#include <NitroModules/HybridObject.hpp>
|
||||
#else
|
||||
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
||||
#endif
|
||||
|
||||
// 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 "HybridVideoPlayerEventEmitterSpec.hpp"
|
||||
#include "VideoPlayerStatus.hpp"
|
||||
#include "MixAudioMode.hpp"
|
||||
#include "IgnoreSilentSwitchMode.hpp"
|
||||
#include "TextTrack.hpp"
|
||||
#include <optional>
|
||||
#include <NitroModules/Promise.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace margelo::nitro::video {
|
||||
|
||||
using namespace margelo::nitro;
|
||||
|
||||
/**
|
||||
* An abstract base class for `VideoPlayer`
|
||||
* Inherit this class to create instances of `HybridVideoPlayerSpec` in C++.
|
||||
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
||||
* @example
|
||||
* ```cpp
|
||||
* class HybridVideoPlayer: public HybridVideoPlayerSpec {
|
||||
* public:
|
||||
* HybridVideoPlayer(...): HybridObject(TAG) { ... }
|
||||
* // ...
|
||||
* };
|
||||
* ```
|
||||
*/
|
||||
class HybridVideoPlayerSpec: public virtual HybridObject {
|
||||
public:
|
||||
// Constructor
|
||||
explicit HybridVideoPlayerSpec(): HybridObject(TAG) { }
|
||||
|
||||
// Destructor
|
||||
~HybridVideoPlayerSpec() override = default;
|
||||
|
||||
public:
|
||||
// Properties
|
||||
virtual std::shared_ptr<HybridVideoPlayerSourceSpec> getSource() = 0;
|
||||
virtual std::shared_ptr<HybridVideoPlayerEventEmitterSpec> getEventEmitter() = 0;
|
||||
virtual bool getShowNotificationControls() = 0;
|
||||
virtual void setShowNotificationControls(bool showNotificationControls) = 0;
|
||||
virtual VideoPlayerStatus getStatus() = 0;
|
||||
virtual double getDuration() = 0;
|
||||
virtual double getVolume() = 0;
|
||||
virtual void setVolume(double volume) = 0;
|
||||
virtual double getCurrentTime() = 0;
|
||||
virtual void setCurrentTime(double currentTime) = 0;
|
||||
virtual bool getMuted() = 0;
|
||||
virtual void setMuted(bool muted) = 0;
|
||||
virtual bool getLoop() = 0;
|
||||
virtual void setLoop(bool loop) = 0;
|
||||
virtual double getRate() = 0;
|
||||
virtual void setRate(double rate) = 0;
|
||||
virtual MixAudioMode getMixAudioMode() = 0;
|
||||
virtual void setMixAudioMode(MixAudioMode mixAudioMode) = 0;
|
||||
virtual IgnoreSilentSwitchMode getIgnoreSilentSwitchMode() = 0;
|
||||
virtual void setIgnoreSilentSwitchMode(IgnoreSilentSwitchMode ignoreSilentSwitchMode) = 0;
|
||||
virtual bool getPlayInBackground() = 0;
|
||||
virtual void setPlayInBackground(bool playInBackground) = 0;
|
||||
virtual bool getPlayWhenInactive() = 0;
|
||||
virtual void setPlayWhenInactive(bool playWhenInactive) = 0;
|
||||
virtual bool getIsPlaying() = 0;
|
||||
virtual std::optional<TextTrack> getSelectedTrack() = 0;
|
||||
|
||||
public:
|
||||
// Methods
|
||||
virtual std::shared_ptr<Promise<void>> replaceSourceAsync(const std::optional<std::shared_ptr<HybridVideoPlayerSourceSpec>>& source) = 0;
|
||||
virtual std::vector<TextTrack> getAvailableTextTracks() = 0;
|
||||
virtual void selectTextTrack(const std::optional<TextTrack>& textTrack) = 0;
|
||||
virtual std::shared_ptr<Promise<void>> initialize() = 0;
|
||||
virtual std::shared_ptr<Promise<void>> preload() = 0;
|
||||
virtual void play() = 0;
|
||||
virtual void pause() = 0;
|
||||
virtual void seekBy(double time) = 0;
|
||||
virtual void seekTo(double time) = 0;
|
||||
|
||||
protected:
|
||||
// Hybrid Setup
|
||||
void loadHybridMethods() override;
|
||||
|
||||
protected:
|
||||
// Tag for logging
|
||||
static constexpr auto TAG = "VideoPlayer";
|
||||
};
|
||||
|
||||
} // namespace margelo::nitro::video
|
||||
Reference in New Issue
Block a user