tencent cloud

User Generated Short Video SDK

Android

Download
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-05-11 17:46:56
This document provides the Android API reference for the Premium UGSV UIKit SDK for easy lookup and use.

TAVEditorUIKit

A UI component for video editing.
API
Description
Sets the permission provider for handling runtime permissions in the editing workflow, such as storage and microphone permissions.
Initializes the editor timeline with a list of asset paths, builds the project, and refreshes the preview and duration information.
Initializes the editor with an existing draft, loads the draft content, and resets the draft context.
onResume
Should be called when the host screen enters onResume; it resumes playback or refreshes the player based on whether playback should be resumed, and notifies the panels to resume.
onPause
Should be called when the host screen enters onPause; it pauses the player and notifies the panels to pause.
isPlaying
Checks whether the player is currently playing.
Handles the back button event. Panels and layers consume it first, and returns whether the event has been handled.
onDestroy
Should be called when the host is destroyed to release player-related resources and clean up global Toast references.
Sets the material provider used internally by the UI to fetch, select, or display business material resources.
Returns the FrameLayout corresponding to the pre-edit layer, allowing the host to add custom views to the pre-edit screen.
showLayer
Switches the editing layer based on the input enum value (such as pre-edit, main edit, full-screen preview, motion editing, etc.).
showPanel
Switches the feature panel based on the input enum value (such as text, voiceover, filter, sticker, etc.), or closes the current panel.
Sets a panel change listener to receive the current panel type when the feature panel switches.
Sets a layer change listener to receive the current layer type when the editing layer switches.
saveDraft
Saves the current editing state as a draft and returns the generated TAVDraft object.
getDraft
Returns the current draft object for external persistence or later restoration.
Returns the editing operation entry point ITAVEditOperator for low-level editing operations on tracks, effects, and more.
Derives an offscreen editor instance and returns its identifier for background rendering or export.
Sets the Next click callback. When the user taps Next, it returns the current frame and other results.
Sets the maximum editable duration and automatically updates the playback range based on that duration.
Sets the minimum editable duration to limit the minimum project duration.
Returns the offscreen frame provider to obtain rendered frames of the editing result at the specified long-edge size.
Retrieves a Bitmap frame at the specified time and returns the result asynchronously through a callback.
Sets an edit interceptor to intercept and customize key editing actions (such as deletion and applying effects) before execution.
Sets a player status listener to listen for playback state changes (play, pause, finish, etc.).
Sets a draft change listener to receive notifications when the draft content changes.
Sets the offscreen video player provider to customize offscreen playback/rendering implementation.
Returns the current preview render size for UI adaptation.
Sets the resource root path used by the editing UI.

setPermissionProvider

Description
Sets the permission provider used to handle runtime permission requests during editing, such as microphone recording and storage access.
Signature
public void setPermissionProvider(ITAVPermissionProvider provider)
Parameters
Parameter
Type
Description
provider
Permission provider/request adapter interface instance.
Returns
Type:void
Description: No return value.

initWithClipPath

Description
Initializes the editing project with a list of video/image paths.
It resets the player, refreshes duration information, and resets the draft context. It is suitable for creating a new project or reloading assets.
Signature
public void initWithClipPath(List<String> pathList)
Parameters
Parameter
Type
Description
pathList
List<String>
A list of asset paths, which can be video or image file paths.
Returns
Type:void
Description: No return value. The first frame rendering and duration calculation are triggered automatically.

initWithDraft

Description
Initializes the editing project with an existing draft.
It loads the tracks, effects, text, Picture-in-Picture, and other content from the draft, and resets the draft context.
Signature
public void initWithDraft(TAVDraft draft)
Parameters
Parameter
Type
Description
draft
TAVDraft
A previously saved draft object.
Returns
Type:void
Description: No return value. After the draft is loaded, the UI synchronizes to the draft state.

onResume

Description
Notifies the page hosting the UI component that it has entered the visible/foreground state.
It can optionally resume playback or only refresh the current frame, and internally also calls the panel's onResume.
Signature
public void onResume(boolean resumePlay)
Parameters
Parameter
Type
Description
resumePlay
boolean
Whether to resume playback automatically: true attempts to resume playback, and false only refreshes the frame.
Returns
Type:void
Description: No return value.

onPause

Description
Notifies the page hosting the UI component that it has entered the invisible/background state.
It pauses the player and notifies the panels to enter the paused state. This is typically called in the Activity/Fragment's onPause() callback.
Signature
public void onPause()
Parameters
None
Returns
Type:void
Description: No return value.

isPlaying

Description
Checks whether the player is currently in the playing state.
Signature
public boolean isPlaying()
Parameters
None
Returns
Type:boolean
Description: true indicates that the player is currently playing; false indicates that it is not playing (paused, stopped, or not prepared).

onBackPressed

Description
Handles the back button event.
The event is first consumed by the panel and layer controllers, such as closing the current popup panel or exiting the editing layer; if not consumed internally, it returns false for external handling.
Signature
public boolean onBackPressed()
Parameters
None
Returns
Type:boolean
Description: true indicates that the back event has been consumed internally; false indicates that it was not consumed and should continue to be handled by the external Activity/Fragment.

onDestroy

Description
Destroys internal resources of the UI component.
It releases player resources and cleans up global Toast references. This is typically called in the Activity/Fragment's onDestroy().
Signature
public void onDestroy()
Parameters
None
Returns
Type:void
Description: No return value. The instance should not be used after this call.

setMaterialProvider

Description
Sets the material provider to supply filter, sticker, motion effect, and other material data for the UI toolbar, effect panels, and more.
Signature
public void setMaterialProvider(ITAVMaterialProvider provider)
Parameters
Parameter
Type
Description
provider
Material data provider interface instance.
Returns
Type:void
Description: No return value.

getPreEditLayer

Description
Returns the root layout container of the pre-edit layer.
It can be used by the upper layer to overlay custom Views during the pre-edit stage.
Signature
public FrameLayout getPreEditLayer()
Parameters
None
Returns
Type:FrameLayout
Description: The container view instance of the pre-edit layer. It may be an internally created FrameLayout.

showLayer

Description
Switches the currently displayed editing layer (such as pre-edit, main edit, full-screen preview, motion editing, etc.).
Internally, it switches the corresponding BaseLayer based on the input enum type and triggers the layer change callback.
Signature
public void showLayer(TAVEditorUIConstants.TAVLayer layer)
Parameters
Parameter
Type
Description
layer
TAVEditorUIConstants.TAVLayer
The desired layer type to display, such as PRE_EDITMAIN_EDITFULL_PREVIEWMOTION_EDIT
Returns
Type:void
Description: No return value.

showPanel

Description
Switches the currently displayed editing panel (such as the text panel, voiceover panel, filter panel, sticker panel, etc.).
Signature
public void showPanel(TAVEditorUIConstants.TAVPanel panel)
Parameters
Parameter
Type
Description
panel
TAVEditorUIConstants.TAVPanel
The panel type to display, such as NONETEXTVOICEOVERFILTERSTICKER
Returns
Type:void
Description: No return value.

setPanelChangedListener

Description
Sets a panel switch listener to receive callbacks when the panel display state changes (for example, switching from the main panel to the text panel).
Signature
public void setPanelChangedListener(TAVPanelChangedListener listener)
Parameters
Parameter
Type
Description
listener
TAVPanelChangedListener
Panel change listener instance. It can be null to remove the listener.
Returns
Type:void
Description: No return value.

setLayerChangedListener

Description
Sets a layer switch listener to notify the upper layer when the editing layer (pre-edit, main edit, full-screen preview, motion editing, etc.) changes.
Signature
public void setLayerChangedListener(TAVLayerChangedListener listener)
Parameters
Parameter
Type
Description
listener
TAVLayerChangedListener
Layer change listener instance. It can be null to remove the listener.
Returns
Type:void
Description: No return value.

saveDraft

Description
Saves the current editing state as a draft.
It serializes tracks, effects, text, Picture-in-Picture, and other information into a TAVDraft object and returns the draft.
Signature
public TAVDraft saveDraft()
Parameters
None
Returns
Type:TAVDraft
Description: The draft object corresponding to the current editing state. The specific persistence path can be obtained through fields or APIs of TAVDraft itself.

getDraft

Description
Returns the draft model object currently being edited.
Unlike saveDraft , this method only returns the in-memory draft object reference and does not actively save it.
Signature
public TAVDraft getDraft()
Parameters
None
Returns
Type:TAVDraft
Description: The draft object associated with the current editing session.

getEditOperator

Description
Returns the editing operation entry interface for executing specific editing commands, such as clip insertion/removal, effect addition, and text editing.
Signature
public ITAVEditOperator getEditOperator()
Parameters
None
Returns
Description: The editing operation interface instance, which can be used to perform specific editing operations on the project.

forkOffscreenEditor

Description
Derives an offscreen editor instance from the current editing context for offscreen rendering, cover generation, and similar operations.
The returned key can be used later to look up and use the offscreen editor through other modules/APIs.
Signature
public String forkOffscreenEditor()
Parameters
None
Returns
Type:String
Description: The unique key of the offscreen editor instance.

setNextClickCallback

Description
Sets the Next button click callback return the current frame snapshot and other information to the upper layer when the user clicks Finish/Next.
Signature
public void setNextClickCallback(TAVCallback<Bitmap> callback)
Parameters
Parameter
Type
Description
callback
TAVCallback<Bitmap>
The callback triggered when Next is clicked. The parameter is the cover or current-frame Bitmap and can be null to clear the callback.
Returns
Type:void
Description: No return value.

setMaxEditDuration

Description
Sets the maximum editable duration allowed for the current project.
When the total asset duration exceeds this value, the pre-edit layer automatically limits the playback/editing range.
Signature
public void setMaxEditDuration(long duration)
Parameters
Parameter
Type
Description
duration
long
The maximum editable duration, in microseconds (us).
Returns
Type:void
Description: No return value. The playback range is updated immediately internally.

setMinEditDuration

Description
Sets the minimum editable duration allowed for the current project to constrain the lower bound of the content length (for example, the minimum video duration required by a publishing platform).
Signature
public void setMinEditDuration(long duration)
Parameters
Parameter
Type
Description
duration
long
The minimum editable duration, in microseconds (us).
Returns
Type:void
Description: No return value.

getFrameProvider

Description
Returns the offscreen frame provider for obtaining rendered frames of the current project at the specified long-edge size (for example, cover generation or preview thumbnails).
Signature
public ITAVFrameProvider getFrameProvider(int longSide)
Parameters
Parameter
Type
Description
longSide
int
The long-edge size of the target rendered image, in pixels.
Returns
Type:ITAVFrameProvider
Description: The frame provider interface, which can be used to get the rendered result of the current project at a specific time.

getFrameAtTime

Description
Retrieves an offscreen rendered frame at the specified time.
Internally, it renders at the given long-edge size and returns the corresponding Bitmap.
Signature
public void getFrameAtTime(long timeUs, int longSide, TAVConsumer<Bitmap> consumer)
Parameters
Parameter
Type
Description
timeUs
long
The target time, in microseconds (us).
longSide
int
The long-edge size of the rendered image, in pixels.
consumer
TAVConsumer<Bitmap>
The render result callback. The parameter is the Bitmap.
Returns
Type:void
Description: No return value. The result is returned asynchronously through the callback.

setEditInterceptor

Description
Sets the edit interceptor for validation or interception before executing editing operations (for example, permission validation, business restrictions, analytics, etc.).
Signature
public void setEditInterceptor(ITAVEditInterceptor interceptor)
Parameters
Parameter
Type
Description
interceptor
ITAVEditInterceptor
The edit operation interceptor instance. It can be null to remove the interception.
Returns
Type:void
Description: No return value.

setPlayerStatusListener

Description
Sets a player status listener to receive more fine-grained player state change notifications.
Signature
public void setPlayerStatusListener(TAVPlayerStatusListener listener)
Parameters
Parameter
Type
Description
listener
TAVPlayerStatusListener
Player status listener instance. It can be null to remove the listener.
Returns
Type:void
Description: No return value.

setDraftChangeListener

Description
Sets a draft change listener to notify the business layer when a draft is saved, modified, or reset.
Signature
public void setDraftChangeListener(TAVDraftChangeListener listener)
Parameters
Parameter
Type
Description
listener
TAVDraftChangeListener
Draft change listener instance. It can be null to remove the listener.
Returns
Type:void
Description: No return value.

setOffScreenVideoPlayer

Description
Sets the offscreen video player provider to control the underlying player implementation used during export/offscreen preview.
Signature
public void setOffScreenVideoPlayer(ITAVProvider<ITAVOffScreenVideoPlayer> provider)
Parameters
Parameter
Type
Description
provider
ITAVProvider<ITAVOffScreenVideoPlayer>
The off-screen player provider used to create the actual player instance.
Returns
Type:void
Description: No return value.

getRenderSize

Description
Returns the size of the current actual render area.
This size is usually determined jointly by the canvas aspect ratio, preview container size, and project content.
Signature
public Size getRenderSize()
Parameters
None
Returns
Type:Size
Description: The current render area's width and height information.

setResourceRootPath

Description
Sets the resource root directory path.
Signature
public void setResourceRootPath(String path)
Parameters
Parameter
Type
Description
path
String
The absolute path or prefix of the resource root directory.
Returns
Type:void
Description: No return value.

ITAVPermissionProvider

The permission provider required by TAVEditorUIKit.

hasPermission

Description
Checks whether the specified runtime permission has already been granted.
It is usually called before performing operations that require sensitive permissions, to decide whether to proceed directly or request permission.
Signature
boolean hasPermission(String permission)
Parameters
Parameter
Type
Description
permission
String
The permission name to check (such as android.permission.RECORD_AUDIO).
Returns
Type:boolean
Description: Returns true if the permission is granted; otherwise returns false.

requirePermission

Description
Immediately requests the specified permission.
The request result is asynchronously notified to the caller through PermissionResultReceiver callback.
Signature
void requirePermission(String permission, int requestCode, PermissionResultReceiver receiver)
Parameters
Parameter
Type
Description
permission
String
The permission name to request (such as android.permission.RECORD_AUDIO).
requestCode
int
The permission request code used by the upper layer to distinguish different request scenarios.
receiver
PermissionResultReceiver
The permission request result callback receiver instance used to receive the grant result.
Returns
Type:void
Description: No return value. The permission result is asynchronously delivered through PermissionResultReceiver callback.

onPermissionResult

Description
Permission request result callback. When requirePermission is called, this callback is triggered after the user completes the action (allow/deny) in the system permission dialog.
Signature
void onPermissionResult(boolean granted)
Parameters
Parameter
Type
Description
granted
boolean
For true, it indicates that the permission was granted successfully; for false, it indicates that the user denied the request or authorization failed.
Returns
Type:void
Description: No return value. The caller can decide the follow-up logic in this callback based on the authorization result (continue the operation or prompt the user).

ITAVMaterialProvider

The media file provider required by TAVEditorUIKit.

getBgmFile

Description
Triggers the flow for selecting a background music file.
The specific selection logic (dialog style, local file, built-in materials, etc.) is implemented by the business side, and the result is returned through ITAVBgmResultHandler callback.
Signature
void getBgmFile(int requestCode, ITAVBgmResultHandler handler)
Parameters
Parameter
Type
Description
requestCode
int
The request code used to distinguish BGM selection requests in different business scenarios.
handler
The background music selection result callback interface used to return the material selected by the user.
Returns
Type:void
Description: No return value. The BGM file selection result is returned through handler callback.

getAlbumFiles

Description
Triggers the flow for opening the album to select materials (videos/images, etc.).
Use TAVAlbumOptions to control the maximum selection count, resource type, source, and so on; the result is returned by ITAVAlbumResultHandler callback.
Signature
void getAlbumFiles(int requestCode, TAVAlbumOptions options, ITAVAlbumResultHandler handler)
Parameters
Parameter
Type
Description
requestCode
int
The request code used to distinguish different album selection request scenarios.
options
The album selection configuration, including the maximum selection count, resource type, source, and so on.
handler
The album selection result callback interface used to return the list of materials selected by the user.
Returns
Type:void
Description: No return value. The album selection result is returned through handler callback.

ITAVBgmResultHandler

Used to handle the business-side result of background music selection.

onBgmSelectResult

Description
When the BGM selection flow triggered by ITAVMaterialProvider.getBgmFile(...) ends (whether successfully or not), this method must be called back to notify UIKit of the corresponding selection result.
Signature
void onBgmSelectResult(int requestCode, TAVBgmResource resource)
Parameters
Parameter
Type
Description
requestCode
int
The request code of this BGM selection request, used to distinguish selection results in different business scenarios.
resource
TAVBgmResource
The selected BGM resource object; the specific fields are defined by TAVBgmResource and may be null.
Returns
Type:void
Description: No return value. The final result of this BGM selection is returned to the caller through the callback.

ITAVAlbumResultHandler

Used to handle the business-side result of album file selection.

onAlbumSelectResult

Description
When the album selection flow triggered by ITAVMaterialProvider.getAlbumFiles(...) ends (regardless of whether the user actually selected materials), this method must be called back to notify UIKit of the corresponding selection result.
Signature
void onAlbumSelectResult(int requestCode, List<TAVAlbumResource> resourceList)
Parameters
Parameter
Type
Description
requestCode
int
The request code of this album selection request, used to distinguish selection results in different business scenarios.
resourceList
List<TAVAlbumResource>
The list of album materials selected by the user; it may be empty when the user makes no selection or cancels.
Returns
Type:void
Description: No return value. The final result of this album selection is returned to the caller through the callback.

TAVAlbumOptions

Description
The configuration for album material selection, used to constrain the number, type, and source of selectable materials.
Passed in when calling getAlbumFiles to guide the UI and material filtering logic.
Parameters
Field
Type
Description
count
int
The maximum number of selectable materials. For example, 1 means only a single file can be selected.
type
The resource type (for example, video only, image only, or mixed type), defined by TAVBaseResource.TYPE.
from
TAVEditorUIConstants.TAVResourceFrom
The material source type (such as system album, built-in materials, etc.), defined by TAVResourceFrom.

TAVBaseResource.TYPE

Description
The resource type enum used to identify the specific category of materials in the editor, such as background music, image, video, or mixed multi-type selection.
Parameters
Enum Value
Description
BGM
Background music resource, audio only.
PHOTO
Image resource, still image only.
VIDEO
Video resource, video file only.
MULTI
Mixed multi-type resource, which can include both images and videos.

TAVPanelChangedListener

The editing panel switch listener inside TAVEditorUIKit.

onPanelChanged

Description
Callback listener method triggered when the editing panel switches.
It is triggered when the currently displayed feature panel inside the editor (such as the text panel or voiceover panel) changes, and is used to notify the outside to synchronize UI or business state.
Signature
void onPanelChanged(TAVEditorUIConstants.TAVPanel panel)
Parameters
Parameter
Type
Description
panel
TAVEditorUIConstants.TAVPanel
The currently displayed panel type, such as TEXT, VOICEOVER, FILTER, etc.
Returns
Type:void
Description: No return value. The callback notifies that the current panel has changed.

TAVLayerChangedListener

The editing layer switch listener inside TAVEditorUIKit.

onLayerChanged

Description
Callback listener method triggered when the editing layer switches.
It is triggered when the currently displayed layer in the editor (such as the pre-edit layer, main edit layer, or full-screen preview layer) changes, and is used to notify the outside to synchronize UI or business state.
Signature
void onLayerChanged(TAVEditorUIConstants.TAVLayer layer)
Parameters
Parameter
Type
Description
layer
TAVEditorUIConstants.TAVLayer
The currently displayed layer type, such as PRE_EDIT, MAIN_EDIT, etc.
Returns
Type:void
Description: No return value. The callback notifies the outside that the current layer has changed.

ITAVEditOperator

Provides the entry point for editing operations to execute specific editing commands such as clip insertion/removal, effect addition, and text editing.
API
Description
Returns the list of all primary track clip models in the current project List<TAVClipModel>.
Returns the list of all background music models in the current project List<TAVBgmModel>.
Returns the list of all voiceover models in the current project List<TAVVoiceoverModel>.
Returns the list of all text models in the current project List<TAVTextModel>.
Returns the list of all overlay models in the current project List<TAVOverlayModel>.
Batch-updates the editing model list (such as BGM, text, voiceover, and overlay) by synchronizing the project based on the input models.
Adds a list of editing models to the current project.
Batch-removes the specified list of editing models from the current project.
Activates the specified editing model, usually making it the current selected item and entering the editable state.

getClipModels

Description
Returns the list of all primary track clip models in the current project.
Signature
List<TAVClipModel> getClipModels()
Parameters
None
Returns
Type:List<TAVClipModel>
Description: Returns the list of model objects corresponding to all clip segments in the current project.

getBgmModels

Description
Returns the list of all background music (BGM) models in the current project.
Signature
List<TAVBgmModel> getBgmModels()
Parameters
None
Returns
Type:List<TAVBgmModel>
Description: Returns the list of all BGM models in the current project.

getVoiceoverModels

Description
Returns the list of all voiceover models in the current project.
Signature
List<TAVVoiceoverModel> getVoiceoverModels()
Parameters
None
Returns
Type:List<TAVVoiceoverModel>
Description: Returns the list of all voiceover models in the current project.

getTextModels

Description
Returns the list of all text element models in the current project.
Signature
List<TAVTextModel> getTextModels()
Parameters
None
Returns
Type:List<TAVTextModel>
Description: Returns the list of all text models in the current project.

getOverlayModels

Description
Returns the list of all overlay (Picture-in-Picture) element models in the current project.
Signature
List<TAVOverlayModel> getOverlayModels()
Parameters
None
Returns
Type:List<TAVOverlayModel>
Description: Returns the list of all overlay models in the current project.

updateEditModels

Description
Incrementally updates existing editing data based on the input list of editing models.
It is usually used to modify properties of some existing BGM/voiceover/text models rather than fully replacing the entire list.
Signature
void updateEditModels(List<? extends TAVEditModel<?>> models)
Parameters
Parameter
Type
Description
models
List<? extends TAVEditModel<?>>
The list of editing models to update. BGM, voiceover, text, and other types are supported.
Returns
Type:void
Description: No return value. Internally, the properties of existing editing elements are updated according to the model identifier/ID.

setEditModels

Description
Sets the list of newly added editing models.
Signature
void setEditModels(List<? extends TAVEditModel<?>> models)
Parameters
Parameter
Type
Description
models
List<? extends TAVEditModel<?>>
The list of editing models to add.
Returns
Type:void
Description: No return value. After the call, the corresponding editing data is added to the current project.

removeEditModel

Description
Batch-deletes the specified editing models from the current project.
Signature
void removeEditModel(List<? extends TAVEditModel<?>> models)
Parameters
Parameter
Type
Description
models
List<? extends TAVEditModel<?>>
The list of editing models to be deleted, removed by model ID/identifier.
Returns
Type:void
Description: No return value. After the call, the editing elements corresponding to the input models are removed from the project.

activeEditModel

Description
Activates the specified editing model.
The activation operation usually causes the UI to highlight the corresponding element.
Signature
void activeEditModel(TAVEditModel<?> model)
Parameters
Parameter
Type
Description
model
TAVEditModel<?>
The editing model to activate, which can be BGM, voiceover, text, etc.
Returns
Type:void
Description: No return value. After the call, this model becomes the current active/selected editing object, and both the UI and internal state are updated accordingly.


도움말 및 지원

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

피드백