Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG]: updatesNowPlayingInfoCenter' is unavailable in tvOS when using react-native-video in react-native-tvos App #3779

Closed
jijithjv opened this issue May 16, 2024 · 4 comments · Fixed by #3785
Assignees
Labels

Comments

@jijithjv
Copy link

Version

6.0.0

What platforms are you having the problem on?

Apple tvOS

Architecture

New architecture with interop layer

What happened?

When I am trying to run the project on tvOS, I am getting a build failed error. The error 'updatesNowPlayingInfoCenter' is unavailable in tvOS is occurring because the react-native-video library is attempting to set the updatesNowPlayingInfoCenter property on the RCTVideoPlayerViewController class, which is not available or supported on the tvOS platform. It was working well when using react native video 5.2.1

MY Package JSON


{
  "name": "searchbox",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web",
    "start": "expo start",
    "tvos": "expo run:ios --scheme SearchBox-tvOS --device \"Apple TV\"",
    "lint": "eslint .",
    "test": "jest"
  },
  "dependencies": {
    "@react-navigation/native": "^6.1.17",
    "expo": "^50.0.2",
    "react": "18.2.0",
    "react-native": "npm:react-native-tvos@^0.73.2-0",
    "react-native-safe-area-context": "^4.10.1",
    "react-native-screens": "^3.31.1",
    "react-native-video": "^6.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0",
    "@babel/preset-env": "^7.20.0",
    "@babel/runtime": "^7.20.0",
    "@react-native/babel-preset": "^0.73.19",
    "@react-native/eslint-config": "^0.73.2",
    "@react-native/metro-config": "^0.73.3",
    "@react-native/typescript-config": "^0.73.1",
    "@types/react": "^18.2.6",
    "@types/react-test-renderer": "^18.0.0",
    "babel-jest": "^29.6.3",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "18.2.0",
    "typescript": "5.0.4"
  },
  "engines": {
    "node": ">=18"
  }
}

Xcode Version 15.3

Reproduction

repository link

Reproduction

  1. Initialize a new React Native project for tvOS with TypeScript using the official tvOS template:
yarn create react-native-app TestApp --template https://github.com/react-native-tvos/react-native-template-typescript-tv/tree/tv-release-0.73.0 --template-path template
cd TestApp
  1. Install react-native-video by running yarn add react-native-video.

  2. Navigate to the ios folder and run pod install to install the required iOS dependencies.

  3. In Xcode, open the project's tvOS target and go to the "General" tab. Under the "Linked Frameworks and Libraries" section, add libreact-native-video.a.

  4. Build the app for tvOS using the Expo CLI command:

yarn tvos ("expo run:ios --scheme SearchBox-tvOS --device \"Apple TV\"")

After following these steps, you should encounter the same error: 'updatesNowPlayingInfoCenter' is unavailable in tvOS when attempting to build the app for the tvOS platform using the Expo CLI command.

@jijithjv jijithjv added the bug label May 16, 2024
@freeboub
Copy link
Collaborator

Did you try to wrap this line with something like:

if #available(tvOS 9.0, *) {

According to doc it should be available since tvOS 9.0...
https://developer.apple.com/documentation/avkit/avplayerview/updatesnowplayinginfocenter

@freeboub
Copy link
Collaborator

A patch fixing this issue has been proposed !

@jijithjv
Copy link
Author

jijithjv commented May 16, 2024

HI @freeboub ,
Thanks for Replying and for the patch
In RCTVideo.swift file I commented Out this line
" viewController.updatesNowPlayingInfoCenter = false""
And rebuild the project now it's works. I don't know whether it's the right solution. For now it works without any issued

@freeboub
Copy link
Collaborator

@jijithjv no it comes from a recent change, you can keep it commented with patch-package temporary. It should cause any side effect on tvos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants