我想使用AVPlayerController
播放视频的特定部分。但不知道怎么玩。这是我的代码
func playVideoMethod(path:URL) {
avpController = AVPlayerViewController()
avpController.player = AVPlayer.init(url: path)
avpController.view.frame = self.playerView.bounds
avpController.showsPlaybackControls = false
let translate = CGAffineTransform(rotationAngle: CGFloat(Int(M_PI/18.0)))
avpController.view.transform = translate
self.playerView.addSubview(avpController.view)
self.playerView.autoresizesSubviews = true
avpController.player?.play()
}
答案 0 :(得分:1)
您可以对代码进行修改:
let item = AVPlayerItem(url: path)
let player = AVPlayer(playerItem: item)
player.seek(to: CMTime(... // add time what you want to start from
item.forwardPlaybackEndTime = CMTime(... // add preferred end time
avpController.player = player
答案 1 :(得分:0)
SaveAsUI