From c814be51f82117104b1bc8cd76777711e43b84dd Mon Sep 17 00:00:00 2001 From: Marius456 Date: Fri, 15 Mar 2024 15:05:03 +0200 Subject: [PATCH] fix cast dependencies --- packages/app-harness/package.json | 3 ++- packages/app-harness/renative.json | 5 +++++ packages/app-harness/src/app/index.tsx | 4 ++-- .../CastButton/index.native.mobile.tsx | 17 +++++++++++++++-- .../src/components/CastButton/index.tsx | 2 +- .../supportFiles/AndroidManifest_android.json | 5 +++++ yarn.lock | 8 ++++---- 7 files changed, 34 insertions(+), 10 deletions(-) diff --git a/packages/app-harness/package.json b/packages/app-harness/package.json index cc730db425..84d89f12b5 100644 --- a/packages/app-harness/package.json +++ b/packages/app-harness/package.json @@ -56,7 +56,8 @@ "react-native-photo-editor": "1.0.13", "react-native-splash-screen": "3.3.0", "react-native-tvos": "0.73.1-3", - "react-native-web": "0.19.9" + "react-native-web": "0.19.9", + "react-native-google-cast": "4.6.0" }, "devDependencies": { "@flexn/assets-renative-outline": "0.3.3", diff --git a/packages/app-harness/renative.json b/packages/app-harness/renative.json index e16ab72834..0902774a5a 100644 --- a/packages/app-harness/renative.json +++ b/packages/app-harness/renative.json @@ -198,6 +198,11 @@ "android": { "implementation": "// TEST" } + }, + "react-native-google-cast": { + "android": { + "implementation": "// TEST" + } } }, diff --git a/packages/app-harness/src/app/index.tsx b/packages/app-harness/src/app/index.tsx index 98f99b2889..c9db83c0fb 100644 --- a/packages/app-harness/src/app/index.tsx +++ b/packages/app-harness/src/app/index.tsx @@ -8,7 +8,7 @@ import styles from '../styles'; import { addNotificationListeners, removeNotificationListeners } from '../components/Notifications'; import { requestPermissions } from '../components/Permissions'; import { TestCase } from '../components/TestCase'; -import { CastButton } from '../components/CastButton'; +import { CastComponent } from '../components/CastButton'; const App = () => { const [showVideo, setShowVideo] = useState(false); @@ -79,7 +79,7 @@ const App = () => { - + diff --git a/packages/app-harness/src/components/CastButton/index.native.mobile.tsx b/packages/app-harness/src/components/CastButton/index.native.mobile.tsx index d07eda114d..75fbb3cfb2 100644 --- a/packages/app-harness/src/components/CastButton/index.native.mobile.tsx +++ b/packages/app-harness/src/components/CastButton/index.native.mobile.tsx @@ -1,3 +1,16 @@ -import { CastButton } from 'react-native-google-cast'; +import React from 'react'; +import { CastButton, useRemoteMediaClient } from 'react-native-google-cast'; -export { CastButton }; +export function CastComponent() { + const client = useRemoteMediaClient(); + + if (client) { + client.loadMedia({ + mediaInfo: { + contentUrl: 'http://localhost:8095', + }, + }); + } + + return ; +} diff --git a/packages/app-harness/src/components/CastButton/index.tsx b/packages/app-harness/src/components/CastButton/index.tsx index a343e2b928..b1b5d14d97 100644 --- a/packages/app-harness/src/components/CastButton/index.tsx +++ b/packages/app-harness/src/components/CastButton/index.tsx @@ -1,5 +1,5 @@ import { Text } from 'react-native'; -export const CastButton = () => { +export const CastComponent = () => { return Not supported; }; diff --git a/packages/sdk-android/supportFiles/AndroidManifest_android.json b/packages/sdk-android/supportFiles/AndroidManifest_android.json index 8041a1e147..20abb1f769 100644 --- a/packages/sdk-android/supportFiles/AndroidManifest_android.json +++ b/packages/sdk-android/supportFiles/AndroidManifest_android.json @@ -73,6 +73,11 @@ { "tag": "activity", "android:name": "com.facebook.react.devsupport.DevSettingsActivity" + }, + { + "tag": "meta-data", + "android:name": "com.google.android.gms.cast.framework.OPTIONS_PROVIDER_CLASS_NAME", + "android:value": "com.reactnative.googlecast.GoogleCastOptionsProvider" } ] } diff --git a/yarn.lock b/yarn.lock index 43e6b83bae..2be6393d4f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -17935,10 +17935,10 @@ react-native-gesture-handler@2.14.1: lodash "^4.17.21" prop-types "^15.7.2" -react-native-google-cast@4.8.0: - version "4.8.0" - resolved "https://registry.yarnpkg.com/react-native-google-cast/-/react-native-google-cast-4.8.0.tgz#7af427bc8a44d1da62e6d2238c3c74136d098297" - integrity sha512-1BjHueIWO5NvR9VjJLeB8SvC8cidTJaZopztI8KbBc64GIiF9jWcfoV/MGK+IRsBZ9E8mDJ2syJmS+AAqgWiEA== +react-native-google-cast@4.6.0: + version "4.6.0" + resolved "https://registry.yarnpkg.com/react-native-google-cast/-/react-native-google-cast-4.6.0.tgz#5b8e8e8424a9fe5873d48299cc04ff04b377d1ef" + integrity sha512-YZP2muHAq0XtfwldJ4ztSPq51n1mEUoGfz5n/jUyg9hTRsawyOC+1wedzL1lVwJvCuspPEyl631v90/2S8BJFg== react-native-orientation-locker@1.5.0: version "1.5.0"