I'm trying to use AVMutableComposition in a nested hierarchy. Therefor I have to put a composition into an other composition. Doing so results into the following error message:
AVCompositionTest[45347:10703] comp2 >>> The operation could not be completed
I used the following code snipped.
AVAsset *audioAsset = [AVAsset assetWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"02 Undefined" ofType:@"mp3"]]];
AVMutableComposition *comp1 = [AVMutableComposition composition];
BOOL success = YES;
NSError *error = nil;
success = [comp1 insertTimeRange:CMTimeRangeMake(kCMTimeZero, audioAsset.duration)
ofAsset:audioAsset
atTime:kCMTimeZero
error:&error];
if (!success) {
NSLog(@"comp1 >>> %@", [error localizedDescription]);
}
AVMutableComposition *comp2 = [AVMutableComposition composition];
success = [comp2 insertTimeRange:CMTimeRangeMake(kCMTimeZero, audioAsset.duration)
ofAsset:comp1
atTime:kCMTimeZero
error:&error];
if (!success) {
NSLog(@"comp2 >>> %@", [error localizedDescription]);
}
Is it possible to nest compositions?
It is not possible to nest AVMutableComposition
assets.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With