0
我想要什麼,基本上扭轉了AVAsset和輸出的視頻文件,我發現這個鏈接 - https://github.com/tempire/ReverseAVAsset/blob/master/AVAsset.swift播放視頻向後
這是我做過什麼:
import UIKit
import AVFoundation
import AVKit
class ViewController: UIViewController {
var playerViewController = AVPlayerViewController()
var playerView = AVPlayer()
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
let path = Bundle.main.path(forResource: "video", ofType: "mov")
let outputUrl = URL(fileURLWithPath: "\(NSUUID().uuidString)video.mov")
let originalAsset = AVAsset(url: URL(fileURLWithPath: path!))
let reversedAsset = originalAsset.reversedAsset(outputUrl)
playerView = AVPlayer(playerItem: AVPlayerItem(asset: reversedAsset!))
playerViewController.player = playerView
present(playerViewController, animated: true) {
self.playerViewController.player?.play()
}
}
}
但其沒有工作,這是我結束了:
我覺得我做的事情錯outputURL,請幫助,如果你知道該怎麼做
是什麼扭轉了AVAsset和輸出的視頻文件指的是正確的方法是什麼? –
拍攝視頻並將其倒轉@ElTomato –
向後播放視頻@ElTomato –