From 688d98d68f888a59bde1ee33aa844ac63c9026a5 Mon Sep 17 00:00:00 2001 From: Olivier Bouillet <62574056+freeboub@users.noreply.github.com> Date: Mon, 2 Sep 2024 15:42:51 +0200 Subject: [PATCH] fix(tvos): fix build (and update sample) (#4134) * fix(tvos): fix build (and update sample) --- examples/exampletvOS/ios/Podfile.lock | 10 +++++----- ios/Video/RCTVideo.swift | 23 ++++++++++++----------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/examples/exampletvOS/ios/Podfile.lock b/examples/exampletvOS/ios/Podfile.lock index 41c5f3da..d3b3675b 100644 --- a/examples/exampletvOS/ios/Podfile.lock +++ b/examples/exampletvOS/ios/Podfile.lock @@ -316,11 +316,11 @@ PODS: - React-jsinspector (0.71.12-0) - React-logger (0.71.12-0): - glog - - react-native-video (6.0.0): + - react-native-video (6.4.5): - RCT-Folly (= 2021.07.22.00) - React-Core - - react-native-video/Video (= 6.0.0) - - react-native-video/Video (6.0.0): + - react-native-video/Video (= 6.4.5) + - react-native-video/Video (6.4.5): - RCT-Folly (= 2021.07.22.00) - React-Core - React-perflogger (0.71.12-0) @@ -592,7 +592,7 @@ SPEC CHECKSUMS: React-jsiexecutor: 0c8c5e8b2171be52295f59097923babf84d1cf66 React-jsinspector: f8e6919523047a9bd1270ade75b4eca0108963b4 React-logger: 16c56636d4209cc204d06c5ba347cee21b960012 - react-native-video: fc60911540a69935cc7950829163f6f41259cb0d + react-native-video: fdcfbf66416475f8e122be9f7d72dd1d156ef3ed React-perflogger: 355109dc9d6f34e35bc35dabb32310f8ed2d29a2 React-RCTActionSheet: 9d1be4d43972f2aae4b31d9e53ffb030115fa445 React-RCTAnimation: aab7e1ecd325db67e1f2a947d85a52adf86594b7 @@ -609,6 +609,6 @@ SPEC CHECKSUMS: Yoga: 8b8c06e142662150974d1c70b4c5ffb08eb468db YogaKit: 1e22bf2228b3a5ac8cc88965153061ae92c494b5 -PODFILE CHECKSUM: 26d254806a611a4bc6b6c39cff790dd08f770ccf +PODFILE CHECKSUM: e20830ba1d59fa52a9075c08861e37e5f2ac113c COCOAPODS: 1.15.2 diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index e735d5d4..5acc616f 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -498,18 +498,19 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH NowPlayingInfoCenterManager.shared.registerPlayer(player: _player!) } } else { - if #available(iOS 16.0, *) { - // This feature caused crashes, if the app was put in bg, before the source change - // https://github.com/TheWidlarzGroup/react-native-video/issues/3900 - self._playerViewController?.allowsVideoFrameAnalysis = false - } - + #if !os(tvOS) + if #available(iOS 16.0, *) { + // This feature caused crashes, if the app was put in bg, before the source change + // https://github.com/TheWidlarzGroup/react-native-video/issues/3900 + self._playerViewController?.allowsVideoFrameAnalysis = false + } + #endif _player?.replaceCurrentItem(with: playerItem) - - if #available(iOS 16.0, *) { - self._playerViewController?.allowsVideoFrameAnalysis = true - } - + #if !os(tvOS) + if #available(iOS 16.0, *) { + self._playerViewController?.allowsVideoFrameAnalysis = true + } + #endif // later we can just call "updateNowPlayingInfo: NowPlayingInfoCenterManager.shared.updateNowPlayingInfo() }