我正在尝试在 ios 应用程序上从本地文件系统播放 mp4 视频。视频长约一个小时,可以在 quicktime 上播放。如果它来自网络(NSURL(字符串:“http:domain.com/vid.mp4”)),我可以播放 mp4。我正在播放如下视频:
let steamingURL:NSURL = NSURL(string: video.filePath)! //valid path
let player = AVPlayer(URL: steamingURL)
player.allowsExternalPlayback = false
PlayWorkoutViewController.playerController = AVPlayerViewController()
PlayWorkoutViewController.playerController.player = player
self.addChildViewController(PlayWorkoutViewController.playerController)
self.view.addSubview(PlayWorkoutViewController.playerController.view)
PlayWorkoutViewController.playerController.view.frame = videoContainerView.frame
PlayWorkoutViewController.playerController.showsPlaybackControls = false
player.play()
我是否需要更改某些设置才能播放较长的视频?谢谢。