Movie Maker Timeline Control

AddVideoClip Method

Description

Add a video to the timeline. It support input AVI, XVID, DIVX, WMV, MPEG1, MPEG2, VOB, DAT, MP4, MOV, WebM, FLV, MKV, M2TS. Input MPEG2,VOB, M2TS, FLV videos need purchased our decoder plugin.

Syntax

Public Function AddVideoClip ( _
   ByVal trackIndex as integer, _
   ByVal filename as string, _
   ByVal clipStartTime as float, _
   ByVal clipStopTime as float, _
   ByVal mediaTime as float ,_
   ByVal stretchMode as integer
) As Integer

 

Parameter

trackIndex
   0 - Transition Track
   1 - Video 1 Track
   2 - Video 2 Track
   3 - Image Track
   4 - Effect Track
   5 - Audio 1 Track
   6 - Audio 2 Track
   7 - Text Track

filename
    the path of video file

clipStartTime
    Time in seconds when the clip will start on the timeline

clipStopTime
    Time in seconds when the clip will end on the timeline.

mediaTime
    Time in seconds at which point in the media to start from.

stretchMode
    The stretch mode specifies how the Timeline control renders a source whose size does not match the output dimensions (SetVideoTrackResolution method).

 

Mode

Description

0

The image is stretched to fit the target frame size in both dimensions, without preserving the aspect ratio.
 

1

The image is not resized. If the image is smaller than the target frame, the surrounding area is black. If the image is larger than the target frame, the image is cropped.
 

2

The image is resized to fit the target frame along one dimension, while preserving the aspect ratio. If the ratio of width to height    in the image does not match the ratio in the target frame, it creates a letterbox.
 

3

The image is resized to fill the entire target frame while preserving the aspect ratio. Rather than create a letterbox, this mode   crops the image, either along the sides or across the top and bottom.

Return Value

Return value is the clip index of the newly added clip if successful.
Return -1 , the path of video file is empty.
Return -2 , the path of video file not found.
Return -3 , the clipStartTime >= clipStopTime.
Return -4 , the track not found.
Return -5 , the unknown error.
Return -6 , Does not support this media format.
 

Example

Visual Basic Syntax
iCurrentClipIndex= TimelineControl1.AddVideoClip(1, "c:\temp\yourvideo.mpg", 0, 30, 0, 2)