現在以下のコード(swift4)で、動画を再生しているのですが、
再生速度を変更したいです。
どう書けばいいか教えてもらえないでしょうか?
swift4
1 2 func play(){ 3 // パスからassetを生成. 4 let path = Bundle.main.path(forResource: "aaa", ofType: "mp4") 5 let fileURL = NSURL(fileURLWithPath: path!) 6 let avAsset = AVAsset(url: fileURL as URL) 7 8 let screenWidth:CGFloat = view.frame.size.width 9 10 // AVPlayerに再生させるアイテムを生成. 11 playerItem = AVPlayerItem(asset: avAsset) 12 13 // AVPlayerを生成. 14 videoPlayer = AVPlayer(playerItem: playerItem) 15 16 playerLayer = AVPlayerLayer(player: videoPlayer) 17 playerLayer?.videoGravity = AVLayerVideoGravity.resizeAspectFill 18 19 //サイズを決める 20 playerLayer?.frame = CGRect(x:0, y:view.frame.size.height-screenWidth/2-20, width:self.view.frame.size.width, height:300) 21 self.view.layer.addSublayer(playerLayer!) 22 videoPlayer.play() 23}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2018/05/26 11:41
2018/05/26 13:30 編集
2018/05/27 02:44