我正在尝试使用Swift嵌入视频播放器。当我运行应用程序时,我可以看到视频播放器,但没有播放视频。请你检查一下有什么遗漏的地方吗?提前致谢。
var playerItem: AVPlayerItem?
var player: AVPlayer?
if let videoLink = newLaunch.videoLinks where newLaunch.videoLinks!.count > 0{
let videoUrl = videoLink[0]
let streamingURL: NSURL = NSURL(fileURLWithPath: videoUrl)
player = AVPlayer(URL: streamingURL)
let playerController = AVPlayerViewController()
playerController.player = player
self.addChildViewController(playerController)
self.videoContainerView.addSubview(playerController.view)
playerController.view.frame = self.videoContainerView.bounds
player!.play()
}