tencent cloud

User Generated Short Video SDK

Source Code Description (iOS)

다운로드
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-10-10 11:13:05
AI 번역

Introduction

This document introduces how to run the Tencent Cloud UGC (short video) iOS Demo and describes its source code structure. The Demo is built on the Tencent Cloud Short Video SDK (LiteAVSDK) and covers short video recording, editing, composition, publishing, and playback, as well as Tencent Effect beauty capabilities. By reading this document, you will quickly understand the responsibilities and code organization of each module in the project.

How to Run the Demo

1. Download the Demo and unzip it.
2. Run pod install in the XiaoShiPin directory, and then open XiaoShiPinApp.xcworkspace.
3. In the setLicenceURL method of XiaoShiPin/AppDelegate.m, fill in the Short Video License and the Tencent Effect License you have applied for:
setLicenceURL:key: of TXLiveBase / TXUGCBase: the license URL and key for the Short Video SDK.
setTELicense:key:completion: of TELicenseCheck: the license URL and key for Tencent Effect.
[TXLiveBase setLicenceURL:@"<License URL>" key:@"<License Key>"];
[TXUGCBase setLicenceURL:@"<License URL>" key:@"<License Key>"];
[TELicenseCheck setTELicense:@"<License URL>" key:@"<License Key>" completion:^(NSInteger authresult, NSString *_Nonnull errorMsg) {
// authresult == TELicenseCheckOk means the authentication succeeded
}];
4. In Xcode, select TARGETS > XiaoShiPinApp > Signing & Capabilities and change Bundle Identifier to the iOS bundle ID you used when applying for the license.

Project Structure

The project is organized through a Podfile. The business module and feature Kits are divided as follows:
Module
Description
Business module (account, video list, playback, publishing, short video, etc.); its build product is XiaoShiPinApp.
UGCKit
High-level wrapper (with UI) for the Short Video SDK.
Basic beauty module.
Tencent Effect beauty integration module (remote Pod dependency).

XiaoShiPin

The directory structure of the XiaoShiPin module is as follows:
File/Directory
Description
AppDelegate.h/.m
Application entry point. Handles license setup, network reachability monitoring, and Bugly initialization, and launches the main UI TCMainViewController.
main.m
Program entry point.
ViewController.h/.m
Launch guide page.
TCConstants.h
Global constants (HTTP server address, share AppID, App Group, error codes, etc.).
SDKHeader.h
Unified entry for SDK headers.
Mem.h
Memory helper macros.
Info.plist
App configuration (permission declarations, etc.).
AppViewControllers
Business pages (account, video list, playback, publishing, profile, etc.).
Model
Data models (login, user profile).
Util
Utility classes.
TXBeautyRes
Resources used by Tencent Effect (filters, animated effects, stickers, etc.).
Assets.xcassets / Assets
Image resources.
Base.lproj / en.lproj / zh-Hans.lproj
Localization resources.
Business features are divided by the subdirectories under AppViewControllers, as described below.

Directory Structure

File/Directory
Description
Account
Account module, including login and registration.
AccountInfo
Profile module, including user profile, settings, about, account deletion, and an H5 host page.
MainList
Video list module, including list data and display.
MainTab
Main UI of the short video app (Tab container).
NavigationController
Custom navigation controller.
Publish
Short video publishing module.
UGCKitWrapper
Wrapper for the short video recording/editing flow.
UGCVideoJoinDemo
Short video composition (multi-clip stitching) preview.
VideoPlayer
VOD playback module.

Account Module

Handles user login, registration, login refresh, and account deletion.
If you already have your own account system, you can replace this module directly.
Use TCLoginModel to register an account via registerWithUsername:password:succ:fail: and log in via loginWithUsername:password:succ:fail:. After a successful login, call scheduleRefreshLoginForExpireDate: to refresh the login state periodically. Call logout: to log out and deleteAccount:completion: to delete an account.
Related Code:
Class
Description
TCLoginViewController
Login page.
TCRegisterViewController
Registration page.
TXWechatInfoView
WeChat info display view.
TCLoginModel
Login and registration manager.
TCLoginParam
Login parameters and login info cache.
TCUserInfoModel
User profile manager (singleton). Fetches, saves, and caches profile data locally.

Main UI and List Management Module

The main UI TCMainViewController inherits from UITabBarController and switches between three top-level features: the short video list, short video shooting/editing, and the user profile.
After a successful login, the video list is shown by default. Tapping the "+" button opens a dialog that lets you record a short video or edit a local one. Tapping the profile button navigates to the profile page.
List management covers fetching and displaying the list. The data layer is TCLiveListMgr (defined in TCLiveListModel.h), which fetches, caches, and updates list data. The list is fetched in pages, and the UI is notified to refresh as soon as the first page is loaded.
Related Code:
Class
Description
TCMainViewController
Main UI, used to present the short video list, short video shooting/editing, and the user profile page.
TCNavigationController
Custom navigation controller.
TCLiveListMgr
List manager. Provides interfaces to read the in-memory list and update it from the server.
TCVideoListViewController
List page, responsible for displaying short video data.
TCVideoListCell
Short video list cell.
TCLiveListModel
Video data (TCLiveInfo, TCLiveUserInfo).

Short Video Recording Module

It provides short video recording. You can record a short video of up to one minute, shoot in multiple segments (segments can be deleted on the recording page), and use split-screen duet / three-screen duet modes.
The recording page is created and presented by UGCKitWrapper as UGCKitRecordViewController.
Related Code:
Class
Description
UGCKitWrapper
Wrapper for the short video recording/editing flow. Creates and presents the recording and editing pages with a given theme.
UGCKitRecordViewController
Short video recording page.
UGCKitRecordConfig
Recording configuration (aspect ratio, resolution, bitrate, min/max duration, fps, watermark, chorus videos, duet mode, etc.).

File Selection Module

It provides local media selection: you can pick videos (or images) from the system photo library, and multiple videos can be automatically stitched together after selection.
The media picker is implemented by UGCKitMediaPickerViewController, and TCVideoEditPrevViewController can be used to preview before stitching.
Related Code:
Class
Description
UGCKitMediaPickerViewController
Local media selection page.
UGCKitMediaPickerConfig
Media picker configuration (selectable count, media type, number of columns, whether to stitch videos, etc.).
TCVideoEditPrevViewController
Short video composition preview page.

Editing Module

Video editing includes video trimming, slow motion, filters, music mixing, stickers, and subtitles.
The cut page UGCKitCutViewController selects the video range.
After cutting, the edit page UGCKitEditViewController opens, with music, filter, speed, effect, sticker, and subtitle features at the bottom.
Stickers, subtitles, and time effects on the edit page are managed by UGCKitVideoEffectManager.
Related Code:
Class
Description
UGCKitCutViewController
Short video cut page.
UGCKitEditViewController
Edit page shown after cutting, with music, filter, speed, effect, sticker, and subtitle features at the bottom.
UGCKitVideoEffectManager
Manager for editing effects (stickers, subtitles, time effects, etc.).
UGCKitEditConfig
Editing configuration (rotation, compressed resolution, bitrate, watermark, tail watermark, generate mode, etc.).

Short Video Composition Module

The UGCVideoJoinDemo/ directory, together with the composition capability in UGCKit, handles short video composition.
Stitching multiple videos (combineVideos) is done during selection by UGCKitMediaPickerViewController + UGCKitAssetLoader. The recording page also implements TXVideoJoinerListener to support duet and multi-segment composition scenarios.
Related Code:
Class
Description
TCVideoEditPrevViewController
Short video composition/stitching preview page.
UGCKitAssetLoader
Media asset loading and stitching class.

Short Video Publishing Module

Publishes recorded files to the Tencent Cloud video distribution platform (VOD).
Related Code:
Class
Description
TCVideoPublishController
Short video publishing page.
TCUploadHelper
Upload helper class.

Short Video Playback Module

Plays videos that have been published to VOD. Swipe up/down on the video list page to quickly switch to the previous/next video.
Related Code:
Class
Description
TCBasePlayViewController
Base class of the playback page.
TCVodPlayViewController
Short video VOD playback page.
TCPlayDecorateView
Decoration layer of the playback page (like, comment, share, etc.).
TCPlayViewCell
Playback list cell.

UGCKit

UGCKit is a high-level wrapper (with UI) for the Short Video SDK. It is integrated as a local Pod for quick access.
The UGCKit directory structure is as follows:
File/Directory
Description
UGCKit/Classes/Source
Source directory, divided by feature into Common, Record, Edit, VideoCut, MediaPicker, Music, upload, Model, Theme, and Report.
UGCKit/Assets
UI images and animated effect resources.
UGCKit/Localizable
Localization resources.
UGCKitRecordViewController
View controller of the short video recording module.
UGCKitEditViewController
View controller of the short video editing module.
UGCKitCutViewController
View controller of the short video cut module.
UGCKitMediaPickerViewController
View controller of the video/image picker module.
UGCKitBGMListViewController
Background music list page.
UGCKitTheme
Theme configuration (icons, colors, localized strings, etc.).
UGCKitMedia / UGCKitResult / UGCKitWatermark
Media, result, and watermark data models.
UGCKitReporter
Data reporting interface.
UGCKit.h
Public header entry of the framework.
UGCKitConstants.h
Constant configuration (cache paths, etc.).

Upload Module (with QUIC Acceleration)

The upload module handles short video uploads (including QUIC protocol probing and acceleration):
File/Directory
Description
TXUGCPublish
Short video upload entry point.
QuicClient
QUIC client wrapper. Handles connection, request, cancellation, and callback forwarding.
TVCQuicConfigProxy
QUIC configuration proxy.
TVCClient / TVCConfig / TVCReport
Upload client, configuration, and data reporting.
TXUGCPublishOptCenter / TXUGCPublishUtil
Upload optimization center and helper utilities.
Note:
This module relies on QCloudQuic and QCloudCOSXML for the underlying QUIC and object storage capabilities. Before uploading, it probes whether the QUIC link is reachable, which improves the upload speed and success rate. If QUIC acceleration is not needed, you can remove the related dependencies without affecting the main upload flow.

TEBeautyKit

This module is the Tencent Effect beauty Kit, used to integrate Tencent Effect beauty features quickly. In the Demo, it is integrated into the recording controller UGCKitRecordViewController of UGCKit. You can refer to this approach for a quick integration.
File/Directory
Description
XiaoShiPin/TXBeautyRes
Stores the filters and stickers used by Tencent Effect, as well as the configuration files required by the beauty panel of TEBeautyKit.
TEBeautyKit
Tencent Effect beauty Kit (Pod dependency). Handles SDK initialization and texture processing.
TEPanelView
Tencent Effect beauty panel view.
TEUIConfig
Beauty panel resource configuration.
TEUIProperty
Beauty property data model.
XMagic
Tencent Effect rendering engine.
UGCKitRecordViewController
Beauty integration location.

BeautySettingKit (Basic Beauty)

This module is the basic beauty module for short videos. If you choose basic beauty, you can use this module for quick integration.
File/Directory
Description
Filter
Filter definitions.
Interfaces
Beauty panel action protocol.
Model
Beauty action proxy and animated sticker management.
View
Beauty panel views and theme.
Assets
Beauty panel UI and filter resources.
TCBeautyPanel
Beauty panel component.
TCBeautyPanelView
Beauty panel view.
TCBeautyPanelActionPerformer
Beauty parameter setting protocol, forwarded to the SDK object by TCBeautyPanelActionProxy.
TCBeautyPanelActionProxy
Beauty action proxy.
TCFilter
Filter definitions and resource management.
TCPituMotionManager
Animated sticker (Pitu) management.
TCBeautyPanelTheme
Beauty panel theme configuration.
TCMenuView
Beauty panel menu view.
TCBeautyPanel.h
Public header entry of the framework.

도움말 및 지원

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

피드백