Open remote on clicking cast notification

This commit is contained in:
2026-08-15 13:41:36 +02:00
parent 5af6a84b31
commit c7b0a8f38d
4 changed files with 30 additions and 3 deletions
+2 -2
View File
@@ -46,7 +46,7 @@
"react-native-localization-settings": "^1.2.0",
"react-native-mmkv": "^4.3.1",
"react-native-nitro-modules": "^0.35.7",
"react-native-omni": "^1.11.10",
"react-native-omni": "^1.12.2",
"react-native-pager-view": "8.0.2",
"react-native-reanimated": "4.5.0",
"react-native-safe-area-context": "~5.7.0",
@@ -1279,7 +1279,7 @@
"react-native-nitro-modules": ["react-native-nitro-modules@0.35.10", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-KsySOAIkbSTjNiX2GvXiNT9P5DMeZd99yvtE/+Lw7RXV7Ztxh9Z+YyAbYkBqadhN5J/KXXuPjhRYgyLOIZgsbQ=="],
"react-native-omni": ["react-native-omni@1.11.10", "", { "dependencies": { "@expo/config-plugins": "^57.0.3", "@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", "libpgs": "^0.8.1" }, "peerDependencies": { "react": ">=19.0.0", "react-native": ">=0.86.0", "react-native-nitro-modules": ">=0.36.0" } }, "sha512-kV5jHQFaMV2Cy131UxdSIffS37PeoVBgvyc9Z3YDU1KK/smtqHQQ099vzcZOn+oayJrzq0n1s9kYVDYC0lrTSA=="],
"react-native-omni": ["react-native-omni@1.12.2", "", { "dependencies": { "@expo/config-plugins": "^57.0.3", "@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", "libpgs": "^0.8.1" }, "peerDependencies": { "react": ">=19.0.0", "react-native": ">=0.86.0", "react-native-nitro-modules": ">=0.36.0" } }, "sha512-W1n23oIJ/QWRrTVeL9V4UbJn8AlVxliCo1uJJYz9qaeFbiQvj9431neUucvqt1JDrfNDXCPRTK8lr7vi9jRiIw=="],
"react-native-pager-view": ["react-native-pager-view@8.0.2", "", { "peerDependencies": { "react": "*", "react-native": "*" } }, "sha512-Y8All2BbjidI4ZIF9kBOIIoldkqrY/2FXapHZMdjwD+ByXhiOWTFenPs5rq9KRN5uAH/gOXtQCqHLxQDNBQRiQ=="],
+1 -1
View File
@@ -58,7 +58,7 @@
"react-native-localization-settings": "^1.2.0",
"react-native-mmkv": "^4.3.1",
"react-native-nitro-modules": "^0.35.7",
"react-native-omni": "^1.11.10",
"react-native-omni": "^1.12.2",
"react-native-pager-view": "8.0.2",
"react-native-reanimated": "4.5.0",
"react-native-safe-area-context": "~5.7.0",
+26
View File
@@ -0,0 +1,26 @@
import { Redirect } from "expo-router";
import { useEffect, useState } from "react";
import { View } from "react-native";
import { usePlayerState } from "react-native-omni";
import { Spinner } from "~/primitives";
export default function Remote() {
const source = usePlayerState("source");
const slug = source?.castId?.match(/\/videos\/([^/?]+)/)?.[1];
// on a cold start the media comes from the receiver, which takes a moment to reach
// us. don't stay stuck on the spinner if it never does (nothing playing anymore).
const [gaveUp, setGaveUp] = useState(false);
useEffect(() => {
const timeout = setTimeout(() => setGaveUp(true), 10_000);
return () => clearTimeout(timeout);
}, []);
if (gaveUp) return <Redirect href="/" />;
if (slug) return <Redirect href={`/watch/${slug}`} />;
return (
<View className="flex-1 items-center justify-center bg-black">
<Spinner />
</View>
);
}
+1
View File
@@ -29,6 +29,7 @@ const PlayerProvider = ({ children }: { children: ReactNode }) => {
cast={{
receiverApplicationId:
process.env.EXPO_PUBLIC_CAST_APPLICATION_ID ?? "D8FB0FC1",
notificationUrl: "kyoo:///remote",
}}
showNotification
>