- (void) setPasterList:(NSArray *)pasterList;// The `TXPaster` parameters are as follows:@interface TXPaster: NSObject@property (nonatomic, strong) UIImage* pasterImage; // Sticker image@property (nonatomic, assign) CGRect frame; // Sticker frame (please note that the frame coordinates here are relative to the rendering view)@property (nonatomic, assign) CGFloat startTime; // Sticker start time in s@property (nonatomic, assign) CGFloat endTime; // Sticker end time in s@end
- (void) setAnimatedPasterList:(NSArray *)animatedPasterList;// The `TXAnimatedPaster` parameters are as follows:@interface TXAnimatedPaster: NSObject@property (nonatomic, strong) NSString* animatedPasterpath; // Animated image file path@property (nonatomic, assign) CGRect frame; // Animated image frame (please note that the frame coordinates here are relative to the rendering view)@property (nonatomic, assign) CGFloat rotateAngle; // Animated image rotation angle. Value range: 0–360@property (nonatomic, assign) CGFloat startTime; // Animated image start time in s@property (nonatomic, assign) CGFloat endTime; // Animated image end time in s@end
- (void)setVideoPasters:(NSArray*)videoPasterInfos{NSMutableArray* animatePasters = [NSMutableArray new];NSMutableArray* staticPasters = [NSMutableArray new];for (VideoPasterInfo* pasterInfo in videoPasterInfos) {if (pasterInfo.pasterInfoType == PasterInfoType_Animate) {TXAnimatedPaster* paster = [TXAnimatedPaster new];paster.startTime = pasterInfo.startTime;paster.endTime = pasterInfo.endTime;paster.frame = [pasterInfo.pasterView pasterFrameOnView:_videoPreview];paster.rotateAngle = pasterInfo.pasterView.rotateAngle * 180 / M_PI;paster.animatedPasterpath = pasterInfo.path;[animatePasters addObject:paster];}else if (pasterInfo.pasterInfoType == PasterInfoType_static){TXPaster *paster = [TXPaster new];paster.startTime = pasterInfo.startTime;paster.endTime = pasterInfo.endTime;paster.frame = [pasterInfo.pasterView pasterFrameOnView:_videoPreview];paster.pasterImage = pasterInfo.pasterView.staticImage;[staticPasters addObject:paster];}}[_ugcEditer setAnimatedPasterList:animatePasters];[_ugcEditer setPasterList:staticPasters];}
- (void) setSubtitleList:(NSArray *)subtitleList;The `TXSubtitle` parameters are as follows:@interface TXSubtitle: NSObject@property (nonatomic, strong) UIImage* titleImage; // Subtitle image (here, you need to convert the text loading control to an image)@property (nonatomic, assign) CGRect frame; // Subtitle frame (please note that the frame coordinates here are relative to the rendering view)@property (nonatomic, assign) CGFloat startTime; // Subtitle start time in s@property (nonatomic, assign) CGFloat endTime; // Subtitle end time in s@end
UILabel
are used by the upper layer, please convert the control to UIImage
first. For detailed directions, please see the sample code of the demo. initWithPreview
). For more information, please see the sample code of the demo. @interface VideoTextInfo : NSObject@property (nonatomic, strong) VideoTextFiled* textField;@property (nonatomic, assign) CGFloat startTime; //in seconds@property (nonatomic, assign) CGFloat endTime;@endvideoTextInfos = @[VideoTextInfo1, VideoTextInfo2 ...];for (VideoTextInfo* textInfo in videoTextInfos) {TXSubtitle* subtitle = [TXSubtitle new];subtitle.titleImage = textInfo.textField.textImage; //UILabel (UIView) -> UIImagesubtitle.frame = [textInfo.textField textFrameOnView:_videoPreview]; // Calculate the coordinates relative to the rendering viewsubtitle.startTime = textInfo.startTime; // Subtitle start timesubtitle.endTime = textInfo.endTime; // Subtitle end time[subtitles addObject:subtitle]; // Add the subtitle list}[_ugcEditer setSubtitleList:subtitles]; // Set the subtitle list