Contact us

tel:15797766463

mail:business@seeshiontech.com

中文
English
中文
登录/注册

{user.username}

ID: {user.id}

<span><a href="/docs/index.html">首页</a> > <a href="/docs/en-us/editor/group_123.html">SDK</a> > <a href="/docs/en-us/editor/group_130.html">Android SDK</a> > SXTrackGroup</span>

SXTrackGroup

Update time : 2020-08-14 15:17:40

SXTrackGroup

Multiple tracks can be contained in a track group. The tracks in the same group can not be overlapped on the range (in point - out point) of timeline. You can add, delete, and split the tracks to the track group, and also can set the speed of track and manage the timeline of track in the group. Track group only has the reference of track, but does not manage the life-cycle of track. You can create or delete tracks via SXEditManager instance.

SXEditManager.java

/**
 * Add a new track group. 
 *
 * @return The instance object of new group. 
 */
public SXTrackGroup addNewGroup()

/**
 * Delete the group via ID; all tracks in the group will be removed but will not be deleted if there is any track in the group. 
 *
 * @param groupID The ID of group. 
 */
public void removeGroup(String groupID)
/**
 * 
Add a track to the track group at a certain time-point; if the track has been added to the group already, or can not be incompatible, return false.  
 * If the timeline has been set in another group, it is equivalent to invoke {@link SXTrackGroup#setTrackOffset}. 
 *
 * @param track The track to be added. 
 * @param inPoint Relative to the start time of the group.  
 * @return If the track is added successfully, return true, otherwise return false. 
 */
public boolean addTrack(SXTrack track, double inPoint)

/**
 * Remove any track from the group, and its display range will not be changed after removing. 
 *
 * @param trackID The track ID to be removed.  
 * @return Return true if there is such track with ID already, otherwise return false. 
 */
public boolean removeTrack(String trackID)

/**
 * Remove all tracks in the group. 
 */
public void clearTracks()

/**
 * Split the track. The effects added to the track will be removed, or the duration of the track will be shortened after splitting the track. Please regain the related data. 
 * New tracks will automatically added to this group after splitting.
 *
 * @param trackID The track ID to be split. 
 * @param time Relative to the split time of in point on track.
 * @return If finding track fails or the range of split time is beyond the display range of track, return false, otherwise return true.
 */
public SXTrack splitTrack(String trackID, double time)
/**
 * Set the start time for track.   ( in point and duration will be changed.)  
 *
 * @param trackID The ID of track. 
 * @param inPoint Relative to the duration of If it is successful to set the start time for track, return true; if finding track fails, or the in point is over start time or out point, or the track overlaps other tracks, return false.  
 */
public boolean setTrackInPoint(String trackID, double inPoint)

/**
 * Set display duration of track, and the duration is allowed to be over the end time, which will result in looping the track automatically. (out point and duration will be changed.)  
 *
 * @param trackID  Track ID.
 * @param duration Display duration of track.  
 * @return If it is successful to set the display duration, return true; if it is failed to find the track or the total duration of track is less than 0, or the track overlaps other tracks, return false. 
 */
public boolean setTrackDuration(String trackID, double duration)

/**
 * 设Offset the entire track.  (Change other values except duration.) 
 *
 * @param trackID Track ID. 
 * @param inPoint in point after moving. 
 * @return If it is successful to set the display duration of track, return true; if it is failed to find the track or the track after moving becomes incompatible, return false. 
 */
public boolean setTrackOffset(String trackID, double inPoint)

SXMainTrackGroup

The main track group is created by default, and obtained by SXEditManager instance. You can not deleted or created any main track group manually. Only SXMediaTrack can be added to main track group. Meanwhile, you can add transition to the tracks as well. The tracks in the group can not be overlapped and must be connected in time order. If the timeline of some track in the group is changed, the track and other tracks will move automatically. In addition to the features of group, the main track group also supports some functions of track, and effect, color grading and filter can be added to main track group.

/**
 * Get the main track group. The tracks in the group can be connected in time order. The group is created by default and  can not be deleted. 
 * Return the pointer of the instance object of main track only when the license is valid, otherwise return nullptr.
 * Only media track can be added to main track.  
 *
 * @return The instance of main track. If the license is invalid, return nullptr.
 */
public SXMainTrackGroup mainGroup()
/**
 * You can add a transition effect to two tracks with ID in track group. The transition exists between two connected tracks and its duration is affected by the duration of two tracks respectively. If there is a transition between the tracks already, it will be replaced by the new one. And the total duration of transition should not be more than the minimum of the display duration of the two connected tracks.   
 *
 * @param transitionPath The path of transition resource; the resource type is Transition and must be valid. 
 * @param trackID Track ID.
 * @param duration The transition duration.   
 * @return The actual duration of transition, return to 0 if adding transition fails. 
 */
public double addTransition(String transitionPath, String trackID, double duration)

/**
 * Remove transition.
 *
 * @param trackID Track ID. 
 */
public void removeTransition(String trackID)

/**
 * Set transition duration, and the maximum transition duration is affected by the duration of two connected tracks.  
 * The transition duration should not be more than half of the minimum of the display duration of the two connected track. 
 *
 * @param trackID  Track ID
 * @param duration The transition duration 
 * @return The actual duration. 
 */
public double setTransitionDuration(String trackID, double duration)