tencent cloud

User Generated Short Video SDK

iOS

Download
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-05-11 17:46:56
This document provides the iOS API reference for the TAVMagicUIKit SDK (short video editing), for easy lookup and usage.

TAVEditorPreviewController

Preview & Edit Page Controller
Properties
Type
Description
TAVEditor *editor
TAVEditor
TAVMagic editing SDK.
TAVEditorPreviewMenuView *menuView
Parent view for the vertical button bar on the right side of the interface.
TAVPreviewBgmView *bgmView
BGM display view, hidden by default.
UIButton *backButton
UIButton
Back button in the upper-left corner.
UIButton *nextButton
UIButton
Next button.
void (^nextClickCallback)(void)
Block
Next button tap event.
void (^shouldHideMenuView)(void)
Block
Callback when menuView is hidden.
void (^shouldShowMenuView)(void)
Block
Callback when menuView is shown.
NSTimeInterval minimumEditableDuration
NSTimeInterval
Minimum editing duration, default 6s.
NSTimeInterval maximumEditableDuration
NSTimeInterval
Maximum editing duration, default 60 * 60s.
id<ITAVMaterialProvider> materialProvider
Resource provider. Methods in this protocol are called when the user taps to add video/image/BGM within the KIT. You can customize the resource picker UI through this protocol.
id<ITAVEditInterceptor> editInterceptor
Edit interceptor that intercepts whether certain operations can proceed, such as whether the current track position can be split, limiting the maximum number of tracks of a specific type, etc.
Related Methods
Method
Description
Initialize the editor controller with an array of videos/images.
Initialize the editor controller with a draft.
Initialize the editor controller with an SDK instance.
Navigate to the editing page.
Navigate to the editing page and select the first BGM track.
Open the BGM picker panel to select a BGM.
Open the text sticker panel to add a text sticker.
Open the volume settings panel to adjust the volume.
Navigate to the recording panel to add a voiceover.
Recording IDs tracked by the business logic, used to distinguish BGM from voiceover.

initWithAssetPath:resources:

Description
Initialization method. Creates an editor object from a set of initial resources.
API
-(instancetype)initWithAssetPath:(NSString *)assetPath resources:(NSArray <TAVAlbumResource *>*)resources;
Parameters
Parameter Name
Type
Description
assetPath
NSString *
lightCore.bundle Path to the model resources. Pass nil by default, retrieved from mainBundle.
resources
NSArray <TAVAlbumResource *>*
Array of initial input resources.
Return Value
Type:instancetype
Description: Returns the initialized object instance.

initWithAssetPath:draft:

Description
Initialization method. Creates an editor object from a draft object.
API
-(instancetype)initWithAssetPath:(NSString *)assetPath draft:(TAVDraft *)draft;
Parameters
Parameter Name
Type
Description
assetPath
NSString *
lightCore.bundle Path to the model resources. Pass nil by default, retrieved from mainBundle.
draft
TAVDraft *
The draft object to load.
Return Value
Type:instancetype
Description: Returns the initialized object instance.

initWithTavEditor:

Description
Initialization method. Uses an existing TAVEditor object to create a new controller instance.
API
-(instancetype)initWithTavEditor:(TAVEditor *)editor;
Parameters
Parameter Name
Type
Description
editor
TAVEditor *
SDK editor object.
Return Value
Type:instancetype
Description: Returns the initialized object instance.

pushEditController

Description
Performs navigation to enter the editing page.
API
-(void)pushEditController;
Parameters
None
Return Value
Type:void
Description: No return value.

pushEditAndSelectBgmTrack

Description
Navigates to the editing page and automatically selects the first BGM track.
API
-(void)pushEditAndSelectBgmTrack;
Parameters
None
Return Value
Type:void
Description: No return value.

showBgmSelectionPanel

Description
Opens the BGM selection panel for the user to choose a BGM.
API
-(void)showBgmSelectionPanel;
Parameters
None
Return Value
Type:void
Description: No return value.

showTextInputPanel

Description
Opens the text sticker input panel for adding or editing text stickers.
API
-(void)showTextInputPanel;
Parameters
None
Return Value
Type:void
Description: No return value.

showVolumePanel

Description
Opens the volume settings panel to adjust the volume level.
API
-(void)showVolumePanel;
Parameters
None
Return Value
Type:void
Description: No return value.

gotoVoiceoverPanel

Description
Navigates to the recording panel, allowing the user to add a voiceover.
API
-(void)gotoVoiceoverPanel;
Parameters
None
Return Value
Type:void
Description: No return value.

voiceoverIds

Description
Gets the list of recording IDs tracked by the business logic, used to distinguish BGM from voiceover resources.
API
-(NSArray *)voiceoverIds;
Parameters
None
Return Value
Type:NSArray *
Description: Returns an array of business-tracked recording IDs.

TAVEditorPreviewMenuView

Parent view for the vertical button bar on the right side of the preview editing page
Properties
Type
Description
UIButton *adjustBtn
UIButton
Button to navigate to the main track editing page.
UIButton *textBtn
UIButton
Add text button.
UIButton *musicBtn
UIButton
Add music button.
UIButton *stickerBtn
UIButton
Add sticker button.
UIButton *filterBtn
UIButton
Add filter button.
UIButton *effectBtn
UIButton
Add effect button.

TAVPreviewBgmView

BGM display view, hidden by default
Properties
Type
Description
UIImageView *iconView
UIImageView
Music icon.
UILabel *textView
UILabel
Music text label.
UIButton *deleteBtn
UIButton
Delete music button.
Related Methods
Method
Description
Set whether BGM is present.

setContainBgm:

Description
Sets and updates UI components (such as the delete button visibility and audio icon) based on whether BGM is present.
API
-(void)setContainBgm:(BOOL)hasBgm;
Parameters
Parameter Name
Type
Description
hasBgm
BOOL
Indicates whether BGM is currently present. If YES, shows the delete button and sets the default audio icon; if NO, hides the delete button and sets a loading audio icon.
Return Value
Type:void
Description: No return value.

ITAVMaterialProvider

Block Type Definitions

Description
Defines Block types for handling material selection results.
Type Name
Type Definition
Description
handleBgmSelectResultFunc
typedef void(^handleBgmSelectResultFunc)(TAVBgmResource *bgmResource);
Block for handling BGM selection results, returning the selected BGM resource object via callback.
handleAlbumSelectResultFunc
typedef void(^handleAlbumSelectResultFunc)(NSArray<TAVAlbumResource *> *resourceList);
Block for handling album file selection results, returning a list of selected media resource objects via callback.

getBgmWithHandler:

Description
Interface for obtaining BGM materials. The host app should present the BGM picker in this method and, after the user makes a selection, return the result via handler callback with the selected resource.
API
-(void)getBgmWithHandler:(handleBgmSelectResultFunc)handler;
Parameters
Parameter Name
Type
Description
handler
handleBgmSelectResultFunc
Callback Block for returning the selected TAVBgmResource object to the SDK.
Return Value
Type:void
Description: No return value.

getAlbumFilesForType:withHandler:

Description
Interface for obtaining album files. The host app should present the album picker in this method and, based on option specified types, return the result after the user completes selection via handler callback with the list of selected resources.
API
-(void)getAlbumFilesForType:(TAVAlbumOptions *)option withHandler:(handleAlbumSelectResultFunc)handler;
Parameters
Parameter Name
Type
Description
option
TAVAlbumOptions *
Album options specifying the file types to select (e.g., video, image).
handler
handleAlbumSelectResultFunc
Callback Block for returning the selected TAVAlbumResource object list to the SDK.
Return Value
Type:void
Description: No return value.

ITAVEditInterceptor

Method
Description
Whether a new track can be added.
Whether a new track can be added.
Whether a track can be split.

canAddNewTrack:count:

Description
Checks whether a new track can be added based on the track type and the current number of tracks already added.
API
-(BOOL)canAddNewTrack:(TAVTrackType)type count:(NSInteger)currentCount;
Parameters
Parameter Name
Type
Description
type
TAVTrackType
The type of track to be added.
currentCount
NSInteger
The current number of tracks of the same type already added.
Return Value
Type:BOOL
Description: Returns YES if a new track can be added, NO if the limit has been reached or it is not allowed.

canAddNewTrack:currentTime:duration:

Description
Checks whether a new track can be added based on the track type, current time position, and total duration.
API
-(BOOL)canAddNewTrack:(TAVTrackType)type currentTime:(CMTime)currentTime duration:(CMTime)totalDuration;
Parameters
Parameter Name
Type
Description
type
TAVTrackType
The type of track to be added.
currentTime
CMTime
The current playback time position.
totalDuration
CMTime
The total duration of the current editing project.
Return Value
Type:BOOL
Description: Returns YES if a new track can be added, NO if not allowed (possibly due to time or duration constraints).

canSplitTrack:currentTime:timeRange:

Description
Checks whether a split operation can be performed on a track at the specified time position.
API
-(BOOL)canSplitTrack:(TAVTrackType)type currentTime:(CMTime)currentTime timeRange:(CMTimeRange)timeRange;
Parameters
Parameter Name
Type
Description
type
TAVTrackType
The type of track to be split.
currentTime
CMTime
The current playback time position (split point).
timeRange
CMTimeRange
The valid time range of the current track.
Return Value
Type:BOOL
Description: Returns YES if the track can be split at this time position, NO if splitting is not allowed (e.g., at the edge of the track or less than the minimum splittable duration).


도움말 및 지원

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

피드백