tencent cloud

User Generated Short Video SDK

Android

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

TAVMagicBase

TAVMagicBase provides static utility methods for the foundational capabilities of the TAVMagic SDK, including SDK initialization, AI model resource installation, thumbnail cache configuration, and logging system setup.
API
Description
initSDK
Initialize the SDK. Two forms are supported:
1. initSDK(Context context, String resPath) Uses static libraries and specifies the light_assets directory.
2. initSDK(Context context, String resPath, String libsPath) Supports a custom dynamic library directory.
Copy AI model files: Copies the downloaded AI model files from srcPath to resDir the resource directory corresponding to . Returns 0 on success, -1 if srcPath does not exist, and -2 if an I/O error occurs.
Copy the AI model files under assets to the specified local path path, which must be consistent with the path passed to initSDK. Returns 0 on success, -1 if context is null, and -2 if an I/O error occurs.
Get the global Application Context saved when the SDK is initialized.
Get the current SDK version number in the format:VERSION_NAME.VERSION_CODE.
Get the currently used Light Assets root directory path.
Set the thumbnail file cache directory root path.
Sets the memory cache size for thumbnails.
Set the maximum disk cache size for thumbnails.
Sets the number of threads used by thumbnail software decoding.
Set SDK log level.setLogLevel(int level)Only set the log level;setLogLevel(int level, ITELogger logger)Also set the log level and access a custom log callback.

initSDK

Description
To initialize TAVMagic SDK, use built-in static library method to load dependencies, install Light Assets resources, and set the thumbnail cache directory.
Usually it can be called once after the application process is started and before the SDK is used for the first time.
Signature
public static boolean initSDK(Context context, String resPath)
Parameters
Parameter
Type
Description
context
Context
Android context object, used internallygetApplicationContext()save global references.
resPath
String
Light Assets root directory path for installationlight_assetsresource.
Returns
Type:boolean
Description: Initialization returns successfullytrue, returns if SO or resource fails to loadfalse.

initSDK

Description
To initialize TAVMagic SDK, use custom dynamic library directory load dependencies (dynamic SO), install Light Assets resources, and set the thumbnail cache directory.
It is suitable for scenarios where business parties manage themselves or download SO to a custom directory.
Signature
public static boolean initSDK(Context context, String resPath, String libsPath)
Parameters
Parameter
Type
Description
context
Context
Android context object, used internallygetApplicationContext()Save global references.
resPath
String
Light Assets root directory path for installationlight_assetsresource.
libsPath
String
Customize the dynamic library directory path for loading TAV related SO files.
Returns
Type:boolean
Description: Initialization returns successfullytrue, returns if SO or resource fails to loadfalse.

installAIModelFile

Description
Copy the AI ​​model file to the specified resource directory.
Copy the AI model file that the customer has downloaded from the local directory to the model directory corresponding to the SDK.
Signature
public static int installAIModelFile(String srcPath, String resDir)
Parameters
Parameter
Type
Description
srcPath
String
The path to the source directory where the AI model file is stored (the directory where the downloaded model file is located).
resDir
String
The root directory used to store beauty resources. This directory is created withXmagicApiThe path passed in is consistent with the object.
Returns
Type:int
Description:
0: Copy successful.
-1srcPathdoesn't exist.
-2:IO error.

installAIModelFilesFromAssets

Description
Will APKassetsCopy the AI model files in the directory to the local specified path.
Suitable for scenarios where AI model files are preset in APK.
Signature
public static int installAIModelFilesFromAssets(Context context, String path)
Parameters
Parameter
Type
Description
context
Context
Android context object, needed when copying assets resources.
path
String
The target path of the copied resource needs to be matched withinitSDKThe incoming Light Assets path remains consistent.
Returns
Type:int
Illustrate:
0: Copy successfully.
-1contextis null.
-2:IO error.

getApplicationContext

Description
Get atinitSDK the Application Context saved at the time is used for global reuse within the SDK to avoid leaking components such as Activity / Service.
Signature
public static Context getApplicationContext()
Parameters
None
Returns
Type:Context
Description: Returns the Application level held internally by the SDKContext; if not initialized, it may benull please make sure you have executed it before callinginitSDK.

getSDKVersion

Description
Get the currently integrated TAVMagic SDK version number.
Signature
public static String getSDKVersion()
Parameters
None
Returns
Type:String
Description: Returns something like"{VERSION_NAME}.{VERSION_CODE}"version string, for example:1.2.3.45.

getLightAssetsDir

Description
Get the current effective Light Assets root directory path.
Signature
public static String getLightAssetsDir()
Parameters
None
Returns
Type:String
Description: return through initSDK incoming and through TAVResourceUtil.fixPathSuffix the processed Light Assets root directory; if not initialized, it may benull.

setThumbnailCacheDir

Description
Set the root directory of the thumbnail file cache, which is used to store the generated thumbnail files (disk cache).
initSDKInternally it will be set by default tocontext.getCacheDir()/thumbnails, if the business needs to customize the directory, this method can be called again to overwrite it.
Signature
public static void setThumbnailCacheDir(String cacheDirPath)
Parameters
Parameter
Type
Description
cacheDirPath
String
Path (folder) to the thumbnail disk cache directory.
Returns
Type:void
Description: No return value.

setThumbnailMemoryCacheSize

Description
Sets the cache size of thumbnails in memory (unit dependentTAVFrameExtractorConfigImplementation), used to control thumbnail memory usage.
Signature
public static void setThumbnailMemoryCacheSize(int cacheSize)
Parameters
Parameter
Type
Description
cacheSize
int
Memory cache size configuration value.
Returns
Type:void
Description: No return value.

setThumbnailCacheCapacity

Description
Set the upper limit of the thumbnail disk cache capacity to control the maximum space occupied by thumbnails on the disk.
Signature
public static void setThumbnailCacheCapacity(long capacity)
Parameters
Parameter
Type
Description
capacity
long
Maximum disk cache capacity (unit: bytes).
Returns
Type:void
Description: No return value.

setThumbnailThreadCount

Description
Set the number of threads used for thumbnail generation/decoding (number of software decoding threads) to balance decoding performance and CPU usage.
Signature
public static void setThumbnailThreadCount(int count)
Parameters
Parameter
Type
Description
count
int
Number of threads (Integer >0).
Returns
Type:void
Description: No return value.

setLogLevel

Description
Set the log output level of the SDK.
This method is a convenience overload, equivalent to setLogLevel(level, null), only controls the internal unified log level and does not connect to custom log callbacks.
Signature
public static void setLogLevel(int level)
Parameters
Parameter
Type
Description
level
int
Log level, recommended Log.VERBOSE / Log.DEBUG / Log.INFO / Log.WARN / Log.ERROR / TAVMagicBase.NO_LOG.
Returns
Type:void
Description: No return value.

setLogLevel

Description
Set the log output level of the SDK and access custom log callbacksITELogger.
Signature
public static void setLogLevel(int level, ITELogger logger)
Parameters
Parameter
Type
Description
level
int
Log level, recommended Log.VERBOSE / Log.DEBUG / Log.INFO / Log.WARN / Log.ERROR / TAVMagicBase.NO_LOG.
logger
ITELogger
Custom log callback interface implementation; pass innullThen it will only be output through the internal TELog and will no longer be called back to the business layer.
Returns
Type:void
Description: No return value.

TAVEditor

TAVEditor provides editing-related operation interfaces such as player control, special effects management, and video synthesis.
API
Description
Initialize the editor and pass in preview parameters (parent container and rendering method, etc.).
release
Destroy the editor and release internal resources.
Set the template directory path and return the template loading result code.
0:SUCCESS
-1:PATH_INVALID
-2:AUTH_INVALID
Get the absolute path of the current template directory.
Obtain the pit configuration information of the specified template path (template placeholder, copywriting, material requirements, etc.).
fork
Copy and create a new editing instance from the current editing object. You can create on-screen/off-screen instances based on preview parameters and decide whether to create a rendering chain.
Read a snapshot of the current rendering screen, and the result is returned asynchronously through the callback.
Gets the rendering size used by the current preview.
Gets the rendering size used for exporting videos based on the export quality level.
Set the canvas width and height ratio (save as ratio, not directly as final pixel width and height).
Adding video resources: Supports appending at the end or inserting a video list at a specified position, and returns the index after successful addition.
Adding picture resources: Supports appending at the end or inserting a picture list at a specified position. You can specify the playback duration and return the index after successful addition.
Get the total number of resources (videos/images) currently being edited.
Click the resource subscript to remove the corresponding video or image resource.
Set the playback time interval of the specified resource (startTimeUs ~ endTimeUs), and the video will be intercepted and played within this interval.
Set the volume of the specified video resource (0–1f).
Sets a uniform background volume (0–1f) for all input resources.
Get the current volume of the specified video resource.
Set the playback speed of the specified video resource.
Get the playback speed of the specified video resource.
Adjust the order of resources, move resources from the old subscript to the new subscript, and return whether the adjustment is successful.
Get the basic information corresponding to the input video path (duration, width, height, etc.).
Get the original video frame extraction interface, you can configure whether to force the use of soft decoding.
addBgm
Add background music, specify the position inserted into the video timeline, material starting time and playback duration, and return a unique BGM ID.
removeBgm
Delete background music by BGM unique ID and return whether deletion is successful.
Adjust the starting position of background music on the video timeline.
Set the playback interval (start time and duration) of the specified background music within the material.
Sets the volume of the specified background music (recommended range 0–3f).
Sets a uniform volume for all background music (recommended range 0–3f).
Get the current volume of the specified background music.
Set the playback speed of the specified background music.
1 is normal
Greater than 1 means it is faster
Less than 1 means slowing down
Get the playback speed of the specified background music.
Set whether the player enables loop playback.
Set up a preview listener to receive callbacks such as playback progress, completion, and errors.
startPlay
Start playing the preview.
Set the time interval for preview playback (start time and duration).
Resumes the preview after pausing.
pausePlay
Pause the current preview playback.
Get the total playing time of the current project (unit: us).
isPlaying
Determine whether it is currently playing.
Move the playback position to a specified time point, optionally non-precise seek (jump to adjacent keyframe).
Sets the clockwise rotation angle (0–360°) of the specified video resource.
Sets the cropping area of ​​the specified video resource (RectF normalized relative to the rendering size).
Set a custom texture processing callback for secondary processing of the rendering texture.
Removed custom texture processing callbacks.
addFilter
Add a filter effect, passing in the LUT path, intensity and time interval, and returning a unique filter ID.
Adjusts the strength of the specified filter (0–1f).
Delete the specified filter effect.
Get the sticker management interface for adding, editing and deleting stickers.
Get the Picture-in-Picture management interface for adding, editing and deleting Picture-in-Picture content.
Set the transition material at the specified location, configure the resource path and duration, and return the transition ID.
Updates the duration of the specified transition effect.
Delete the specified transition effect and return whether the deletion is successful.
Add animation, support basic version and version with scaleMode, return animation ID.
Adjust the playback time interval (start node and duration) of the specified animation.
Delete the specified animation.
Get the rendering result image at a certain point in time, scale it according to the long side and specify the rendering scene, and return it through the callback.
Get the frame to provide an interface to continuously generate rendering results based on the length of the long side and the rendering scene.
Export video: Supports exporting to a specified path according to preset export levels or custom encoding configurations, and obtains progress and results through the listener.
Cancel the video export task currently in progress.
Immediately refresh the current rendering, support calling without parameters or carrying tag and callback, and execute the callback after the refresh is completed.
Get the draft management interface for saving, restoring and managing edited drafts.

initWithPreview

Description
To initialize the player preview environment, you need to pass in parameters such as the parent container and rendering method.
Signature
void initWithPreview(TAVEditorConstants.PreviewParam param)
Parameters
Parameter
Type
Description
param
Preview parameters (parent container, rendering method, etc.).
Returns
Type:void
Description: No return value.

release

Description
Destroy the current editor instance and release internally occupied resources. This editor instance should no longer be used after this call.
Signature
void release()
Parameters
None
Returns
Type:void
Description: No return value.

fork

Description
Creates a new editing instance based on the current editing object.
param.videoView = null:Create an off-screen instance.
param.videoView != null:Create an instance on the screen.
param = null: Create a default off-screen instance.
param != null: According toparam.scene determines whether to create a render chain.
Signature
TAVEditor fork(TAVEditorConstants.PreviewParam param)
Parameters
Parameter
Type
Description
param
Preview configuration parameters for the new instance.
Returns
Type:TAVEditor
Description: A new editor instance created based on the current editing status.

readSnapshot

Description
Read a snapshot (screenshot) of the current rendering result and return it through the callback.
Signature
void readSnapshot(TAVSnapshotCallback callback)
Parameters
Parameter
Type
Description
callback
TAVSnapshotCallback
Called back when the snapshot is obtained successfully.
Returns
Type:void
Description: No return value, the result is returned through callback.

setTemplateDir

Description
Set the template resource directory path.
Signature
int setTemplateDir(String path)
Parameters
Parameter
Type
Description
path
String
Template directory path.
Returns
Type:int
Description: Template authorization and path verification results,TAVTemplateCode:0 means SUCCESS, -1 means PATH_INVALID, -2 means AUTH_INVALID.

getTemplateDir

Description
Get the currently set template directory path.
Signature
String getTemplateDir()
Parameters
None
Returns
Type:String
Description: The absolute path to the template directory.

getTemplateConfig

Description
Obtain configuration information such as the template pit location corresponding to the specified template path.
Signature
TAVTemplateConfig getTemplateConfig(String templatePath)
Parameters
Parameter
Type
Description
templatePath
String
Template path.
Returns
Type:TAVTemplateConfig
Description: Configuration information such as template pit location.

getRenderSize

Description
Get the rendering size used by the current preview, which is generally the actual output resolution of the preview canvas.
Signature
Size getRenderSize()
Parameters
None
Returns
Type:Size
Description: The width and height information used by the current preview rendering.

getGeneratingRenderSize

Description
Gets the render size to use when exporting video based on the export quality level.
The resolution does not exceed the specified level, for example:
VIDEO_LEVEL_360P = 0:360×640
VIDEO_LEVEL_480P = 1:640×480
VIDEO_LEVEL_540P = 2:960×540
VIDEO_LEVEL_720P = 3:1280×720
VIDEO_LEVEL_1080P = 4:1920×1080
Signature
Size getGeneratingRenderSize(@TAVEditorConstants.GenerateLevel int level)
Parameters
Parameter
Type
Description
level
int(@GenerateLevel)
Export quality level (resolution gear).
Returns
Type:Size
Description: The target rendering width and height calculated based on the specified export quality.

setRenderSizeRatio

Description
Set canvas size properties. The width and height passed here represent the aspect ratio of the canvas, and the value here is not used internally as the final pixel width and height.
Signature
void setRenderSizeRatio(int width, int height)
Parameters
Parameter
Type
Description
width
int
Canvas proportional width.
height
int
Canvas proportional height.
Returns
Type:void
Description: No return value.

addVideoClip

Description
Adds a video resource to the end, inserted at the end of the current timeline.
Signature
int addVideoClip(String path)
Parameters
Parameter
Type
Description
path
String
Video file path.
Returns
Type:int
Description: The index of the video clip after successful addition, the subscript starts from 0.

addVideoClip

Description
Insert one or more video resources at the specified location. Resources after the insertion position are deferred.
Signature
int addVideoClip(int clipIndex, List<String> paths)
Parameters
Parameter
Type
Description
clipIndex
int
The target index of the insertion position.
paths
List<String>
List of video source paths to be edited.
Returns
Type:int
Description: Index of the first video clip after successful addition.

addImageClip

Description
Add an image resource to the end to participate in the timeline as an image.
When duration <= 0The default duration is 3 seconds.
Signature
int addImageClip(String path, long duration)
Parameters
Parameter
Type
Description
path
String
Image source path.
duration
long
Image display duration (unit: us, <=0, default 3s).
Returns
Type:int
Description: Image fragment index after successful addition.

addImageClip

Description
Insert one or more image resources at the specified location. Resources after the insertion position are deferred.
When duration <= 0The default duration is 3 seconds.
Signature
int addImageClip(int clipIndex, List<String> paths, long duration)
Parameters
Parameter
Type
Description
clipIndex
int
The target index of the insertion position.
paths
List<String>
Image source path list.
duration
long
Display duration of each picture (unit: us, <=0, default 3s).
Returns
Type:int
Description: Index of the first image fragment after successful addition.

getClipCount

Description
Get the number of resources (video + pictures) being edited on the current timeline.
Signature
int getClipCount()
Parameters
None
Returns
Type:int
Description: The total number of resource clips on the current timeline.

removeClip

Description
Remove the video or image resource at the specified location.
Signature
void removeClip(int clipIndex)
Parameters
Parameter
Type
Description
clipIndex
int
The subscript needs to be removed.
Returns
Type:void
Description: No return value.

setClipRange

Description
Modify the playback duration interval of the specified resource.
For video resources,startTimeUs and endTimeUs the playback interval used to intercept the video.
Signature
void setClipRange(int clipIndex, long startTimeUs, long endTimeUs)
Parameters
Parameter
Type
Description
clipIndex
int
Resource subscript.
startTimeUs
long
Resource playback start time (us).
endTimeUs
long
Resource playback end time (us).
Returns
Type:void
Description: No return value.

setVideoClipVolume

Description
Set the background volume of the specified video resource.
Signature
void setVideoClipVolume(int clipIndex, float volume)
Parameters
Parameter
Type
Description
clipIndex
int
Video resource subscript.
volume
float
Volume, range 0–1f.
Returns
Type:void
Description: No return value.

setAllClipsVolume

Description
Set the background volume of all video/picture resources uniformly.
Signature
void setAllClipsVolume(float volume)
Parameters
Parameter
Type
Description
volume
float
Volume, range 0–1f.
Returns
Type:void
Description: No return value.

getVideoClipVolume

Description
Get the current background volume of the specified video resource.
Signature
float getVideoClipVolume(int clipIndex)
Parameters
Parameter
Type
Description
clipIndex
int
Video subscript.
Returns
Type:float
Description: The current volume value of this video clip.

setVideoClipSpeed

Description
Adjust the playback speed of the specified video resource.
Signature
void setVideoClipSpeed(int clipIndex, float speed)
Parameters
Parameter
Type
Description
clipIndex
int
Video clip.
speed
float
Playback speed multiple.
Returns
Type:void
Description: No return value.

getVideoClipSpeed

Description
Get the current playback speed of the specified video resource.
Signature
float getVideoClipSpeed(int clipIndex)
Parameters
Parameter
Type
Description
clipIndex
int
Video clip.
Returns
Type:float
Description: The current playback speed multiple of this video clip.

updateClipIndex

Description
Adjust the order of assets in the timeline and move an asset from an old location to a new location.
Signature
boolean updateClipIndex(int oldClipIndex, int newClipIndex)
Parameters
Parameter
Type
Description
oldClipIndex
int
Clip before adjustment.
newClipIndex
int
Adjusted clip.
Returns
Type:boolean
Description: Whether the adjustment is successful.

getVideoInfo

Description
Get information about the input video resource, including duration, width, height, etc.
Signature
TAVVideoInfo getVideoInfo(String path)
Parameters
Parameter
Type
Description
path
String
Video file path.
Returns
Type:TAVVideoInfo
Description: Video resource information, such as duration, width, height, etc.

getThumbnailProvider

Description
Get the original video frame extraction interface provider, which can be used to customize thumbnails or frame extraction logic.
Signature
ITAVThumbProvider getThumbnailProvider(boolean forceUseSoftwareDecoding)
Parameters
Parameter
Type
Description
forceUseSoftwareDecoding
boolean
Whether to force the use of soft decoding frame extraction.
Returns
Description: Thumbnail/frame extraction interface provides objects.

addBgm

Description
Add a piece of background music to the timeline.
Signature
int addBgm(String path, long startAtVideoTimeUS, long startTimeUS, long duration)
Parameters
Parameter
Type
Description
path
String
Background music material file path.
startAtVideoTimeUS
long
The time position (us) at which the music was added to the video.
startTimeUS
long
The starting playback time of the audio material itself (us).
duration
long
Audio playback duration (us).
Returns
Type:int
Description: The unique ID of the background music material, used for subsequent operations.

removeBgm

Description
Delete a piece of background music based on a unique ID.
Signature
boolean removeBgm(int bgmID)
Parameters
Parameter
Type
Description
bgmID
int
Unique ID generated when adding background music.
Returns
Type:boolean
Description: Whether the deletion is successful.

updateBgmPlayOffset

Description
Adjust the position of the background music in the video (offset in the timeline).
Signature
void updateBgmPlayOffset(int bgmID, long videoStartTime)
Parameters
Parameter
Type
Description
bgmID
int
Background music unique ID.
videoStartTime
long
Starting position in the video (us).
Returns
Type:void
Description: No return value.

updateBgmPlayRange

Description
Set the playing interval of background music.
Signature
void updateBgmPlayRange(int bgmID, long startTime, long duration)
Parameters
Parameter
Type
Description
bgmID
int
Background music unique ID.
startTime
long
Background music start playing time (us).
duration
long
Background music duration (us).
Returns
Type:void
Description: No return value.

setBgmVolume

Description
Adjust the volume of individual background music.
Signature
void setBgmVolume(int bgmID, float volume)
Parameters
Parameter
Type
Description
bgmID
int
Background music unique ID.
volume
float
Volume, recommended range 0–3f.
Returns
Type:void
Description: No return value.

setAllBgmVolume

Description
Adjust the volume of all background music uniformly.
Signature
void setAllBgmVolume(float volume)
Parameters
Parameter
Type
Description
volume
float
Volume, recommended range 0–3f.
Returns
Type:void
Description: No return value.

getBgmVolume

Description
Get the current volume of the specified background music.
Signature
float getBgmVolume(int bgmID)
Parameters
Parameter
Type
Description
bgmID
int
Background music unique ID.
Returns
Type:float
Description: The volume value of the current background music.

setBgmSpeed

Description
Adjust the playback speed of the specified background music.
Signature
void setBgmSpeed(int bgmID, float speed)
Parameters
Parameter
Type
Description
bgmID
int
Background music unique ID.
speed
float
Playback speed multiple, 1 is normal, greater than 1 becomes faster, less than 1 becomes slower.
Returns
Type:void
Description: No return value.

getBgmSpeed

Description
Get the current playback speed of the specified background music.
Signature
float getBgmSpeed(int bgmID)
Parameters
Parameter
Type
Description
bgmID
int
Background music unique ID.
Returns
Type:float
Description: Current BGM playback speed multiple.

setPlayerLoop

Description
Set whether the player plays in a loop.
Signature
void setPlayerLoop(boolean loop)
Parameters
Parameter
Type
Description
loop
boolean
Whether to loop playback.
Returns
Type:void
Description: No return value.

setVideoPreviewListener

Description
Set the listening callback for preview playback.
Signature
void setVideoPreviewListener(TAVPreviewListener listener)
Parameters
Parameter
Type
Description
listener
Preview playback listening callback.
Returns
Type:void
Description: No return value.

startPlay

Description
Start playing the current timeline content, starting from the current playback position.
Signature
void startPlay()
Parameters
None
Returns
Type:void
Description: No return value.

setPlayTimeRange

Description
Set the playback interval to only play within the specified time range.
Signature
void setPlayTimeRange(long startTime, long duration)
Parameters
Parameter
Type
Description
startTime
long
Playback start time (us).
duration
long
Playback duration (us).
Returns
Type:void
Description: No return value.


resumePlay

Description
Resume playback after pausing (resume playback).
Signature
void resumePlay()
Parameters
None
Returns
Type:void
Description: No return value.

pausePlay

Description
Pause current playback.
Signature
void pausePlay()
Parameters
None
Returns
Type:void
Description: No return value.

getTotalDuration

Description
Get the total playing time of the current timeline.
Signature
long getTotalDuration()
Parameters
None
Returns
Type:long
Description: Total duration (unit: us).

isPlaying

Description
Determine whether it is currently playing.
Signature
boolean isPlaying()
Parameters
None
Returns
Type:boolean
Description:true indicates that it is playing,false indicates not played.

seekToTime

Description
Jump to the specified time point for preview (seek).
Signature
void seekToTime(long timeUs, boolean isInAccurate)
Parameters
Parameter
Type
Description
timeUs
long
Jump target time (us).
isInAccurate
boolean
Whether to enable non-precision seek:true. Jump to adjacent keyframe, false Accurate to the specified location.
Returns
Type:void
Description: No return value.

setClipRotation

Description
Sets the rotation angle (clockwise) of the specified video clip.
Signature
void setClipRotation(int clipIndex, @FloatRange(from = 0, to = 360f) float degrees)
Parameters
Parameter
Type
Description
clipIndex
int
Video clip index.
degrees
float
Rotation angle, range 0–360 (degrees).
Returns
Type:void
Description: No return value.

setClipRect

Description
Sets the cropping area of ​​the specified video clip.
rectF is the clipping rectangle normalized relative to the rendering size.
Signature
void setClipRect(int clipIndex, RectF rectF)
Parameters
Parameter
Type
Description
clipIndex
int
Video clip index.
rectF
RectF
Cropping area rectangle normalized relative to render size.
Returns
Type:void
Description: No return value.

setCustomVideoProcessListener

Description
Set the texture processing callback to perform secondary processing on the rendering texture externally (custom special effects, etc.).
Signature
void setCustomVideoProcessListener(TAVCustomProcessListener listener)
Parameters
Parameter
Type
Description
listener
TAVCustomProcessListener
Custom texture processing callback.
Returns
Type:void
Description: No return value.

removeCustomVideoProcessListener

Description
Removed custom texture processing callbacks.
Signature
void removeCustomVideoProcessListener()
Parameters
None
Returns
Type:void
Description: No return value.

addFilter

Description
Add a filter effect.
Signature
int addFilter(String lutPath, float strength, long startPts, long endPts)
Parameters
Parameter
Type
Description
lutPath
String
Filter material path (LUT file, etc.).
strength
float
Filter strength (0–1f).
startPts
long
Effective start time (us).
endPts
long
Effective end time (us).
Returns
Type:int
Description: The unique ID of the filter, which can be used for subsequent adjustment or deletion.

setFilterStrength

Description
Adjusts the strength of the specified filter.
Signature
void setFilterStrength(int filterId, float strength)
Parameters
Parameter
Type
Description
filterId
int
Filter unique ID.
strength
float
Filter strength (0–1f).
Returns
Type:void
Description: No return value.

removeFilter

Description
Delete the specified filter.
Signature
void removeFilter(int filterId)
Parameters
Parameter
Type
Description
filterId
int
Filter unique ID.
Returns
Type:void
Description: No return value.

getStickerManager

Description
Get the sticker operation management interface for adding, editing, deleting stickers and other operations.
Signature
ITAVStickerManager getStickerManager()
Parameters
None
Returns
Description: Sticker management interface object.

getPipManager

Description
Get the Picture-in-Picture (PIP) operation management interface.
Signature
ITAVPipManager getPipManager()
Parameters
None
Returns
Description: Picture-in-Picture management interface object.

setTransition

Description
Sets the transition material for the specified position.
Signature
int setTransition(int clipIndex, String path, long durationUS)
Parameters
Parameter
Type
Description
clipIndex
int
The position of the transition (the index between fragments).
path
String
Transition resource path.
durationUS
long
Transition duration (us).
Returns
Type:int
Description: Transition material ID.

updateTransitionDuration

Description
Updates the duration of the specified transition.
Signature
void updateTransitionDuration(int transitionId, long durationUS)
Parameters
Parameter
Type
Description
transitionId
int
Transition ID
durationUS
long
New transition duration (us)
Returns
Type:void
Description: No return value.

removeTransition

Description
Delete the specified transition effect.
Signature
boolean removeTransition(int transitionId)
Parameters
Parameter
Type
Description
transitionId
int
Transition ID
Returns
Type:boolean
Description: Whether the deletion is successful.

addMotionEffect

Description
Add a motion (special effect) to the timeline.
Signature
int addMotionEffect(String path, long startOffset, long duration)
Parameters
Parameter
Type
Description
path
String
Motion effect material path
startOffset
long
Effective start time offset (us)
duration
long
Play time (us)
Returns
Type:int
Description: The unique ID of the animation.

addMotionEffect

Description
Add an animation and specify the zoom mode.
Signature
int addMotionEffect(String path, long startOffset, long duration, int scaleMode)
Parameters
Parameter
Type
Description
path
String
Motion effect material path
startOffset
long
Effective start time offset (us)
duration
long
Play time (us)
scaleMode
int
Zoom mode
Returns
Type:int
Description: The unique ID of the animation.

updateMotionEffectPlayRange

Description
Adjust the playback time range of existing animations.
Signature
void updateMotionEffectPlayRange(int motionId, long startOffset, long duration)
Parameters
Parameter
Type
Description
motionId
int
Animation unique ID
startOffset
long
Effective start time offset (us)
duration
long
Play time (us)
Returns
Type:void
Description: No return value.

removeMotionEffect

Description
Delete the specified animation.
Signature
void removeMotionEffect(int motionId)
Parameters
Parameter
Type
Description
motionId
int
Animation unique ID
Returns
Type:void
Description: No return value.

getFrameAtTime

Description
Get the rendering result (single frame) at a certain point in time and return it asynchronously.
Signature
void getFrameAtTime(long positionUs, int longSideLength, int scene, TAVGetFrameListener listener)
Parameters
Parameter
Type
Description
positionUs
long
Time point (us)
longSideLength
int
Output the length of the longest side of the image, and internally calculate the other side proportionally.
scene
int(@RenderScene)
Rendering the scene, reference TAVEditorConstants.SCENE_PLAY
listener
TAVGetFrameListener
Get result callback
Returns
Type:void
Description: No return value, the result is returned through callback.

getFrameProvider

Description
Gets the rendering frame provider, which can be used to generate multiple frames on demand.
Signature
ITAVFrameProvider getFrameProvider(int longSideLength, @TAVEditorConstants.RenderScene int scene)
Parameters
Parameter
Type
Description
longSideLength
int
The length of the long side of the output frame will be scaled to align with the long side according to the rendering ratio.
scene
int(@RenderScene)
Rendering the scene, reference TAVEditorConstants.SCENE_PLAY
Returns
Type:ITAVFrameProvider(can be null)
Description: Frame generator object, used to obtain rendering results by time.

generateVideo

Description
Export the video according to the preset export quality level.
Signature
void generateVideo(int level, String outputPath, TAVEditorGenerateListener listener)
Parameters
Parameter
Type
Description
level
int(@GenerateLevel)
Export quality level (360P/480P/540P/720P/1080P, etc.)
outputPath
String
Export file path
listener
Export process callbacks (progress, completion, errors, etc.)
Returns
Type:void
Description: No return value, the export result is returned through callback.

generateVideo

Description
Export video using custom configuration, and set parameters such as resolution, frame rate, bit rate, Profile, etc.
Signature
void generateVideo(TAVEditorGenerateConfig config, String outputPath, TAVEditorGenerateListener listener)
Parameters
Parameter
Type
Description
config
Export configuration, such as width/height/frameRate/videoBitRate/profile, etc.
outputPath
String
Export file path
listener
Export process callback
Returns
Type:void
Description: No return value, the export result is returned through callback.

cancelGenerate

Description
Cancel the video export task currently in progress.
Signature
void cancelGenerate()
Parameters
None
Returns
Type:void
Description: No return value.

flushImmediately

Description
Immediately refresh the editor's internal state and rendering results to ensure that changes take effect in real time.
Signature
void flushImmediately()
Parameters
None
Returns
Type:void
Description: No return value.

flushImmediately

Description
Immediately refreshes the editor's internal state and executes the specified callback after the refresh is complete.
Signature
void flushImmediately(@Nullable String tag, @Nullable TAVConsumer<String> callback)
Parameters
Parameter
Type
Description
tag
String (can be null)
Flag of the current refresh operation
callback
TAVConsumer<String> (can be null)
The task to be executed by the callback after the refresh is completed, the parameter is tag
Returns
Type:void
Description: No return value.

getDraftManager

Description
Get the draft management interface, which can be used to save and read the draft of the current editing project.
Signature
TAVDraftManager getDraftManager()
Parameters
None
Returns
Type:TAVDraftManager
Description: Draft management interface object.

ITAVThumbProvider

Frame extractor operation interface.
API
Description
Set the frame input source, the incoming video path and the longest side of the target frame size; iflongSide < 16, then the frames are extracted according to the original resolution of the video.
Extract frames in batches according to time intervals, extract consecutive frames from the video according to a given interval (microseconds), and return the results through a callback.
getFrames
Extract frames in batches based on a specified time point list, combined with granularity (seconds/frame) fromptsListExtract the frame at the corresponding position and return the result through the callback.
Obtain a single frame image at a specified time point (microseconds), extract the corresponding frame based on the granularity (seconds/frame), and return the result through a callback.
Gets the cached frames corresponding to the specified video, time point, size and granularity from the memory or disk cache, and may return null.
Cache the frame image corresponding to a certain point in time, the specified size and granularity to the memory/disk for subsequent fast reading.
Get the duration of the current video, in microseconds (us).
Request to stop the currently ongoing frame extraction task.
release
Release frame extraction related resources and clean up the internal state.

setDataSource

Description
Set the input video source and target thumbnail size for frame extraction.
WhenlongSide less thanMIN_LONG_SIDE, frames will be extracted according to the original resolution of the video.
Signature
void setDataSource(String videoPath, int longSide)
Parameters
Parameter
Type
Description
videoPath
String
Video file path
longSide
int
The length of the longest side of the target frame size, if less thanMIN_LONG_SIDE, then use the original resolution to extract the frame
Returns
Type:void
Description: No return value, only configure frame input source and target size.

getFramesInterval

Description
Extract thumbnail frames at regular intervals.
Frames will be extracted from the current data source video in sequence at a given time interval (microseconds) and returned through a callback.
Signature
void getFramesInterval(long intervalUs, FrameExtractingCallback callback)
Parameters
Parameter
Type
Description
intervalUs
long
Frame extraction time interval (unit: microsecond)
callback
FrameExtractingCallback
Frame extraction result callback interface
Returns
Type:void
Note: No return value, the frame extraction result is returned asynchronously through the callback.

getFrames

Description
Extract thumbnail frames in batches according to a specified time point list.
Supports passing in multiple time pointsptsList, and specify a "granularity" to control the frame interval accuracy.
Signature
void getFrames(List<Long> ptsList, float granularity, FrameExtractingCallback callback)
Parameters
Parameter
Type
Description
ptsList
List<Long>
List of time points at which frames need to be extracted (unit: microseconds)
granularity
float
Granularity, which represents how many seconds a frame is, is used to control the accuracy/tolerance of frame extraction intervals.
callback
FrameExtractingCallback
Frame extraction result callback interface
Returns
Type:void
Description: No return value, all frames at the specified time point will be returned asynchronously in batches through callbacks.

getFrameAtTime

Description
Extract a frame of thumbnail at a specified time point.
Passable granularity controls frame interval precision, used to select appropriate keyframes around time.
Signature
void getFrameAtTime(long pts, float granularity, FrameExtractingCallback callback)
Parameters
Parameter
Type
Description
pts
long
Target frame extraction time point (unit: microsecond)
granularity
float
Granularity, which represents how many seconds a frame is, is used to control the accuracy/tolerance of frame extraction intervals.
callback
FrameExtractingCallback
Frame extraction result callback interface
Returns
Type:void
Description: No return value, the frame at the specified time point will be returned asynchronously through the callback.

getCacheFrame

Description
Get the frame extraction result of the specified video at the specified time point from the memory or disk cache.
If the corresponding frame does not exist in the cache, return null.
Signature
Bitmap getCacheFrame(String path, long pts, int longSide, float granularity)
Parameters
Parameter
Type
Description
path
String
Video path, consistent with the input path when extracting frames
pts
long
Target time point (unit: microsecond)
longSide
int
The long side of the frame extraction target, which is used when extracting frames.longSideconsistent
granularity
float
Granularity, used when extracting framesgranularityconsistent
Returns
Type:Bitmap
Description: When the cache is hit, the frame image at the corresponding time point is returned; if the cache does not exist, it is returned null.

saveCacheFrame

Description
Save frame extraction results to cache (memory or disk) for subsequent passesgetCacheFrameQuick reuse.
Signature
void saveCacheFrame(String path, Bitmap bmp, long pts, int longSide, float granularity)
Parameters
Parameter
Type
Description
path
String
Video path
bmp
Bitmap
Frame images that need to be cached
pts
long
The time point corresponding to this frame (unit: microsecond)
longSide
int
Frame target long side size
granularity
float
Frame extraction granularity is used to cache indexes to distinguish frame extraction results of different precisions.
Returns
Type:void
Note: No return value, only responsible for writing to cache.

getDuration

Description
Get the total duration of the current data source video.
Signature
long getDuration()
Parameters
None
Returns
Type:long
Description: The total duration of the video, in microseconds (us).

requestStop

Description
Request to stop the currently ongoing frame extraction task.
Can be used to interrupt time-consuming tasks when the user cancels the operation or the page is destroyed.
Signature
void requestStop()
Parameters
None
Returns
Type:void
Description: There is no return value. The frame extraction process being executed after the call will try to terminate as soon as possible.

release

Description
Release frame-related resources.
Should be called when the frame provider is no longer needed to avoid leaking memory and system resources.
Signature
void release()
Parameters
None
Returns
Type:void
Note: There is no return value. The current instance should no longer be used after the call.

ITAVStickerManager

Sticker operation related interfaces.
API
Description
Create a sticker object, specify the sticker type and sticker resource path, and return the newly createdTAVSticker.
Load a sticker and instantly render it onto the screen.
Remove the specified sticker object, effective immediately.
Add a sticker observer to listen for events such as sticker list changes.
Removes the specified sticker observer.
Get a list of all stickers currently loaded.
Get the corresponding sticker object through the sticker ID, and return if it does not exist.null.
Register a guaranteed font. When PAG does not find a font, it will first fall back to the registered font list instead of the system font, and return whether the registration is successful.

createSticker

Description
Create a sticker instance, but it will not automatically join the rendering queue and requires cooperationloadStickerIt will be displayed on the screen after use.
Signature
TAVSticker createSticker(TAVSticker.TAVStickerType type, String stickerPath)
Parameters
Parameter
Type
Description
type
TAVSticker.TAVStickerType
Sticker type
stickerPath
String
Sticker resource path
Returns
Type:TAVSticker
Note: The newly created sticker object instance only completes the object construction in memory and will not be automatically rendered.

loadSticker

Description
Load a sticker into the current editing scene and immediately participate in rendering.
Signature
void loadSticker(TAVSticker sticker)
Parameters
Parameter
Type
Description
sticker
TAVSticker
Sticker object to load
Returns
Type:void
Description: No return value, the sticker will be added to the rendering queue immediately after the call.

removeSticker

Description
Remove the specified sticker from the current editing scene, and the operation will take effect immediately.
Signature
void removeSticker(TAVSticker sticker)
Parameters
Parameter
Type
Description
sticker
TAVSticker
Sticker object to remove
Returns
Type:void
Description: No return value, the sticker is removed from the rendering queue immediately after the call.

addStickerObserver

Description
Add a sticker observer to monitor changes in the sticker list (such as addition, deletion, update, etc.).
Signature
void addStickerObserver(ITAVStickerContextObserver observer)
Parameters
Parameter
Type
Description
observer
ITAVStickerContextObserver
Sticker list listener
Returns
Type:void
Description: No return value.

removeStickerObserver

Description
Remove the added sticker observer and cancel monitoring of changes in the sticker list.
Signature
void removeStickerObserver(ITAVStickerContextObserver observer)
Parameters
Parameter
Type
Description
observer
ITAVStickerContextObserver
listener to remove
Returns
Type:void
Description: No return value.

getStickers

Description
Get a list of all currently loaded stickers.
Signature
List<TAVSticker> getStickers()
Parameters
None
Returns
Type:List<TAVSticker>
Description: List of all loaded sticker objects in the current scene.

getSticker

Description
Get the corresponding sticker object through the sticker ID.
Signature
TAVSticker getSticker(int id)
Parameters
Parameter
Type
Description
id
int
Sticker ID
Returns
Type:TAVSticker
Description: Specify the sticker object corresponding to the ID; if the sticker does not exist, returnnull.

registerFallbackFont

Description
Register a guaranteed font. When the required font is not found in the PAG animation, priority is given to falling back from the registered font list instead of using the system font directly to ensure a more consistent template display effect.
Signature
boolean registerFallbackFont(String fontPath)
Parameters
Parameter
Type
Description
fontPath
String
Font file path
Returns


Type:boolean
Description:trueIndicates successful registration,falseIndicates a registration failure (e.g. invalid path or read failure).

ITAVPipManager

Picture-in-Picture operation related interfaces.
API
Description
createPip
Create a Picture-in-Picture object, specify the media type and video/picture path, and returnTAVPipExample.
loadPip
Loads a Picture-in-Picture and instantly renders it onto the screen.
removePip
Removes the specified Picture-in-Picture object, effective immediately.
Add a Picture-in-Picture observer to monitor events such as changes in the Picture-in-Picture list.
Removes the specified Picture-in-Picture observer.
getPips
Get a list of all currently loaded Picture-in-Pictures.
getPip
Get the corresponding Picture-in-Picture object through the Picture-in-Picture ID, and return if it does not exist.null.

createPip

Description
Creates a Picture-in-Picture object, but does not automatically join the rendering queue.
Need to cooperate loadPip After use, the Picture-in-Picture content will be displayed on the screen.
Signature
TAVPip createPip(TAVMediaType type, String mediaPath)
Parameters
Parameter
Type
Description
type
TAVMediaType
Resource type (video/image, etc.)
mediaPath
String
Picture-in-Picture media resource path (video or image path)
Returns
Type:TAVPip
Note: The newly created Picture-in-Picture object instance only completes the object construction in memory and will not automatically participate in rendering.

loadPip

Description
Load a Picture-in-Picture into the current editing scene and immediately participate in rendering.
usually through createPip called after creating the Picture-in-Picture object.
Signature
void loadPip(TAVPip pip)
Parameters
Parameter
Type
Description
pip
TAVPip
The Picture-in-Picture object to load
Returns
Type:void
Description: No return value. After calling, the Picture-in-Picture is immediately added to the rendering queue and displayed on the screen.

removePip

Description
Remove the specified Picture-in-Picture from the current editing scene, and the operation will take effect immediately.
Signature
void removePip(TAVPip pip)
Parameters
Parameter
Type
Description
pip
TAVPip
Picture-in-Picture object to remove
Returns
Type:void
Description: No return value, Picture-in-Picture is immediately removed from the rendering queue after being called.

addPipObserver

Description
Add a Picture-in-Picture observer to monitor changes in the Picture-in-Picture list (such as new additions, deletions, attribute updates, etc.).
Signature
void addPipObserver(ITAVPipContextObserver observer)
Parameters
Parameter
Type
Description
observer
ITAVPipContextObserver
Picture-in-Picture list listener
Returns
Type:void
Description: No return value.

removePipObserver

Description
Remove the added Picture-in-Picture observer and cancel the monitoring of changes in the Picture-in-Picture list.
Should be with addPipObserver use in pairs to avoid memory leaks.
Signature
void removePipObserver(ITAVPipContextObserver observer)
Parameters
Parameter
Type
Description
observer
ITAVPipContextObserver
listener to remove
Returns
Type:void
Description: No return value.

getPips

Description
Get the list of all currently loaded and participating Picture-in-Pictures.
Can be used to traverse the Picture-in-Picture status in the current scene or perform batch operations.
Signature
List<TAVPip> getPips()
Parameters
none
Returns
Type:List<TAVPip>
Description: A list of all loaded Picture-in-Picture objects in the current scene; if there is no Picture-in-Picture, an empty list will be returned.

getPip

Description
Get the corresponding Picture-in-Picture object through the Picture-in-Picture ID.
Suitable for quickly locating instances based on the Picture-in-Picture ID saved by the business layer.
Signature
TAVPip getPip(int id)
Parameters
Parameter
Type
Description
id
int
Picture-in-Picture ID
Returns
Type:TAVPip
Description: Specify the Picture-in-Picture object corresponding to the ID; if the Picture-in-Picture does not exist, return null.

TAVSticker

The sticker data structure contains the relevant information required by the sticker.
API
Description
Set the sticker progress processor, used for external custom sticker playback progress calculation, return the current TAVSticker supports chain calls.
Calculate the sticker playback progress (0~1) at the specified time point. Priority is given to using the externally registered progress processor, otherwise it is automatically calculated based on the time range and animation mode.
Set the sticker text content and add the new TAVStickerTextItem replace the original text layer content.
Get the sticker text content and return the currentTAVStickerTextItem, if it does not exist, return null.
Set the sticker image content and add the new TAVStickerImageItem replace the original image layer content.
Get the sticker image content and return the currentTAVStickerImageItem, if it does not exist, return null.
Get the sticker animation duration, in microseconds (us), internally based on PAGFile.duration().
getWidth
Get the width of the PAG resource corresponding to the sticker, in pixel units.
getHeight
Get the height of the PAG resource corresponding to the sticker, in pixel units.
Gets the offset rectangular area of ​​the text area relative to the entire sticker. It is only valid under text stickers (TEXT type).
Gets the offset rectangular area of ​​the image relative to the entire sticker. It is only valid under image stickers (IMAGE type).
getPath
Get the sticker resource file path (local path or assets resource path).
Set whether stickers play automatically,true automatic loop playback,false do not play automatically, return to the current TAVSticker supports chain calls.
Get whether the current sticker has the auto-play flag turned on.
getType
Get sticker types, such as animated stickers, text stickers, picture stickers, etc.
Set the sticker level, starting from 0. The larger the value, the higher the level. Returns the current TAVSticker supports chain calls.
Get the current level index of the sticker, starting from 0. The larger the value, the higher the level.
Get the sticker animation playback mode (loop, play until the last frame is still, stretch duration, etc.).
Set the sticker animation playback mode and synchronously update the TimeStretch mode of the internal PAG.
isVisible
Gets whether the sticker is currently visible.
Set whether the sticker is visible and control whether the sticker is displayed in the rendering result.
Set the effective time interval of the sticker, synchronize the time range to the internal PAG layer, and return the current TAVSticker supports chain calls.
Set the position of the sticker in the canvas, support incoming PointF or x/y coordinate, returns the current TAVSticker supports chain calls.
setScale
Set the overall scaling of the sticker and return to the current TAVSticker supports chain calls.
Set the minimum zoom ratio allowed by the sticker and return the current TAVSticker supports chain calls.
Set the maximum zoom ratio allowed by the sticker and return the current TAVSticker supports chain calls.
setRotate
Set the sticker rotation angle in degrees and return the current TAVSticker supports chain calls.
Set whether the sticker is editable (whether it responds to gestures and other interactions) and returns the current TAVSticker supports chain calls.
clone
Clone the current sticker object,clone() it is the default shallow copy and is called internally.clone(boolean deep).
clone
Clone the current sticker object,clone(boolean deep) you can control whether to make deep copies of text and picture layers.

setProgressHandler

Description
Set up a sticker progress processor for playback progress calculation logic of external custom stickers.
After setting, the externally provided will be called first when rendering.ITAVStickerProgressHandler.
Signature
public TAVSticker setProgressHandler(ITAVStickerProgressHandler progressHandler)
Parameters
Parameter
Type
Description
progressHandler
ITAVStickerProgressHandler
Custom sticker progress processor callback interface
Returns
Type:TAVSticker
Description: Returns the current TAVSticker instance to facilitate chain calling.

computeProgress

Description
Calculate the sticker playback progress at a given point in time.
If set progressHandler, then call it firstcomputeProgress, otherwise according to the sticker duration, time range andanimationModeAutomatic calculation:
The default mode is loop playback;
FREEZEPlay to the last frame and then stop;
SCALE_UPPlay at a slower speed if the user selects a duration greater than the original duration.
Signature
public double computeProgress(long presentationTimeUs)
Parameters
Parameter
Type
Description
presentationTimeUs
long
Current time point (unit: microsecond)
Returns
Type:double
Description: Sticker playback progress, range is [0.0, 1.0].

setTextItem

Description
Set the text content of the sticker.
The original text layer will be maintained internally.layerIndex only replace text content data.
Signature
public void setTextItem(TAVStickerTextItem textItem)
Parameters
Parameter
Type
Description
textItem
TAVStickerTextItem
text content object
Returns
Type:void
Description: No return value.

getTextItem

Description
Get the current text content object of the sticker.
If the sticker does not contain a text layer or the reading fails, return null.
Signature
public TAVStickerTextItem getTextItem()
Parameters
None
Returns
Type:TAVStickerTextItem
Description: The text content object of the current sticker; if there is no text layer, it will be returnednull.

setImageItem

Description
Set the picture content of the sticker.
The original image layer will be maintained internally.layerIndex, only replaces the image content data.
Signature
public void setImageItem(TAVStickerImageItem imageItem)
Parameters
Parameter
Type
Description
imageItem
TAVStickerImageItem
Image content object
Returns
Type:void
Description: No return value.

getImageItem

Description
Get the current image content object of the sticker.
If the sticker does not contain a picture layer or the reading fails, return null.
Signature
public TAVStickerImageItem getImageItem()
Parameters
None
Returns
Type:TAVStickerImageItem
Description: The image content object of the current sticker; if there is no image layer, it will be returnednull.

durationTime

Description
Gets the duration of the sticker animation.
Signature
public long durationTime()
Parameters
None
Returns
Type:long
Description: The total duration of the sticker animation (unit: microseconds). Like pagFile returns 0 if empty.

getWidth

Description
Get the width of the PAG resource corresponding to the sticker.
Signature
public int getWidth()
Parameters
None
Returns
Type:int
Description: The width of the PAG file in pixels. Like pagFile returns 0 if empty.

getHeight

Description
Get the height of the PAG resource corresponding to the sticker.
Signature
public int getHeight()
Parameters
None
Returns
Type:int
Description: The height of the PAG file in pixels. Like pagFile returns 0 if empty.

getTextOffsetRect

Description
Gets the offset rectangular area of ​​the text layer relative to the entire sticker content.
Only if the sticker type isTAVStickerType.TEXTvalid; other types returnnull.
Internally, newPAGPlayerTo avoid the situation where the visible area is 0.
Signature
public RectF getTextOffsetRect()
Parameters
None
Returns
Type:RectF
Description: The offset rectangle of the text relative to the PAG canvas; if the sticker type is not text or the data is invalid, it will be returnednull.

getImageOffsetRect

Description
Gets the offset rectangular area of ​​the image content relative to the entire sticker content.
Internally, the image will be scaled and centered proportionally according to the width, height and PAG size, and the final surrounding rectangle in the PAG will be calculated.
Only if the sticker type is TAVStickerType.IMAGE and when the picture is valid, a valid rectangle is returned.
Signature
public RectF getImageOffsetRect()
Parameters
None
Returns
Type:RectF
Description: The offset rectangle of the picture relative to the PAG canvas; if the type is not a picture sticker or the picture is invalid, it will be returnednull.

getPath

Description
Get the sticker resource file path.
Signature
public String getPath()
Parameters
None
Returns
Type:String
Description: The path of the sticker resource (*.pag file), which can be a local path or a resource path under assets.

setAutoPlay

Description
Set whether stickers play automatically.
Signature
public TAVSticker setAutoPlay(boolean autoPlay)
Parameters
Parameter
Type
Description
autoPlay
boolean
true indicates automatic playback,false indicates no automatic playback
Returns
Type:TAVSticker
Description: Returns the current TAVSticker instance to facilitate chain calling.

isAutoPlay

Description
Get whether the current sticker automatically plays.
Signature
public boolean isAutoPlay()
Parameters
None
Returns
Type:boolean
Description:true indicates automatic playback,false indicates no automatic playback.

getType

Description
Gets the type of sticker.
Signature
public TAVStickerType getType()
Parameters
None
Returns
Type:TAVStickerType
Description: Sticker type enumeration, such as MOTIONTEXTIMAGE.

setLayerIndex

Description
Set the level information of the sticker.
Starting from 0, the larger the value, the higher the level, and the higher it is displayed.
Signature
public TAVSticker setLayerIndex(int layerIndex)
Parameters
Parameter
Type
Description
layerIndex
int
Sticker level index
Returns
Type:TAVSticker
Description: Returns the current TAVSticker instance to facilitate chain calling.

getLayerIndex

Description
Get sticker level information.
Signature
public int getLayerIndex()
Parameters
None
Returns
Type:int
Description: The sticker level starts from 0. The larger the value, the higher the level.

getAnimationMode

Description
Get the sticker animation playback method.
Signature
public TAVStickerAnimationMode getAnimationMode()
Parameters
None
Returns
Type:TAVStickerAnimationMode
Description: Current sticker animation playback mode, such as DEFAULT(cycle),FREEZE(Still after playing),SCALE_UP(slow playback).

setAnimationMode

Description
Set the sticker animation playback method and synchronously update the time stretching mode of the internal PAG.
Signature
public void setAnimationMode(TAVStickerAnimationMode animationMode)
Parameters
Parameter
Type
Description
animationMode
TAVStickerAnimationMode
Sticker animation playback mode
Returns
Type:void
Description: No return value.

isVisible

Description
Gets whether the sticker is currently visible.
Signature
public boolean isVisible()
Parameters
None
Returns
Type:boolean
illustrate:trueIndicates that the sticker is currently visible,falseIndicates invisible.

setVisible

Description
Set whether the sticker is visible.
Signature
public void setVisible(boolean visible)
Parameters
Parameter
Type
Description
visible
boolean
Is it visible?trueto be visible
Returns
Type:void
Description: No return value.

setTimeRange

Description
Set the display time interval of stickers in the timeline (overrides the method of the same name in the parent class).
At the same time, the time interval synchronization will be set internallyPAGFileon the layer.
Signature
@Override public TAVSticker setTimeRange(TAVTimeRange timeRange)
Parameters
Parameter
Type
Description
timeRange
TAVTimeRange
The time range of the sticker on the timeline
Returns
Type:TAVSticker
Description: Returns the currentTAVSticker instance to facilitate chain calling.

setPosition(PointF)

Description
Set the position of the sticker in the canvas (override the parent class method with the same name), the coordinates are normalized coordinates or specific coordinates (depending on the parent class definition).
Signature
@Override public TAVSticker setPosition(PointF point)
Parameters
Parameter
Type
Description
point
PointF
Sticker center position coordinates
Returns
Type:TAVSticker
Description: Returns the current TAVSticker instance to facilitate chain calling.

setPosition(float x, float y)

Description
Set the sticker's position in the canvas via x and y coordinates (overrides the method of the same name in the parent class).
Signature
@Override public TAVSticker setPosition(float x, float y)
Parameters
Parameter
Type
Description
x
float
X coordinate
y
float
Y coordinate
Returns
Type:TAVSticker
Description: Returns the current TAVSticker instance to facilitate chain calling.

setScale

Description
Set the overall scaling ratio of the sticker (override the method of the same name in the parent class).
Signature
@Override public TAVSticker setScale(float scale)
Parameters
Parameter
Type
Description
scale
float
scaling factor
Returns
Type:TAVSticker
Description: Returns the current TAVSticker instance to facilitate chain calling.

setMinScale

Description
Set the minimum scaling allowed by the sticker (overrides the method of the same name in the parent class).
Signature
@Override public TAVSticker setMinScale(float minScale)
Parameters
Parameter
Type
Description
minScale
float
Minimum zoom ratio
Returns
Type:TAVSticker
Description: Returns the current TAVSticker instance to facilitate chain calling.

setMaxScale

Description
Set the maximum zoom ratio allowed by the sticker (overrides the method of the same name in the parent class).
Signature
@Override public TAVSticker setMaxScale(float maxScale)
Parameters
Parameter
Type
Description
maxScale
float
Maximum zoom ratio
Returns
Type:TAVSticker
Description: Returns the current TAVSticker instance to facilitate chain calling.

setRotate

Description
Set the sticker rotation angle (override the method of the same name in the parent class).
Signature
@Override public TAVSticker setRotate(float rotate)
Parameters
Parameter
Type
Description
rotate
float
Rotation angle, unit: degrees
Returns
Type:TAVSticker
Description: Returns the current TAVSticker instance to facilitate chain calling.

setEditable

Description
Set whether the sticker is editable (override the method of the same name in the parent class).
For example, whether it can respond to gestures such as zooming, dragging, rotating, etc.
Signature
@Override public TAVSticker setEditable(boolean editable)
Parameters
Parameter
Type
Description
editable
boolean
Whether to allow editing
Returns
Type:TAVSticker
Description: Returns the current TAVSticker instance to facilitate chain calling.

clone

Description
Clone the current sticker object and create a new one TAVSticker instance.
Equivalent to callingclone(false), that is, shallow copy text and image item references.
Signature
@Override public TAVSticker clone()
Parameters
None
Returns
Type:TAVSticker
Description: The cloned sticker object contains the same basic attributes and properties as the original sticker.PAGFile content.

clone(boolean deep)

Description
Clone the current sticker object and specify whether to make a deep copy.
Whendeep == falsehour:textListimageListThe reference is shared with the original object;
Whendeep == trueTime: Re-read the text and picture layers, and copy the data one by one to form an independent copy.
Signature
public TAVSticker clone(boolean deep)
Parameters
Parameter
Type
Description
deep
boolean
Whether to perform deep copy:truedeep copy,falseShallow copy
Returns
Type:TAVSticker
Description: The cloned sticker object contains copies of attributes such as time range, position, zoom, rotation, and editability state.

TAVPip

The Picture-in-Picture data structure contains the relevant information required for Picture-in-Picture.
API
Description
getPath
Get the Picture-in-Picture resource file path.
Get the media type (video or picture) corresponding to Picture-in-Picture.
getVolume
Get the current volume of Picture-in-Picture, the range is [0, 3].
setVolume
Set the Picture-in-Picture volume, the range is [0, 3].
getSpeed
Get the current playback speed of Picture-in-Picture.
setSpeed
Set the Picture-in-Picture playback speed.
Gets the starting time of Picture-in-Picture on the main video timeline (unit: microseconds).
Set the starting time of Picture-in-Picture on the main video timeline (unit: microseconds).
Get the original media duration of Picture-in-Picture (unit: microseconds).
getWidth
Gets the width (pixels) of the Picture-in-Picture source media.
getHeight
Gets the height (in pixels) of the Picture-in-Picture source media.
Set the effective interval of Picture-in-Picture on the timeline and return to the currentTAVPip, supports chain calls.
Set the position of Picture-in-Picture in the canvas (supports passing inPointFor x/y coordinates), returns the currentTAVPip, supports chain calls.
setScale
Set the overall zoom ratio of Picture-in-Picture and return the currentTAVPip, supports chain calls.
Set the minimum zoom ratio allowed by Picture-in-Picture and return the currentTAVPip, supports chain calls.
Set the maximum zoom ratio allowed by Picture-in-Picture and return the currentTAVPip, supports chain calls.
setRotate
Set the Picture-in-Picture rotation angle and return to the currentTAVPip, supports chain calls.
Set whether the Picture-in-Picture is editable (whether to respond to gestures and other interactions), and return the currentTAVPip, supports chain calls.
clone
Clone the current Picture-in-Picture object and generate a new one with the same path, time interval, transformation parameters and other attributes.TAVPipExample.

getPath

Description
Get the path of the current Picture-in-Picture resource.
Signature
public String getPath()
Parameters
none
Returns
Type:String
Description: Picture-in-Picture media resource path, usually the local file path of a video or picture.

getMediaType

Description
Gets the media type of the Picture-in-Picture resource.
Signature
public TAVMediaType getMediaType()
Parameters
none
Returns
Type:TAVMediaType
Description: The media type of the Picture-in-Picture resource, such as video, picture, etc.

getVolume

Description
Get the current Picture-in-Picture volume.
Signature
public float getVolume()
Parameters
none
Returns
Type:float
Description: Current volume value of Picture-in-Picture, range is [0, 3]. 1 represents the original volume.

setVolume

Description
Set the Picture-in-Picture volume.
Signature
public void setVolume(float volume)
Parameters
Parameter
Type
Description
volume
float
Picture-in-Picture volume, range is [0, 3], 1 is the original volume
Returns
Type:void
Description: No return value.

getSpeed

Description
Get the playback speed of Picture-in-Picture.
Signature
public float getSpeed()
Parameters
none
Returns
Type:float
Description: Multiplier of the current playback speed of Picture-in-Picture. Usually 1 is normal speed.

setSpeed

Description
Set the Picture-in-Picture playback speed.
Signature
public void setSpeed(float speed)
Parameters
Parameter
Type
Description
speed
float
Playback speed multiple, recommended range [0, 1]
Returns
Type:void
Description: No return value.

getStartAtVideoUs

Description
Get the starting time of Picture-in-Picture in the main video timeline.
Signature
public long getStartAtVideoUs()
Parameters
none
Returns
Type:long
Description: The start time of Picture-in-Picture in the main video, in microseconds (us).

setStartAtVideoUs

Description
Set the start time of Picture-in-Picture in the main video timeline.
Signature
public void setStartAtVideoUs(long startAtVideoUs)
Parameters
Parameter
Type
Description
startAtVideoUs
long
The start time of Picture-in-Picture in the main video, unit: microsecond (us)
Returns
Type:void
Description: No return value.

getOriginDuration

Description
Get the duration of the Picture-in-Picture original media.
Signature
public long getOriginDuration()
Parameters
none
Returns
Type:long
Description: The original media duration of the Picture-in-Picture (the duration before clipping), in microseconds (us).

getWidth

Description
Gets the width of the Picture-in-Picture in pixels.
Internally returned is the actual width of the source media.
Signature
public int getWidth()
Parameters
none
Returns
Type:int
Description: Picture-in-Picture media width (pixels).

getHeight

Description
Gets the height of the Picture-in-Picture in pixels.
Internally returned is the actual height of the source media.
Signature
public int getHeight()
Parameters
none
Returns
Type:int
Description: Picture-in-Picture media height (pixels).

setTimeRange

Description
Set the display time interval of Picture-in-Picture on the timeline.
Will overwrite the corresponding implementation in the parent class and return the currentTAVPipto support chained calls.
Signature
public TAVPip setTimeRange(TAVTimeRange timeRange)
Parameters
Parameter
Type
Description
timeRange
TAVTimeRange
Picture-in-Picture time range in timeline
Returns
Type:TAVPip
Description: Returns the the current TAVPip instance to facilitate chained calling.

setPosition(PointF)

Description
To set the position of Picture-in-Picture in the canvas (center point position), usePointFspecified.
Signature
public TAVPip setPosition(PointF point)
Parameters
Parameter
Type
Description
point
PointF
Picture-in-Picture center position coordinates
Returns
Type:TAVPip
Description: Returns the current TAVPip instance to facilitate chained calling.

setPosition(float x, float y)

Description
Set the position (center point) of the Picture-in-Picture in the canvas through x and y coordinates.
Signature
public TAVPip setPosition(float x, float y)
Parameters
Parameter
Type
Description
x
float
X coordinate
y
float
Y coordinate
Returns
Type:TAVPip
Description: Returns the current TAVPip instance to facilitate chain calling.

setScale

Description
Set the overall Picture-in-Picture scaling ratio.
Signature
public TAVPip setScale(float scale)
Parameters
Parameter
Type
Description
scale
float
scaling factor
Returns
Type:TAVPip
Description: Returns the current TAVPip instance to facilitate chain calling.

setMinScale

Description
Sets the minimum zoom allowed for Picture-in-Picture.
Signature
public TAVPip setMinScale(float minScale)
Parameters
Parameter
Type
Description
minScale
float
Minimum zoom ratio
Returns
Type:TAVPip
Description: Returns the current TAVPip instance to facilitate chain calling.

setMaxScale

Description
Sets the maximum zoom allowed for Picture-in-Picture.
Signature
public TAVPip setMaxScale(float maxScale)
Parameters
Parameter
Type
Description
maxScale
float
Maximum zoom ratio
Returns
Type:TAVPip
Description: Return the currentTAVPipInstance to facilitate chain calling.

setRotate

Description
Set the rotation angle of Picture-in-Picture.
Signature
public TAVPip setRotate(float rotate)
Parameters
Parameter
Type
Description
rotate
float
Rotation angle, unit: degrees
Returns
Type:TAVPip
Description: Returns the current TAVPip instance to facilitate chain calling.

setEditable

Description
Set whether the Picture-in-Picture is editable, such as whether to respond to interactions such as dragging, zooming, and rotating.
Signature
public TAVPip setEditable(boolean editable)
Parameters
Parameter
Type
Description
editable
boolean
Whether to allow editing
Returns
Type:TAVPip
Description: Returns the current TAVPip instance to facilitate chain calling.

clone

Description
Clone the current Picture-in-Picture object and create a new oneTAVPipExample.
Properties such as time range, path, volume, zoom, rotation, position, editable state, etc. will be copied.
Signature
public TAVPip clone()
Parameters
none
Returns
Type:TAVPip
Note: After cloning the Picture-in-Picture object, the internal shared or copied fields remain consistent with the current instance (noteextraInfofor the same reference).

TAVDraftManager

Draft operation related interfaces.
API
Description
Set the path to the draft saving directory. This directory will be used for all subsequent draft reading and writing.
Read the list of all drafts in the current draft saving directory and return them in reverse chronological order.
Delete the draft files and directories corresponding to the specified draft object, and return whether the deletion is successful.
Delete all draft files and directories in the current draft saving directory, and return whether the deletion is successful.
Save the current editing status as a draft, use the given cover image path, and return the generated draft path, or null on failure.
loadDraft
Load the specified draft object and pass it after the loading is completed DraftLoadingCallback callback draft loading result. callback
Set up a draft status listener to monitor draft status changes such as whether it can be undone or redoed.
Reset the draft record and record the draft change history from the beginning.
commit
Submit a draft snapshot. If the effect has not changed since the last submission, this submission will not take effect. Return whether it takes effect.
canUndo
Determine whether there is currently a revocable draft record.
canRedo
Determine whether there are currently redoable draft records.
undo
Perform an undo operation by DraftActionCallback call back the difference result or error message generated by this switching draft.back callbackback callback
redo
To perform a redo operation, pass DraftActionCallback call back the difference result or error message generated by this switching draft.back callback
Get the current draft model instanceTAVDraft.
Set the draft component change listener, when theTAVDraftComponentCallback notification when changes occur.

setDraftStorageDir

Description
Set the root path of the draft saving directory.
If the incoming path does not contain a file delimiter at the end (File.separator), will be automatically appended internally.
Signature
public static void setDraftStorageDir(String storageDir)
Parameters
Parameter
Type
Description
storageDir
String
The absolute path to the root directory where drafts are saved
Returns
Type:void
Description: No return value.

readDraftList

Description
Read all draft records in the current draft storage directory.
Invalid directories are automatically filtered and sorted in reverse order by timestamp (most recent draft first).
Signature
public static List<TAVDraft> readDraftList()
Parameters
None
Returns
Type:List<TAVDraft>
Description: Returns the parsed draft list; when the directory does not exist or there is no valid draft, an empty list is returned.

deleteDraft

Description
Delete the specified draft object and its corresponding local directory.
Signature
public static boolean deleteDraft(TAVDraft draft)
Parameters
Parameter
Type
Description
draft
TAVDraft
Draft objects that need to be deleted
Returns
Type:boolean
Description: Whether the deletion operation is executed successfully; whendraft == nullReturn directly whenfalse

deleteAllDrafts

Description
Delete all draft data in the current draft storage directory.
Signature
public static boolean deleteAllDrafts()
Parameters
None
Returns
Type:boolean
Description: Whether the deletion operation was successful.

generateDraft

Description
Save the current editing status as a draft record, and generate the corresponding draft directory and description information.
The serialization logic needs to be completed in the specific implementation class.
Signature
public abstract String generateDraft(String thumbPath)
Parameters
Parameter
Type
Description
thumbPath
String
The path to the draft cover image file
Returns
Type:String
Description: Returns the draft directory path when saving successfully; returns if saving fails.null.

loadDraft

Description
Loads draft content from the specified draft object and restores it to the current editor/project.
Loading process through callbackDraftLoadingCallbackNotify results and status.
Signature
public abstract void loadDraft(TAVDraft draft, DraftLoadingCallback callback)
Parameters
Parameter
Type
Description
draft
TAVDraft
Draft object that needs to be loaded
callback
Draft loading process and result callback
Returns
Type:void
Description: No return value, the result is notified asynchronously through callback.

setDraftStateListener

Description
Set up a draft status listener to monitor draft-related life cycle events (such as saving, restoring, cleaning, etc.).
Signature
public abstract void setDraftStateListener(DraftStateListener listener)
Parameters
Parameter
Type
Description
listener
Draft status listener implementation
Returns
Type:void
Description: No return value.

resetDraftRecord

Description
Reset the current draft record link and clear the historical operation record cache.
Usually called when starting a new editing session or re-entering the project.
Signature
public abstract void resetDraftRecord()
Parameters
None
Returns
Type:void
Description: No return value.

commit

Description
Submit a draft snapshot to record the current editing status.
If the editing status has not changed since the last submission, this submission will not take effect.
Signature
public abstract boolean commit(String tag)
Parameters
Parameter
Type
Description
tag
String
The tag string for this submission
Returns
Type:boolean
Description: Is this submission truly effective?true Indicates that a new draft record is generated, false Indicates that the status has not changed and no new records have been generated.

canUndo

Description
Determine whether there is currently an undoable draft operation record.
Signature
public abstract boolean canUndo()
Parameters
None
Returns
Type:boolean
Description:true Indicates that the undo operation can currently be performed, false Indicates that there is no undoable record.

canRedo

Description
Determine whether there is currently a draft operation record that can be rolled back (redoed).
Signature
public abstract boolean canRedo()
Parameters
None
Returns
Type:boolean
Description:true Indicates that rollback/redo operations can currently be performed, false Indicates that there is no rollback record.

undo

Description
Perform an undo operation to roll back the editing status to the previous draft record.
Operation result passed DraftActionCallback Callback notification.
Signature
public abstract void undo(DraftActionCallback callback)
Parameters
Parameter
Type
Description
callback
Undo action result callback
Returns
Type:void
Note: No return value, the revocation result is notified asynchronously through callback.

redo

Description
Perform a rollback (redo) operation to advance the editing status to the next draft record.
Operation result passed DraftActionCallback Callback notification.
Signature
public abstract void redo(DraftActionCallback callback)
Parameters
Parameter
Type
Description
callback
Rollback action result callback
Returns
Type:void
Note: No return value, the rollback result is notified asynchronously through the callback.

getCurrentDraft

Description
Get the draft model object corresponding to the current editing status.
Usually used to display current draft information or synchronize with external business.
Signature
public abstract TAVDraft getCurrentDraft()
Parameters
None
Returns
Type:TAVDraft
Description: The draft instance corresponding to the current editing status.

setDraftComponentObserver

Description
Set up a listener for draft component changes to listen for change events in draft internal components (such as tracks, special effects, materials, etc.).
Signature
public abstract void setDraftComponentObserver(DraftComponentObserver observer)
Parameters
Parameter
Type
Description
observer
Draft component change listener instance
Returns
Type:void
Description: No return value.

DraftStateListener

Draft status callback

onUndoStateChange

Description
Draft undo ability status callback. Triggered when the current undoable state changes, used to update the UI state (such as the availability of the undo button).
Signature
void onUndoStateChange(boolean canUndo)
Parameters
Parameter
Type
Description
canUndo
boolean
Whether there is currently a reversible operation record status
Returns
Type:void
Description: No return value, status changes are notified through callbacks.

onRedoStateChange

Description
Draft rework ability status callback. Triggered when the current redoable status changes, used to update UI status (such as the availability of a redo button).
Signature
void onRedoStateChange(boolean canRedo)
Parameters
Parameter
Type
Description
canRedo
boolean
Whether there is currently a redoable operation record status
Returns
Type:void
Description: No return value, status changes are notified through callbacks.

DraftActionCallback

Draft undo/redo callback.

onCheckoutDraft

Description
This method is called back when performing an undo or redo operation, and is used to notify the business side which draft submission has been switched to and what differences have occurred during this switching process.
Signature
void onCheckoutDraft(String tag, TAVDiffResult diffResult)
Parameters
Parameter
Type
Description
tag
String
The tag (TAG) passed in when submitting a draft is used to distinguish different submissions
diffResult
TAVDiffResult
The change result model that occurred when switching drafts this time
Returns
Type:void
Description: No return value, the caller is notified of the draft switching result and difference information through callback.

onError

Description
This method is called back when an error occurs during the undo or redo process, and is used to notify the business side for error handling or clarification.
Signature
void onError(int errorCode)
Parameters
Parameter
Type
Description
errorCode
int
Error code, used to identify specific error types
Returns
Type:void
Description: There is no return value, and the caller is notified of the abnormal scenario through callback.

DraftLoadingCallback

Load draft callback.

onDraftLoadingFinished

Description
Callback method when the draft is loaded.
Called after the draft recovery operation is completed, loadDraft triggered after the draft recovery operation is completed, used to notify the business side of the result status and related information of this draft loading. is used to notify the business side of the result status and related information of this draft loading.
Signature
void onDraftLoadingFinished(DraftLoadingResult result)
Parameters
Parameter
Type
Description
result
Draft loading result model, including whether the loading was successful and additional information
Returns
Type:void
Description: No return value, notify the caller of the draft loading result through callback.

DraftComponentObserver

Draft component change monitoring.

onComponentUpdate

Description
Draft component change listening callback.
When any one of the draft TAVDraftComponent, this method will be triggered when changes occur (add, delete, update, etc.) to notify the business side to refresh the UI or synchronize the status.
Signature
void onComponentUpdate(TAVDraftComponent component)
Parameters
Parameter
Type
Description
component
TAVDraftComponent
Changed draft component instance
Returns
Type:void
Description: No return value, notification of external draft component change event through callback.

DraftLoadingResult

The draft loading result data model is used to encapsulate the error information and difference results generated during a draft loading operation.

isSuccess

Description
Determine whether the draft is loaded successfully.
When errors == null or errors.length == 0 is deemed to be loaded successfully.
Signature
public boolean isSuccess()
Parameters
None
Returns
Type:boolean
Description:true indicates that there are no errors in loading this draft;false indicates that there is at least one component loading error during the loading process.

TAVEditorGenerateListener

Export video monitoring.

onGenerateStarted

Description
Callback when the video export task starts, used to notify the business layer that the export process has been started (can be used to update the UI status, such as displaying the loading dialog box, disabling editing operations, etc.).
Signature
void onGenerateStarted()
Parameters
none
Returns
Type:void
Description: No return value, only used as an event notification for the start of export.

onGenerateProgress

Description
Progress callback during export.
Progress with 0-1 is returned in the form of a floating point number, and the calling frequency is controlled by the internal export process.
Signature
void onGenerateProgress(float progress)
Parameters
Parameter
Type
Description
progress
float
Export progress, ranging from 0.0 to 1.0
Returns
Type:void
Note: There is no return value. The business layer can update the UI such as the progress bar according to the progress.

onGenerateCompleted

Description
Called back when the export process ends normally (regardless of whether the result is success or failure, usually byTAVEditorGenerateResultstatus field distinction).
Signature
void onGenerateCompleted(TAVEditorGenerateResult result)
Parameters
Parameter
Type
Description
result
TAVEditorGenerateResult
Export result data model, such as export file path, status code, etc.
Returns
Type:void
Note: There is no return value. The business layer can process the export results (such as saving path, prompting the user, etc.) in this callback.

onGenerateCanceled

Description
Called back when the export task is canceled (for example, the user actively cancels or the upper-layer logic interrupts the export process).
Signature
void onGenerateCanceled()
Parameters
none
Returns
Type:void
Description: No return value, the business layer can restore the UI state or perform cleanup operations in this callback.

TAVEditorGenerateConfig

Customized export configuration overall structure, including video configurationVideoConfigand audio configurationAudioConfig.
used for TAVEditor.generateVideo(TAVEditorGenerateConfig config, String outputPath, TAVEditorGenerateListener listener)interface to achieve fine control over parameters such as export resolution, frame rate, bit rate, number of channels, etc.

VideoConfig

Description
Video export configuration items are used to control parameters such as export resolution, frame rate, video bit rate, and encoding profile.
In use TAVEditorGenerateConfig when customizing the export configuration, adjust the video output quality and duration constraints by modifying the fields of this object.
Parameters
Parameter
Type
Description
width
int
Export video width in pixels, default is 720.
height
int
Export video height in pixels, default is 1280.
frameRate
int
Export video frame rate (FPS), the default value is 30.
videoBitRate
int
Video bit rate (bps, bits per second), the default value is approximately 720 * 1280 * 30 * 0.08, and the recommended range of bit rate factor is 0.05~0.1.
profile
VideoConfig.Profile
H.264 encoding profile, default H264_BASE, optional: H264_BASE / H264_HIGH.
maxGenerateDuration
long
Maximum export duration (microseconds), content exceeding this duration will be cropped; the default value is -1, which means no limit.
minGenerateDuration
long
Minimum export duration (microseconds), an error will be reported if it is less than this duration; the default value is -1, which means no limit.

AudioConfig

Description
Audio export configuration items, control the number of channels, sampling rate and audio bit rate of exported audio.
The SDK uses AAC format for audio encoding, and the bit depth is fixed at 16bit.
Parameters
Parameter
Type
Description
channelCount
int
Number of channels, the default value is 1, optional: mono (1), stereo (2).
sampleRate
int
Sampling rate (Hz), default value is 44100.
audioBitRate
int
Audio bit rate (bps), the default value is 128000 (about 128kbps); uncompressed bitrate = sampling rate × bit depth × number of channels.

TAVPreviewListener

Player preview progress monitoring.

onPreviewProgress

Description
Preview playback progress callback.
It is called periodically during the video preview playback process to notify the current playback time position.
Signature
void onPreviewProgress(long time)
Parameters
Parameter
Type
Description
time
long
Current preview time, unit: us (microseconds)
Returns
Type:void
Description: No return value, inform the current preview playback progress through callback.

onStatusChanged

Description
Preview player status change callback.
Triggered when the status of the preview player (such as play, pause, complete, etc.) changes, used to drive UI updates or business logic processing.
Signature
void onStatusChanged(@Nullable TAVEditorConstants.EditorPlayerStatus status)
Parameters
Parameter
Type
Description
status
TAVEditorConstants.EditorPlayerStatus|null
The current state of the player; may be null indicates unknown or uninitialized
Returns
Type:void
Description: No return value, notify the preview player of status changes through callback.

TAVEditorConstants

Video editing key type definitions.

PreviewParam

Description
Short-video preview parameter configuration structure.
Used when initializing editor preview (e.g. TAVEditor.initWithPreview(PreviewParam param)TAVEditor.fork(PreviewParam param)), specify the preview container, gesture layer, whether to automatically/loop playback, rendering scene, preview rendering size, etc.
Parameters
Parameter
Type
Description
videoView
FrameLayout
The parent container View used to host the video preview screen. A rendering Surface, etc. will be created internally in this container.
contentView
TAVWidgetContentView
Gesture operation layer View, used to carry touch events and display of interactive components such as stickers and Picture-in-Picture
autoPlay
boolean
Whether to automatically start playing after preview initialization is completed, the default value is true
loopPlay
boolean
Whether to loop playback and whether to automatically start from the beginning after playing to the end. The default value is true
scene
int (@RenderScene)
Usage scenario, default SCENE_PLAY
SCENE_PLAY: Preview scene
SCENE_EXPORT Export scene
renderSize
Size|null
Specifies the rendering size (width and height), ifnull then the SDK automatically adapts according to the input material and container.

RenderScene(SCENE_PLAY / SCENE_EXPORT)

Description
Preview/rendering uses scene constants and corresponding annotations to control the behavior of the rendering link in the "preview" or "export" scene.
Parameters
constant name
Type
Description
SCENE_PLAY
int
Preview scene, used for real-time preview and interactive rendering of editing pages
SCENE_EXPORT
int
Export scenes for high-quality off-screen rendering and video export

EditorPlayerStatus

Description
Editor preview player status enum.
Used to passTAVPreviewListener.onStatusChangedThe callback notifies the business side of the current playback status so that the UI and logic control can be updated.
Parameters
enumeration value
Description
IDLE
Idle state, not yet prepared or released
READY
Ready for playback
PLAYING
Now playing
STOPPED
Stopped playing
PAUSED
Playback paused
COMPLETED
Playing to the end of the preset interval triggers the completion callback
FINISHED
Playback process ends
ERROR
An error occurred during playback
REPLAY
Restart playback after completion (state triggered by loop playback)

GenerateLevel (video quality level)

Description
Short-video export quality level constant, used to quickly export videos at preset resolutions.
Usually inTAVEditor.generateVideo(@GenerateLevel int level, ...)is passed in as the export quality parameter.
Parameters
constant name
Type
Resolution description
VIDEO_LEVEL_480P
int
Compressed to 480P (640×480)
VIDEO_LEVEL_540P
int
Compressed to 540P (960×540)
VIDEO_LEVEL_720P
int
Compressed to 720P (1280×720)
VIDEO_LEVEL_1080P
int
Compressed to 1080P (1920×1080)

FillMode (canvas background fill mode)

Description
Canvas background fill mode constant, used to control the background fill effect when the ratio of the video and canvas is inconsistent.
Parameters
constant name
Type
Description
FILL_MODE_GAUSSIAN_BLUR
int
Use Gaussian Blur to process background fill
FILL_MODE_SOLID_COLOR
int
Fill the canvas with a solid color background

OpenGL rendering thread constants

Description
Constants that control which thread the render link runs on, for internal or advanced usage to differentiate which GL thread is used by preview/export.
Parameters
constant name
Type
Description
PREVIEW_GL_THREAD
int
GL thread used by preview rendering
GENERATE_GL_THREAD
int
Export the GL thread used for rendering

TAVTemplateCode

Description
Template path settings (such assetTemplateDir), a collection of error code constants.
Used to identify the execution results (success/path error/authentication failure, etc.) when setting the template directory.
Parameters
Constant Name
Type
Description
SUCCESS
int
Set template directory successfully
PATH_INVALID
int
Invalid template directory path
AUTH_INVALID
int
Template authentication failed

Export error code

Error code
Error message
Description
-1
BuildRenderChainManager failed
Render chain creation exception 1
-4
BuildRenderChainManager failed
Render chain creation exception 2
-10
"error code ${errCode}: TAVMagic export error
Problem occurred during export completion
-14
Video frame processing exception during export
-15
Audio frame processing exception when exporting
-16
Exporter initialization video decoding failed
-17
Exporter initialization audio decoding failed
-18
Failed to start encoding
-19
Failed to start decoding
-101
"error code ${errCode}: TAVMagic export error
Failed to start video encoding
-102
Failed to start audio encoding
-103
Video encoding information configuration failed
-104
Audio encoding information configuration failed
-105
Failed to create output file
Failed to create file
-111
"error code ${errCode}: TAVMagic export error
Export rendering exception 1
-112
Export rendering exception 2
-113
Export rendering exception 3
-121
Exception when writing video sample
-122
Exception writing audio sample
-123
End of writing video sample exception
-124
End of writing audio sample exception
-131
Stop muxer exception
-132
Stop encoder exception
-201
Minimum generate duration cannot exceed maximum duration
The set minimum export duration is greater than the maximum export duration
-202
The total generate duration is shorter than the minimum required duration
The total duration is less than the minimum export duration
-203
Retry software encode error. Config is null.
Soft encoding retry failed, configuration file is empty
-1001
Load asset error
Exception loading resources


도움말 및 지원

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

피드백