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