我正在使用AVPlayerViewController
将视频嵌入我的UIView
:
class MyView : PopupContentView {
var player : AVPlayer!;
var playerViewController: AVPlayerViewController!;
override func awakeFromNib() {
}
override func setupView() {
super.setupView();
self.setupVideo();
}
deinit {
self.player.pause();
self.player = nil;
}
func setupVideo() {
let path = Bundle.main.path(forResource: "Lebensqualitaet", ofType:"mp4")
let url = URL(fileURLWithPath: path!)
self.player = AVPlayer(url: url);
self.playerViewController = AVPlayerViewController();
self.playerViewController.player = self.player;
self.callbacks.getAVCallbacks()?.setAVPlayerReference(player: self.playerViewController.player!);
self.callbacks.getViewControllerToPresent().addChildViewController(self.playerViewController);
self.addSubview(self.playerViewController.view);
self.playerViewController.view.frame = self.frame;
}
}
在此AVPlayerViewController
中,有一个按钮可将视频设置为全屏。是否可以禁用此按钮?我的问题是,如果视频设置为全屏,然后再次禁用全屏,整个视图将关闭,我不知道为什么。这就是为什么我只想禁用全屏模式。