First of all, I have to say that I like this forum, it has helped me so much time. I have a problem and I could not find the answer anywhere, so this is my first question.
My problem is this:
I have a video presented by AVPlayerItem, the user can edit the start time of the video using the cutBefore button, which cuts the video to the left of the slider.
The method responsible for cutting the video is as follows:
- (void)CutBeforeAction { AVMutableComposition *composition = [AVMutableComposition composition];
}
When you run the - (void)cutBefore for the first time, it works fine when I run it a second time (the video has already been edited once)
[compositionVideoTrack insertTimeRange:range ofTrack:[[_player.currentItem.asset tracksWithMediaType:AVMediaTypeVideo] objectAtIndex:0] atTime:kCMTimeZero error:&error];
and
[compositionAudioTrack insertTimeRange:range ofTrack:[[_player.currentItem.asset tracksWithMediaType:AVMediaTypeAudio] objectAtIndex:0] atTime:kCMTimeZero error:&error];
Methods
returned with the following error:
The operation could not be completed. (OSStatus error -12780.)
I tried to find the error code but did not find anything.
thanks for the help
source share