I have an app that allows a user to record a video in a mutable composition. I'd like to set some text that will come up and then change at an interval that I set when the user plays it back after an export.
For example, if the first word is "dog", then i'd like to set it up so that "cat" replaces that string X seconds later, and then is replaced with another word X seconds later.
My video is exported from an AVMutableComposition using AVExportSession and my words will be added using a CATextlayer added to it like so:
//code to setup AVMutableComposition
...
//code to setup CATextLayer and AVMutableVideoComposition
CALayer *animatedTitleLayer = [CALayer layer];
CATextLayer *titleLayer = [[CATextLayer alloc] init];
titleLayer.string = @"Text I want to change at an interval";
titleLayer.alignmentMode = kCAAlignmentCenter;
titleLayer.bounds = CGRectMake(150, 50, 124, 354);
titleLayer.position = CGPointMake(120, 270);
titleLayer.bounds = CGRectIntegral(CGRectMake(0, 0, 250, 150));
titleLayer.opacity = 1;
titleLayer.backgroundColor = [UIColor purpleColor].CGColor;
[animatedTitleLayer addSublayer:titleLayer];
animatedTitleLayer.position = CGPointMake(40, 5);
CALayer *parentLayer = [CALayer layer];
CALayer *videoLayer = [CALayer layer];
parentLayer.frame = CGRectMake(0, 0, 320, 480);
videoLayer.frame = CGRectMake(0, 0, 320, 480);
[parentLayer addSublayer:videoLayer];
[parentLayer addSublayer:animatedTitleLayer];
parentLayer.preferredTransform = rotationTransform;
AVMutableVideoComposition *videoComposition;
videoComposition = [AVMutableVideoComposition videoComposition];
videoComposition.animationTool = [AVVideoCompositionCoreAnimationTool videoCompositionCoreAnimationToolWithPostProcessingAsVideoLayer:videoLayer inLayer:parentLayer];
//code to setup AVExportSession
...
My question is: how can I make the text change to at an interval that I set to strings that I designate?
Any suggestions would be greatly appreciated.