mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-14 09:59:58 +00:00
fix(player): add a setSource
This commit is contained in:
+3
-3
@@ -232,9 +232,9 @@ namespace margelo::nitro::omni {
|
||||
}
|
||||
|
||||
// Methods
|
||||
void JHybridOmniPlayerSpec::setSource(const std::optional<Source>& src) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JSource> /* src */)>("setSource");
|
||||
method(_javaPart, src.has_value() ? JSource::fromCpp(src.value()) : nullptr);
|
||||
void JHybridOmniPlayerSpec::setSource(const std::optional<Source>& source) {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void(jni::alias_ref<JSource> /* source */)>("setSource");
|
||||
method(_javaPart, source.has_value() ? JSource::fromCpp(source.value()) : nullptr);
|
||||
}
|
||||
void JHybridOmniPlayerSpec::play() {
|
||||
static const auto method = _javaPart->javaClassStatic()->getMethod<void()>("play");
|
||||
|
||||
+1
-1
@@ -76,7 +76,7 @@ namespace margelo::nitro::omni {
|
||||
|
||||
public:
|
||||
// Methods
|
||||
void setSource(const std::optional<Source>& src) override;
|
||||
void setSource(const std::optional<Source>& source) override;
|
||||
void play() override;
|
||||
void pause() override;
|
||||
void seekBy(double offset) override;
|
||||
|
||||
+1
-1
@@ -110,7 +110,7 @@ abstract class HybridOmniPlayerSpec: HybridObject() {
|
||||
// Methods
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
abstract fun setSource(src: Source?): Unit
|
||||
abstract fun setSource(source: Source?): Unit
|
||||
|
||||
@DoNotStrip
|
||||
@Keep
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ namespace margelo::nitro::omni {
|
||||
|
||||
public:
|
||||
// Methods
|
||||
virtual void setSource(const std::optional<Source>& src) = 0;
|
||||
virtual void setSource(const std::optional<Source>& source) = 0;
|
||||
virtual void play() = 0;
|
||||
virtual void pause() = 0;
|
||||
virtual void seekBy(double offset) = 0;
|
||||
|
||||
@@ -74,6 +74,10 @@ export class WebOmniPlayer implements OmniPlayer {
|
||||
return this._source;
|
||||
}
|
||||
|
||||
setSource(source?: Source): void {
|
||||
this.source = source ?? null;
|
||||
}
|
||||
|
||||
set source(source: Source | null) {
|
||||
this._source = source;
|
||||
// Drop the overlay subtitle if it is not part of the new source.
|
||||
|
||||
@@ -56,8 +56,6 @@ export interface OmniPlayer
|
||||
extends HybridObject<{ android: "kotlin" }>,
|
||||
OmniPlayerT {
|
||||
readonly eventMap: OmniEventMap;
|
||||
|
||||
setSource(src?: Source): void;
|
||||
}
|
||||
|
||||
export interface OmniPlayerFactory extends HybridObject<{ android: "kotlin" }> {
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
import type { Source } from "./source";
|
||||
|
||||
export interface OmniPlayer extends OmniPlayerState {
|
||||
showNotification?: boolean;
|
||||
|
||||
setSource(source?: Source): void;
|
||||
|
||||
play(): void;
|
||||
pause(): void;
|
||||
seekBy(offset: number): void;
|
||||
|
||||
Reference in New Issue
Block a user