在按钮的@IBAction中使用此代码,视频播放器将打开,但仅显示黑屏。我不知道为什么。谢谢
Release
答案 0 :(得分:0)
尝试更改 UIwindowLevel ,也许在播放器级别上方会出现一个视图
if let path = Bundle.main.path(forResource: "Timelapse Stabilizzata", ofType: "mov") {
let video = AVPlayer(url: URL(fileURLWithPath: path))
let videoPlayer = AVPlayerViewController()
videoPlayer.view.window?.windowLevel = 0
videoPlayer.player = video
present(videoPlayer, animated: true, completion: {
video.play()
})
}