From 7b6b84c8cbb8ec4f1cc8dca53d2b4cb5067576a8 Mon Sep 17 00:00:00 2001 From: Konstantin Date: Fri, 6 Oct 2023 18:42:53 +0200 Subject: [PATCH] fix(tvOS): compile issues with tvOS linked to earpiece & pip (#3276) --- ios/Video/RCTVideo.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ios/Video/RCTVideo.swift b/ios/Video/RCTVideo.swift index f75ec0dd..927b7064 100644 --- a/ios/Video/RCTVideo.swift +++ b/ios/Video/RCTVideo.swift @@ -580,7 +580,9 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH _audioOutput = audioOutput do { if audioOutput == "speaker" { + #if os(iOS) try AVAudioSession.sharedInstance().overrideOutputAudioPort(AVAudioSession.PortOverride.speaker) + #endif } else if audioOutput == "earpiece" { try AVAudioSession.sharedInstance().overrideOutputAudioPort(AVAudioSession.PortOverride.none) } @@ -821,7 +823,9 @@ class RCTVideo: UIView, RCTVideoPlayerViewControllerDelegate, RCTPlayerObserverH viewController.view.frame = self.bounds viewController.player = player - viewController.allowsPictureInPicturePlayback = true + if #available(tvOS 14.0, *) { + viewController.allowsPictureInPicturePlayback = true + } return viewController }