tencent cloud

User Generated Short Video SDK

뉴스 및 공지사항
Release Notes
The “startPlay” API of the UGSV SDK Renamed
제품소개
Overview
Features
Use Cases
Concepts
구매 가이드
Pricing Overview
Refund Policy
라이선스 가이드
Adding and Renewing a License
Configuring and Viewing a License
SDK 다운로드
SDK Download
Release Notes (App)
UI 통합 솔루션 포함
UGSV Demo App
Source Code Description (iOS)
Source Code Description (Android)
UI 통합 솔루션 없음
SDK Integration
Capturing and Shoot
Preview, Clipping, and Splicing
Upload and Playback
Tencent Effect SDK
Advanced Features and Special Effects
API 문서
Editing
Shooting
기술적 지원
Error Codes
Feature FAQs
일반적인 문제
Upload
Android Compilation
Android
iOS
License
UGSV 정책
개인 정보 보호 정책
데이터 처리 및 보안 계약

iOS

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2025-04-01 17:14:09

Static Sticker

- (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


Animated Sticker

- (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
Demo:
- (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];
}

Adding Subtitles

Video subtitling is supported. You can add subtitles to each frame of a video and set the start and end time to display each subtitle. All subtitles form a subtitle list, which can be passed to the SDK, and the SDK will automatically add the subtitles to the video at the corresponding points in time.
You can set subtitles as follows:
- (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
titleImage: subtitle image. If controls like 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.
frame: subtitle frame (please note that the frame is relative to the frame of the rendering view passed in during initWithPreview). For more information, please see the sample code of the demo.
startTime: subtitle start time.
endTime: subtitle end time.
As the subtitle UI logic is complicated, a complete method is provided at the demo layer. We recommend you directly implement subtitling as instructed in the demo, which greatly reduces your integration costs.
Demo:
@interface VideoTextInfo : NSObject
@property (nonatomic, strong) VideoTextFiled* textField;
@property (nonatomic, assign) CGFloat startTime; //in seconds
@property (nonatomic, assign) CGFloat endTime;
@end

videoTextInfos = @[VideoTextInfo1, VideoTextInfo2 ...];

for (VideoTextInfo* textInfo in videoTextInfos) {
TXSubtitle* subtitle = [TXSubtitle new];
subtitle.titleImage = textInfo.textField.textImage; //UILabel (UIView) -> UIImage
subtitle.frame = [textInfo.textField textFrameOnView:_videoPreview]; // Calculate the coordinates relative to the rendering view
subtitle.startTime = textInfo.startTime; // Subtitle start time
subtitle.endTime = textInfo.endTime; // Subtitle end time
[subtitles addObject:subtitle]; // Add the subtitle list
}

[_ugcEditer setSubtitleList:subtitles]; // Set the subtitle list

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백