Adding multiple events to the same track

hdguru wrote on 7/13/2006, 3:23 PM
When I add a new VideoEvent, it seems like I must specify the start time and the end time as the first and second arguments respectively. (oVideoEvent = new VideoEvent(new Timecode(), oVideoStream.Length); )

If I have X number of clips, and I want to add each to the same track one after another, is there an easy way to accomplish this? Will I have to keep track of the total time of all the events added to the track in order to determine the start point of the next event to add to the track?

Thanks.


---
function AddVideoMediaToTrack(cfilename, oVideoTrack){

var oVideoEvent = null;
var oMedia = new Media(cfilename);
if (oMedia.IsValid()){
var oVideoStream = oMedia.Streams[0];
oVideoEvent = new VideoEvent(new Timecode(), oVideoStream.Length);
oVideoTrack.Events.Add(oVideoEvent);
var oStream = oMedia.Streams.GetItemByMediaType(MediaType.Video, 0);
oVideoEvent.Takes.Add(new Take(oStream, true));

}
return oVideoEvent;
}

Comments

jetdv wrote on 7/13/2006, 6:26 PM
Make you a "startevent" variable to use as the beginning location of the new event. As each event is added, simply add the "Length" of that event to "startevent". If this is all that's on the track, you could also always use "Track.Length" to add it at the end of that track.