Cleanup setSource

This commit is contained in:
2026-05-25 18:33:44 +02:00
parent 89799cd5cc
commit 466b792878
12 changed files with 76 additions and 11479 deletions
+4 -10
View File
@@ -6,7 +6,6 @@ import type {
Rendition,
Track,
} from "./types/player";
import type { Source } from "./types/source";
export class WebOmniPlayer implements OmniPlayer {
_store: VideoPlayerStore;
@@ -17,19 +16,12 @@ export class WebOmniPlayer implements OmniPlayer {
this._store = store;
}
get source(): Source {
// TODO
}
set source(source: Source) {
// TODO
}
get showNotification(): boolean {
// TODO
return false;
}
set showNotification(value: boolean) {
set showNotification(_: boolean) {
// TODO
}
@@ -108,10 +100,12 @@ export class WebOmniPlayer implements OmniPlayer {
get hasPrev(): boolean {
// TODO
return false;
}
get hasNext(): boolean {
// TODO
return false;
}
get videos(): Track[] {
+1 -1
View File
@@ -22,7 +22,7 @@ export const OmniProvider = ({
const player = useLazyRef(() => ProviderFactory.createPlayer(source));
useEffect(() => {
player.source = source;
player.setSource(source);
}, [source]);
useEffect(() => {
+5 -12
View File
@@ -1,15 +1,8 @@
import { createPlayer } from "@videojs/react";
import { videoFeatures } from "@videojs/react/video";
import {
createContext,
type ReactNode,
useContext,
useEffect,
} from "react";
import { createContext, type ReactNode, useContext, useEffect } from "react";
import { WebOmniPlayer } from "./player.web";
import type {
OmniPlayer,
} from "./types/player";
import type { OmniPlayer } from "./types/player";
import type { Source } from "./types/source";
import { useLazyRef } from "./utils/lazy-ref";
@@ -45,11 +38,11 @@ const PlayerInitializer = ({
showNotification: boolean;
}) => {
const store = VideoPlayer.usePlayer();
const player = useLazyRef(() => new WebOmniPlayer(store, source));
const player = useLazyRef(() => new WebOmniPlayer(store));
useEffect(() => {
player.updateSource(source);
}, [source]);
store.source = source.src[0]?.uri || null;
}, [store, source]);
useEffect(() => {
player.showNotification = showNotification;
+2
View File
@@ -56,6 +56,8 @@ export interface OmniPlayer
extends HybridObject<{ android: "kotlin" }>,
OmniPlayerT {
readonly eventMap: OmniEventMap;
setSource(src: Source): void;
}
export interface OmniPlayerFactory extends HybridObject<{ android: "kotlin" }> {
+1 -4
View File
@@ -1,7 +1,4 @@
import type { Source } from "./source";
export interface OmniPlayer extends OmniPlayerState {
source: Source;
showNotification?: boolean;
play(): void;
@@ -34,7 +31,7 @@ export interface OmniPlayerState {
// between 0 and 1
volume: number;
muted: boolean;
readonly isAutoQuality: boolean
readonly isAutoQuality: boolean;
}
export type PlayerStatus = "idle" | "loading" | "readyToPlay" | "error";