如何解决AVPlayerViewController滑动UISwipeGestureRecognizer.up不起作用Xcode 12 tvOS 14
我们刚刚将Xcode更新到了版本12,除其他外,我们发现将UISwipeGestureRecognizer.up设置为AVPlayerViewController时遇到了问题。我们使用该手势来显示自定义频道更改器视图。它正在Xcode 11.7和tvOS 13上工作的主要问题。
此外,我已经调试了AVPlayerViewController.view的gestureRecognisers,并且没有UISwipeGestureRecognizer。
这是我正在使用的代码
import UIKit
import AVKit
class ViewController: UIViewController {
private var playerViewController: AVPlayerViewController? {
didSet {
guard let playerViewController = playerViewController else {
return
}
playerViewController.view.isUserInteractionEnabled = true
let swipeGesture = UISwipeGestureRecognizer(target: self,action: #selector(testGestureResponse))
//swipeGesture.direction = .up // Not working
//swipeGesture.direction = .left
//swipeGesture.direction = .down
swipeGesture.direction = .right
playerViewController.view.addGestureRecognizer(swipeGesture)
}
}
override func viewDidLoad() {
super.viewDidLoad()
playerViewController = AVPlayerViewController()
let playerViewController = self.playerViewController!
playerViewController.willMove(toParent: self)
view.addSubview(playerViewController.view)
playerViewController.view.frame = view.frame
addChild(playerViewController)
playerViewController.didMove(toParent: self)
playerViewController.player = AVPlayer(url: URL(string: "https://devstreaming-cdn.apple.com/videos/streaming/examples/bipbop_adv_example_hevc/master.m3u8")!)
playerViewController.player?.play()
}
@objc func testGestureResponse(gesture: UIGestureRecognizer) {
print("Hello!!!")
}
}
现在有其他方法吗?
解决方法
tvOS 13中引入了AVPlayerViewController.CustomOverlayViewController,并且显然是tvOS 14中引入的。如果要在向上滑动时添加通道充电器(或任何其他视图),则:
double a = 10.85
int b = int(a)
return a - b
资源
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。