MeiCam SDK For Android  1.0.0
Public Member Functions | List of all members
com.meicam.sdk.NvsVideoTrack Class Reference

video track,the collection of video clips. More...

Inheritance diagram for com.meicam.sdk.NvsVideoTrack:
com.meicam.sdk.NvsTrack com.meicam.sdk.NvsObject

Public Member Functions

NvsVideoClip appendClip (String filePath)
 Appends a video clip to the end of the video track. More...
 
NvsVideoClip appendClip (String filePath, long trimIn, long trimOut)
 Appends a video clip of the specified length to the end of the video track. More...
 
NvsVideoClip insertClip (String filePath, int clipIndex)
 Inserts a video clip at the specified clip index on the video track. More...
 
NvsVideoClip insertClip (String filePath, long trimIn, long trimOut, int clipIndex)
 Inserts a video clip of the specified length at the specified clip index on the video track. More...
 
NvsVideoClip addClip (String filePath, long inPoint)
 add clip. More...
 
NvsVideoClip addClip (String filePath, long inPoint, long trimIn, long trimOut)
 Adds a clip of the specified length. More...
 
NvsVideoClip getClipByIndex (int clipIndex)
 Gets video clip by index. More...
 
NvsVideoClip getClipByTimelinePosition (long timelinePos)
 Gets video clip by time. More...
 
NvsVideoTransition setBuiltinTransition (int srcClipIndex, String transitionName)
 Sets built-in transitions. More...
 
NvsVideoTransition setPackagedTransition (int srcClipIndex, String packageId)
 Sets resource package transition. More...
 
NvsVideoTransition getTransitionBySourceClipIndex (int srcClipIndex)
 Get the transition through the source video clip index. More...
 
- Public Member Functions inherited from com.meicam.sdk.NvsTrack
int getType ()
 Get track type. More...
 
int getIndex ()
 Gets track index. More...
 
long getDuration ()
 Gets track length. More...
 
int getClipCount ()
 Gets the number of clips on the track. More...
 
long changeInPoint (int clipIndex, long newInPoint)
 Modifies the clip's in-point on timeline. More...
 
long changeOutPoint (int clipIndex, long newOutPoint)
 Modifies the clip's out-point on timeline. More...
 
boolean splitClip (int clipIndex, long splitPoint)
 Splits the specified clip. More...
 
boolean removeClip (int clipIndex, boolean keepSpace)
 Removes the specified clip. More...
 
boolean removeRange (long startTimelinePos, long endTimelinePos, boolean keepSpace)
 Removes all clips within the specified interval, and adjust the timeline in-point or out-point if the clip only partially overlaps the interval. More...
 
boolean moveClip (int clipIndex, int destClipIndex)
 Removes the specified clip. More...
 
boolean removeAllClips ()
 Removes all the clips. More...
 
void setVolumeGain (float leftVolumeGain, float rightVolumeGain)
 Sets the volume. More...
 
NvsVolume getVolumeGain ()
 Get the volume information. More...
 
- Public Member Functions inherited from com.meicam.sdk.NvsObject
void setAttachment (String key, Object value)
 Adds additional data to the NvsObject object to identify the NvsObject object or for other purpose. More...
 
Object getAttachment (String key)
 Gets an attachment to NvsObject. More...
 

Additional Inherited Members

- Static Public Attributes inherited from com.meicam.sdk.NvsTrack
static final int TRACK_TYPE_VIDEO = 0
 Video track. More...
 
static final int TRACK_TYPE_AUDIO = 1
 Audio track. More...
 
- Protected Member Functions inherited from com.meicam.sdk.NvsObject
void setInternalObject (long internalObject)
 
long getInternalObject ()
 
- Protected Attributes inherited from com.meicam.sdk.NvsObject
long m_internalObject = 0
 

Detailed Description

video track,the collection of video clips.

A video track is an entity that holds video clips, and users can add, insert, and delete multiple video clips. The video track continues to expand as the clip increases, and video transitions can be inserted between clips. When adding a package transition, users need to install it and get the packageID returned as the handle of the transition. For built-in transition, their names are regarded as handle. Note: The index of the video clip starts from 0.

Warning
In the NvsVideoTrack class, all public APIs are used in the UI thread! ! !

Member Function Documentation

NvsVideoClip com.meicam.sdk.NvsVideoTrack.addClip ( String  filePath,
long  inPoint 
)
inline

add clip.

Parameters
filePathClip file path. For the clip's path in Android, there are two ways:

a. Creates an assets folder in the local program path, usually in the same directory as the res folder. The corresponding audio and video resources can be placed inside, the path form: "assets: /video20170406101714.mp4".

b. Imports the audio and video resources in the mobile phone through the absolute path, the path form: "/storage/Media/DCIM/IMG_0646.MP4".

Parameters
inPointThe in point of the clip on the timeline (in microseconds) For more information of the in and out points of a clip on the timeline, please refer to the section trimIn and trimOut.
Returns
Return the added video clip object
Warning
In the NvsVideoTrack class, all public APIs are used in the UI thread! ! !
See also
appendClip
insertClip
NvsVideoClip com.meicam.sdk.NvsVideoTrack.addClip ( String  filePath,
long  inPoint,
long  trimIn,
long  trimOut 
)
inline

Adds a clip of the specified length.

Parameters
filePathClip path. For clip path types, please refer to the parameter filePath of addClip().
inPointThe in point of the clip on the timeline (in microseconds).
trimInclip trim in point (in microseconds).
trimOutclip trim out point (in microseconds).
Returns
Returns the added video clip object. When users use addClip() to add clips, the clip to be added will split the current clip at the specified in point on the timeline. In the specified in point, the clips contained in the position corresponding to the length of the clip to be added on the track will be deleted. Then the clips to be added can be added. If there is a gap in the corresponding position, it will be covered directly. examples are as follows:
beforeAddClip.PNG
As shown above, there are three video clips C1, C2, C3 on the track, and a clip C4 is to be added. The arrow on the C4 clip points to the trim in amd out points of the clip. The arrow on the track refers to the in-point of the clip on the timeline. After clipping, the corresponding clip is added to the track. The code is implemented as follows: NvsVideoTrack videoTrack; //videoTrack Omits creation here. videoTrack.addClip(filepath,inPoint,trimIn,trimOut);//Filepath is the path of the clip C4, and inPoint is the value of the position indicated by the arrow on the track in the figure, and trimIn and trimOut are the values at the position indicated by the arrow on the C4 clip of the above figure.

When added, the results are as follows:

afterAddClip.PNG
Warning
This interface will cause the streaming engine state to jump to the engine stop state. For details, please refer to Engine Change.
See also
appendClip
insertClip
NvsVideoClip com.meicam.sdk.NvsVideoTrack.appendClip ( String  filePath)
inline

Appends a video clip to the end of the video track.

Parameters
filePathVideo clip path. For clip path types, please refer to the parameter filePath of addClip().
Returns
Returns the appended video clip object. example:
TrackClip.PNG
In the above picture, there are three clips on the video track, namely C1, C2, C3, and a new clip C4 is added to the end of the video track. NvsVideoTrack m_videoTrack;//m_videoTrack omitted creation NvsVideoClip m_videoClip; m_videoClip = m_videoTrack.appendClip(filepath) //Filepath is the path of clip C4. After appending, it becomes::
TrackAppendClip.PNG
Warning
This interface causes the streaming engine state to jump to the engine stop state. For more details, please refer to Engine Changes.
See also
insertClip
NvsVideoClip com.meicam.sdk.NvsVideoTrack.appendClip ( String  filePath,
long  trimIn,
long  trimOut 
)
inline

Appends a video clip of the specified length to the end of the video track.

Parameters
filePathVideo clip path. For clip path types, please refer to the parameter filePath of addClip().
trimInTrim in point of video clips (in microseconds).
trimOutTrim out point of video clips (in microseconds).
Returns
Returns the appended video clip object. For more information of trim in and out points, please refer to the section trimIn and trimOut.
Warning
In the NvsVideoTrack class, all public APIs are used in the UI thread! ! !
See also
insertClip
NvsVideoClip com.meicam.sdk.NvsVideoTrack.getClipByIndex ( int  clipIndex)
inline

Gets video clip by index.

Parameters
clipIndexVideo clip index. Clip index value range: NvsVideoTrack m_videoTrack;//m_videoTrack omitted creation int clipCount = m_videoTrack.getClipCount(); The value of clipIndex is [0, clipCount-1]
Returns
Returns the captured video clip object.
See also
getClipByTimelinePosition
insertClip
appendClip
NvsVideoClip com.meicam.sdk.NvsVideoTrack.getClipByTimelinePosition ( long  timelinePos)
inline

Gets video clip by time.

Parameters
timelinePosPosition on the timeline (in microseconds).
Returns
Returns the captured video clip object.
See also
getClipByIndex
NvsVideoTransition com.meicam.sdk.NvsVideoTrack.getTransitionBySourceClipIndex ( int  srcClipIndex)
inline

Get the transition through the source video clip index.

Parameters
srcClipIndexSource video clip index.
Returns
Returns the obtained video transition object.
See also
setBuiltinTransition
NvsVideoClip com.meicam.sdk.NvsVideoTrack.insertClip ( String  filePath,
int  clipIndex 
)
inline

Inserts a video clip at the specified clip index on the video track.

Parameters
filePathVideo clip path. For clip path type, please refer to the parameter filePath of addClip().
clipIndexIndex of the inserted clip.
Returns
Returns the inserted video clip object. insertClip() inserts a clip right before the one indexed by clipIndex. An example is as follows:
TrackClip.PNG
There are three video clips C1, C2, and C3 on the track in the above figure, and the clip to be inserted is recorded as C4. If the clip is inserted before C1, the clipIndex value is 0 and same rule can be used in other cases. The corresponding code is implemented as follows: NvsVideoTrack m_videoTrack;//m_videoTrack omitted creation int clipCount = m_videoTrack.getClipCount(); NvsVideoClip m_videoClip; m_videoClip = m_videoTrack.insertClip(filepath,0); //Filepath is the path of clip C4, and the value of clipIndex is [0, clipCount-1] After insertion, it becomes:
TrackInsertClip.PNG
Warning
This interface will cause the streaming engine state to jump to the engine stop state. For details, please refer to Engine Change.
See also
appendClip
NvsVideoClip com.meicam.sdk.NvsVideoTrack.insertClip ( String  filePath,
long  trimIn,
long  trimOut,
int  clipIndex 
)
inline

Inserts a video clip of the specified length at the specified clip index on the video track.

Parameters
filePathVideo clip path. For the clip path method, please refer to the parameter filePath of addClip().
clipIndexIndex of the inserted clip.
trimInTrim in point of video clips (in microseconds)
trimOutTrim out point of video clips (in microseconds))
Returns
Returns the inserted video clip object.
beforeInsertClip.PNG

There are three video clips C1, C2, C3 on the track in the above figure, and the clip C4 is to be inserted. The point indicated by the arrow on the C4 clip is the clip's trim in and out points, C4 is inserted after trim. Note: The trim in and out values must be within the duration of this clip, and the trim in point value must be less than the trim out point value. The implementation code is as follows: NvsVideoTrack m_videoTrack;//m_videoTrack Omits creation int clipCount = m_videoTrack.getClipCount(); NvsVideoClip m_videoClip; m_videoClip = m_videoTrack.insertClip(filepath,trimIn,trimOut,0);//Filepath is the path of clip C4, trim in and trim out are the values at the position indicated by the arrow on the C4 clip of the above figure, and the value of clipIndex is [0, clipCount-1]. After insertion, it becomes:

TrackInsertClip.PNG
Warning
This interface will cause the streaming engine state to jump to the engine stop state. For details, please refer to Engine Change.
See also
appendClip
NvsVideoTransition com.meicam.sdk.NvsVideoTrack.setBuiltinTransition ( int  srcClipIndex,
String  transitionName 
)
inline

Sets built-in transitions.

Parameters
srcClipIndexSource video clip index.
transitionNameThe name of the transition. To get the video transition name, please refer to getAllBuiltinVideoTransitionNames() or built-in effect name list. Note: If the transition name is set to a null string, the original transition will be deleted.
Returns
Returns the video transition object. If the transitionName is set to a null string (namely, to delete the original transition), return null.

For instance: There are four video clips on the track in the below figure, which are C1, C2, C3, and C4, respectively, where clip C1, C2, and C3 are adjacent, and there is a gap between clip C3 and C4. If a transition is set between C1 and C2, it becomes:

TrackTransition.PNG
               NvsVideoTrack m_videoTrack;//m_videoTrack omitted creation
               int clipCount = m_videoTrack.getClipCount();
               NvsVideoTransition m_videoTransition;
               m_videoTransition = m_videoTrack.setBuiltinTransition(0,transitionName) //srcClipIndex takes the range of (1, clipCount-1), and transitionName is the name of the transition to be set.

If a transition is added between C2 and C3, the index is 1. The transition can only be set between two adjacent clips. Since there is a gap between the C3 and C4 clip in the above figure, it is not possible to add a transition between the two clips.

Warning
This interface will cause the streaming engine state to jump to the engine stop state. For details, please refer to Engine Change.
See also
setPackagedTransition
NvsVideoTransition com.meicam.sdk.NvsVideoTrack.setPackagedTransition ( int  srcClipIndex,
String  packageId 
)
inline

Sets resource package transition.

Parameters
srcClipIndexSource video clip index.
packageIdTransition resource package ID. If the package Id is null, the transition at the video clip is deleted; if the package Id is set to "theme", the transition at the video clip is set to the one of the current theme. If there is no theme, the transition at the video clip should be deleted.
Returns
Returns the video transition object.
Warning
This interface will cause the streaming engine state to jump to the engine stop state. For details, please refer to Engine Change.
See also
setBuiltinTransition

The documentation for this class was generated from the following file: