Iphone 如何在两个marge视频之间设置CMTimeRange?
我想播放marge视频,但有一段时间先播放,然后第二次播放被打断到第一个视频Iphone 如何在两个marge视频之间设置CMTimeRange?,iphone,objective-c,ios5,avfoundation,Iphone,Objective C,Ios5,Avfoundation,我想播放marge视频,但有一段时间先播放,然后第二次播放被打断到第一个视频 CMTimeRange timeRange = CMTimeRangeMake(kCMTimeZero, CMTimeMakeWithSeconds(30, 10)); AVMutableVideoCompositionLayerInstruction *to = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionW
CMTimeRange timeRange = CMTimeRangeMake(kCMTimeZero, CMTimeMakeWithSeconds(30, 10));
AVMutableVideoCompositionLayerInstruction *to = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:compositionCommentaryTrack];
[to setOpacity:.5 atTime:kCMTimeZero];
[to setTransform:CGAffineTransformScale(compositionCommentaryTrack.preferredTransform, .5, .5) atTime:kCMTimeZero];
AVMutableVideoCompositionLayerInstruction *from = [AVMutableVideoCompositionLayerInstruction videoCompositionLayerInstructionWithAssetTrack:compositionVideoTrack];
[from setOpacity:.5 atTime:kCMTimeZero];
[from setTransform:CGAffineTransformScale(compositionVideoTrack.preferredTransform, .6, .6) atTime:kCMTimeZero];
// Video Compostion
AVMutableVideoCompositionInstruction *transition = [AVMutableVideoCompositionInstruction videoCompositionInstruction];
transition.backgroundColor = [[UIColor clearColor] CGColor];
transition.timeRange = timeRange;
transition.layerInstructions = [NSArray arrayWithObjects:to, from, nil];
videoComposition.instructions = [NSArray arrayWithObjects:transition, nil];
videoComposition.frameDuration = CMTimeMake(1, 30);
videoComposition.renderSize = CGSizeMake(320, 360);
videoComposition.renderScale = 1.0;