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
License ガイド
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

ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック