mirror of
https://github.com/zoriya/react-native-omni.git
synced 2026-08-16 02:44:51 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
49f08137f0 | ||
|
|
153b492e0a |
@@ -6,7 +6,12 @@
|
|||||||
"name": "react-native-omni",
|
"name": "react-native-omni",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/config-plugins": "^57.0.3",
|
"@expo/config-plugins": "^57.0.3",
|
||||||
"@videojs/react": "10.0.0-beta.25",
|
"@videojs/core": "github:zoriya/v10#build26-core",
|
||||||
|
"@videojs/media": "github:zoriya/v10#build26-media",
|
||||||
|
"@videojs/react": "github:zoriya/v10#build26-react",
|
||||||
|
"@videojs/spf": "github:zoriya/v10#build26-spf",
|
||||||
|
"@videojs/store": "github:zoriya/v10#build26-store",
|
||||||
|
"@videojs/utils": "github:zoriya/v10#build26-utils",
|
||||||
"jassub": "^2.5.7",
|
"jassub": "^2.5.7",
|
||||||
"libpgs": "^0.8.1",
|
"libpgs": "^0.8.1",
|
||||||
},
|
},
|
||||||
@@ -723,15 +728,17 @@
|
|||||||
|
|
||||||
"@typescript/typescript-win32-x64": ["@typescript/typescript-win32-x64@7.0.2", "", { "os": "win32", "cpu": "x64" }, "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g=="],
|
"@typescript/typescript-win32-x64": ["@typescript/typescript-win32-x64@7.0.2", "", { "os": "win32", "cpu": "x64" }, "sha512-0BQ3HkAHHlKLSp1qRvf3SUhGpGsDuhB/jgFw75guyqbxJqEaS0Cw/VFO8i2nHglJUzQCRtMMR/IBAKE3ETMC4g=="],
|
||||||
|
|
||||||
"@videojs/core": ["@videojs/core@10.0.0-beta.25", "", { "dependencies": { "@videojs/spf": "10.0.0-beta.25", "@videojs/store": "10.0.0-beta.25", "@videojs/utils": "10.0.0-beta.25", "@vimeo/player": "^2.30.3", "dashjs": "^5.2.0", "hls.js": "^1.6.7", "mux-embed": "^5.17.10" } }, "sha512-Yxd6c+u7LrYl6aKzZRyR5PjDqUt1lUbgFwIhg6pMzI8bJszIGjLS7TDzXdALpEFJpM1Z08dbqCEzCGaMj7Eu6A=="],
|
"@videojs/core": ["@videojs/core@github:zoriya/v10#02a4769", { "peerDependencies": { "@videojs/media": "*", "@videojs/store": "*", "@videojs/utils": "*" } }, "zoriya-v10-02a4769", "sha512-eq79BQJ+e2Lx6k9tCW68vBolcJD3OynwgE7Y8pmI9gb+RWQAYJFLEY8B576ueKHhcgOOT/taerI/Wg3eqougSg=="],
|
||||||
|
|
||||||
"@videojs/react": ["@videojs/react@10.0.0-beta.25", "", { "dependencies": { "@videojs/core": "10.0.0-beta.25", "@videojs/spf": "10.0.0-beta.25", "@videojs/store": "10.0.0-beta.25", "@videojs/utils": "10.0.0-beta.25" }, "peerDependencies": { "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" } }, "sha512-MUG8NFntK3u4OTArwqG4utZ11HU1Ku5kzzTfTA2BMG5shNj7KWqPz0BMR2Nnv6hwEvcxpm9vwZxk+AwkmoB5jA=="],
|
"@videojs/media": ["@videojs/media@github:zoriya/v10#46507f9", { "dependencies": { "@vimeo/player": "^2.30.3", "dashjs": "^5.2.0", "hls.js": "^1.6.7", "mux-embed": "^5.17.10" }, "peerDependencies": { "@videojs/spf": "*", "@videojs/utils": "*" } }, "zoriya-v10-46507f9", "sha512-1f7jIP5KPGKo4NeyG+Q22eS7KhvYZam8yvG985Y9edCp7wFcrVcraEQwKJrESaa/GDNgeKIeEg05MZ+l+ZHftQ=="],
|
||||||
|
|
||||||
"@videojs/spf": ["@videojs/spf@10.0.0-beta.25", "", { "dependencies": { "@videojs/utils": "10.0.0-beta.25", "signal-polyfill": "^0.2.2" } }, "sha512-SETOzCPbSxuzCoX+bF2u7/Z80AA/Xwpqpy5ki//yslIyPxWkMT0GFydXdoZ/bJpNsBqGmDbDxEBDo1uMjnM4mQ=="],
|
"@videojs/react": ["@videojs/react@github:zoriya/v10#784a383", { "peerDependencies": { "@videojs/core": "*", "@videojs/media": "*", "@videojs/spf": "*", "@videojs/store": "*", "@videojs/utils": "*", "react": "^18.0.0 || ^19.0.0", "react-dom": "^18.0.0 || ^19.0.0" } }, "zoriya-v10-784a383", "sha512-wLuXUjLfhLNZAVSxCsTmpidN8DZPy6Us788vXDSRJKh/a6WDTCWV2op26EK3eCgeC1P8Hwc5s5cOEhqx2fGMRQ=="],
|
||||||
|
|
||||||
"@videojs/store": ["@videojs/store@10.0.0-beta.25", "", { "dependencies": { "@videojs/utils": "10.0.0-beta.25" }, "peerDependencies": { "@videojs/element": "10.0.0-beta.25", "react": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@videojs/element", "react"] }, "sha512-XvPC0+MQ6AZ/oKGpSzmjOM56aYESMpPsTg5zddBDXhcqeAOUxpEsXDqhU1rsm751tU4ZavGxHENx70lBOa5dUA=="],
|
"@videojs/spf": ["@videojs/spf@github:zoriya/v10#8920135", { "dependencies": { "signal-polyfill": "^0.2.2" }, "peerDependencies": { "@videojs/utils": "*" } }, "zoriya-v10-8920135", "sha512-jGXo5tyPpIk96XWksTKbWpi7POHzdt4KtvqDZ9+SDa+MOqLV3TcgM8soo6KO2jMnkv8d8APqaz+E27qfDf16kg=="],
|
||||||
|
|
||||||
"@videojs/utils": ["@videojs/utils@10.0.0-beta.25", "", {}, "sha512-tq/848qmzgTncopeYE5iiYs1Pfzj4OEdSe7zE2H6xoOB0PUMlnPOThA3aybHJ8Lh9bmw+wTb6QJ0NZanIzt2Zg=="],
|
"@videojs/store": ["@videojs/store@github:zoriya/v10#3f9bddd", { "peerDependencies": { "@videojs/element": "*", "@videojs/utils": "*", "react": "^18.0.0 || ^19.0.0" }, "optionalPeers": ["@videojs/element", "react"] }, "zoriya-v10-3f9bddd", "sha512-QjSGJ6EO6uoij41F7KgMKrNi5XjvXfkODOrn17wcFa6+Ig1+ftnckkNZsJ44bARdJ1XUkuj3wNyGidYMrmKRmQ=="],
|
||||||
|
|
||||||
|
"@videojs/utils": ["@videojs/utils@github:zoriya/v10#9fed1b6", {}, "zoriya-v10-9fed1b6", "sha512-ZgbMw3v41aEru0056VVwy0UtiZk8zq6Tm6ddRAJtm5VXz2nEf36CoejFFvmGICW5cQ2WWhvMQmtqCSr+HmYGIw=="],
|
||||||
|
|
||||||
"@vimeo/player": ["@vimeo/player@2.30.4", "", { "dependencies": { "native-promise-only": "0.8.1", "weakmap-polyfill": "2.0.4" } }, "sha512-M8m1UAhJSb+KCWuXDLWHViwj+3YY/0ogwFquRfMHs9e9LYjXT9iB7n+sOCKwUusbiXuU2HKmXx+FEGHtYZfUSg=="],
|
"@vimeo/player": ["@vimeo/player@2.30.4", "", { "dependencies": { "native-promise-only": "0.8.1", "weakmap-polyfill": "2.0.4" } }, "sha512-M8m1UAhJSb+KCWuXDLWHViwj+3YY/0ogwFquRfMHs9e9LYjXT9iB7n+sOCKwUusbiXuU2HKmXx+FEGHtYZfUSg=="],
|
||||||
|
|
||||||
|
|||||||
+6
-1
@@ -63,7 +63,12 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/config-plugins": "^57.0.3",
|
"@expo/config-plugins": "^57.0.3",
|
||||||
"@videojs/react": "10.0.0-beta.25",
|
"@videojs/core": "github:zoriya/v10#build26-core",
|
||||||
|
"@videojs/media": "github:zoriya/v10#build26-media",
|
||||||
|
"@videojs/react": "github:zoriya/v10#build26-react",
|
||||||
|
"@videojs/spf": "github:zoriya/v10#build26-spf",
|
||||||
|
"@videojs/store": "github:zoriya/v10#build26-store",
|
||||||
|
"@videojs/utils": "github:zoriya/v10#build26-utils",
|
||||||
"jassub": "^2.5.7",
|
"jassub": "^2.5.7",
|
||||||
"libpgs": "^0.8.1"
|
"libpgs": "^0.8.1"
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -59,7 +59,6 @@ export class WebOmniPlayer implements OmniPlayer {
|
|||||||
this._store.state.toggleRemotePlayback();
|
this._store.state.toggleRemotePlayback();
|
||||||
}
|
}
|
||||||
|
|
||||||
castOptions: CastOptions | null = null;
|
|
||||||
_source: Source | undefined = undefined;
|
_source: Source | undefined = undefined;
|
||||||
private _showNotification = false;
|
private _showNotification = false;
|
||||||
|
|
||||||
|
|||||||
+19
-5
@@ -1,4 +1,5 @@
|
|||||||
import { createPlayer } from "@videojs/react";
|
import { createPlayer } from "@videojs/react";
|
||||||
|
import { GoogleCast } from "@videojs/react/media/google-cast";
|
||||||
import { videoFeatures } from "@videojs/react/video";
|
import { videoFeatures } from "@videojs/react/video";
|
||||||
import {
|
import {
|
||||||
createContext,
|
createContext,
|
||||||
@@ -7,6 +8,7 @@ import {
|
|||||||
useEffect,
|
useEffect,
|
||||||
useRef,
|
useRef,
|
||||||
} from "react";
|
} from "react";
|
||||||
|
import { usePlayerState } from "./events";
|
||||||
import { WebOmniPlayer } from "./player.web";
|
import { WebOmniPlayer } from "./player.web";
|
||||||
import type { OmniPlayer, PlayerBackend } from "./types/player";
|
import type { OmniPlayer, PlayerBackend } from "./types/player";
|
||||||
import type { CastOptions, Source } from "./types/source";
|
import type { CastOptions, Source } from "./types/source";
|
||||||
@@ -67,15 +69,27 @@ const PlayerInitializer = ({
|
|||||||
}
|
}
|
||||||
}, [source, store]);
|
}, [source, store]);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
player.castOptions = cast ?? null;
|
|
||||||
}, [cast]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
player.showNotification = showNotification;
|
player.showNotification = showNotification;
|
||||||
}, [showNotification]);
|
}, [showNotification]);
|
||||||
|
|
||||||
return <PlayerCtx.Provider value={player}>{children}</PlayerCtx.Provider>;
|
return (
|
||||||
|
<PlayerCtx.Provider value={player}>
|
||||||
|
<CastBridge cast={cast} />
|
||||||
|
{children}
|
||||||
|
</PlayerCtx.Provider>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const CastBridge = ({ cast }: { cast?: CastOptions | null }) => {
|
||||||
|
const source = usePlayerState("source");
|
||||||
|
return (
|
||||||
|
<GoogleCast
|
||||||
|
receiver={cast?.receiverApplicationId}
|
||||||
|
src={source?.castId}
|
||||||
|
customData={source?.castData}
|
||||||
|
/>
|
||||||
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
export const usePlayer = () => useContext(PlayerCtx);
|
export const usePlayer = () => useContext(PlayerCtx);
|
||||||
|
|||||||
+2
-10
@@ -1,4 +1,4 @@
|
|||||||
import type { HlsMediaConfig } from "@videojs/core/dom/media/hls-js";
|
import type { HlsMediaConfig } from "@videojs/media/dom/hls-js";
|
||||||
import { HlsJsVideo } from "@videojs/react/media/hlsjs-video";
|
import { HlsJsVideo } from "@videojs/react/media/hlsjs-video";
|
||||||
import { Video } from "@videojs/react/video";
|
import { Video } from "@videojs/react/video";
|
||||||
import {
|
import {
|
||||||
@@ -106,7 +106,6 @@ export const OmniView = ({
|
|||||||
autoplay,
|
autoplay,
|
||||||
subtitleAssets,
|
subtitleAssets,
|
||||||
}: OmniViewProps & { style: CSSProperties }) => {
|
}: OmniViewProps & { style: CSSProperties }) => {
|
||||||
const player = usePlayer() as WebOmniPlayer;
|
|
||||||
const containerRef = useRef<HTMLDivElement>(null);
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
const ref = useRef<HTMLVideoElement>(undefined!);
|
const ref = useRef<HTMLVideoElement>(undefined!);
|
||||||
const source = usePlayerState("source");
|
const source = usePlayerState("source");
|
||||||
@@ -119,8 +118,6 @@ export const OmniView = ({
|
|||||||
|
|
||||||
const headersRef = useRef(source?.src?.headers);
|
const headersRef = useRef(source?.src?.headers);
|
||||||
headersRef.current = source?.src?.headers;
|
headersRef.current = source?.src?.headers;
|
||||||
const castId = source?.castId;
|
|
||||||
const castData = source?.castData;
|
|
||||||
|
|
||||||
const config = useMemo<HlsMediaConfig>(
|
const config = useMemo<HlsMediaConfig>(
|
||||||
() => ({
|
() => ({
|
||||||
@@ -133,13 +130,8 @@ export const OmniView = ({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
googleCast: {
|
|
||||||
receiver: player.castOptions?.receiverApplicationId,
|
|
||||||
customData: castData ?? null,
|
|
||||||
...(castId && { src: castId }),
|
|
||||||
},
|
|
||||||
}),
|
}),
|
||||||
[player.castOptions, castData, castId],
|
[],
|
||||||
);
|
);
|
||||||
|
|
||||||
// While casting, the receiver renders subtitles (the player forwards the
|
// While casting, the receiver renders subtitles (the player forwards the
|
||||||
|
|||||||
Reference in New Issue
Block a user