Cant see Video Preview in TrimmerView
somasharma95 opened this issue · 1 comments
Hi,
I have used trimmer view and delegates in my project and successfully trimming my video, the only issue is I cant see video preview in trim view.
Following is my code
let asset = AVAsset(url: videoURL)
let firstPlayerItem = AVPlayerItem(asset: asset)
trimmerView.asset = asset
trimmerView.delegate = self
I am using both the delegates as well :--
func didChangePositionBar(_ playerTime: CMTime) {
player?.seek(to: playerTime, toleranceBefore: kCMTimeZero, toleranceAfter: kCMTimeZero)
player?.play()
startPlaybackTimeChecker()
}
func positionBarStoppedMoving(_ playerTime: CMTime) {
stopPlaybackTimeChecker()
player?.pause()
player?.seek(to: playerTime, toleranceBefore: kCMTimeZero, toleranceAfter: kCMTimeZero)
let duration = (trimmerView.endTime! - trimmerView.startTime!).seconds
print(duration)
}
You need to add your own AVPlayer
to have the video preview. This library only contains the trimmer element, so that it can be inserted in various contexts.
You can check the VideoTrimmerViewController
class in the example app for a working example.