我有一个AVPlayerViewController播放直播内容的实例,我将其作为子视图添加到我的viewController视图中.
切换AVPlayerViewController到全屏模式并点击完成按钮退出全屏后,播放器停止播放.
完成按钮动作后有没有办法让玩家继续玩?
我想用 AVPlayer 播放 YouTube 视频。
这是我的代码:
let playerItem = AVPlayerItem(asset: AVAsset(url:URL(string: "https://www.youtube.com/watch?v=xxxxxxxxx")!))
player = AVPlayer(playerItem : playerItem)
playerLayer = AVPlayerLayer(player: player)
playerLayer.frame = self.view.bounds
player.play()
Run Code Online (Sandbox Code Playgroud)
将AVPlayerItemStatus传递到与此错误失败:
Error Domain=AVFoundationErrorDomain Code=-11850 "Operation Stopped" UserInfo={NSUnderlyingError=0x1702443e0 {Error Domain=NSOSStatusErrorDomain Code=-12939 "(null)"}, NSLocalizedFailureReason=The server is not correctly configured., NSLocalizedDescription=Operation Stopped}
Run Code Online (Sandbox Code Playgroud)
有人能帮我解决这个问题吗?
PS:当我改变AVPlayer到AVQueuePlayer它的工作原理!
没有为嵌入到容器视图中的视图控制器调用 preferredFocusEnvironments
对于这些情况,还有其他事情要做吗?
我需要指定哪个单元格应该获得焦点.
根据Apple文档,indexPathForPreferredFocusedView如果remembersLastFocusedIndexPath属性是false,或者如果没有保存的索引路径,则应调用委托方法,因为之前没有单元格.
在我的情况下,我在a中使用集合视图UIViewController并设置remembersLastFocusedIndexPath为false但indexPathForPreferredFocusedView未被调用.
怎么解释这个行为?