Skip to content

Playlist

Overview The playlist features makes it possible to specify a list of video clips that have to be played automatically one after the other.

There are 2 ways to use the playlist: statically: specifying a static set of clips, then play this set of clip like it was a single clip (the trackbar moves across the whole set of clips) dynamically: it is possible to dynamically add/remove clips while the playlist is playing by invoking PlayList (pl_Add...). In this case the trackbar is active for the current clip being played.

  • all the playlist actions are performed by using the Playlist function, detailed below.

  • the playlist content can be retrieved by the GetPlaylist function, that returns a list of strings separated by CR/LF

  • the current index in the playlist is returned by the PlaylistIndex property (if opened dynamically)

  • when the end of the playlist is reached, the OnPlayerEndOfPlaylist event occurs.

  • it is possible to know if the playlist is currently playing by testing IsPlaylistActive.

The Playlist function The playlist function accepts 2 parameters:

  • a first parameter that specify the action
  • a 2nd parameter that specify the video clip (used only for pl_Add and pl_Remove).

The first parameter can take one of the following values:

pl_Add: adds the video clip (specified as 2nd parameter) to the playlist pl_Remove: removes the video clip (specified as 2nd parameter) from the playlist pl_Clear: clears the playlist pl_Loop: enables the loop mode (the playlist restart from the beginning when the end is reached) pl_NoLoop: disables the loop mode pl_Play: starts playing the playlist pl_Stop: stops playing the playlist after the end of the current clip pl_Next: starts playing the next clip (immediately) pl_Previous: starts playing the previous clip (immediately) pl_SortAlpha: sorts the playlist in the alphabetical order pl_SortRevAlpha: sorts the playlist in the reverse alphabetical order pl_Random: enable the "random" mode: the clips will be played in a random order. pl_Sequential: disables the "random" mode: the clips will be played sequentially. pl_SpecifyPositions: let specify a start position and/or a stop position

Remark: while the static playlist is playing, it is possible to't control it with the playlist settings anymore, it behaves like a single video clip. Building the playlist Simply invoke Playlist (pl_Add, "... path of the video clip...") as many times as required. Pass and empty string for the "VideoClip" parameter when it is not required (it is required only for pl_Add and pl_Remove). E.g.:

videograbber.Playlist (pl_Clear, '') videograbber.Playlist (pl_Add, 'vg000004.avi') videograbber.Playlist (pl_Add, 'vg000002.avi') videograbber.Playlist (pl_Add, 'StaticImage1.BMP') videograbber.Playlist (pl_Add, 'vg000003.avi') videograbber.Playlist (pl_Add, 'vg000005.avi') videograbber.Playlist (pl_Add, 'vg000001.avi') videograbber.Playlist (pl_Add, 'StaticImage2.JPG') Starting the dynamic playlist Be sure to set all the required options (like pl_Loop, pl_SortAlpha or pl_Random), then invoke pl_Play. E.g.:

videograbber.Playlist (pl_Clear, '') videograbber.Playlist (pl_Add, 'vg000004.avi') videograbber.Playlist (pl_Add, 'vg000002.avi') videograbber.PlayerDuration = 50000000 // specifies 5 seconds of display time for StaticImage1.BMP videograbber.Playlist (pl_Add, 'StaticImage1.BMP'); videograbber.Playlist (pl_Add, 'vg000003.avi') videograbber.Playlist (pl_Add, 'vg000005.avi') videograbber.Playlist (pl_Add, 'vg000001.avi') videograbber.PlayerDuration = 80000000 // specifies 8 seconds of display time for StaticImage2.JPG videograbber.Playlist (pl_Add, 'StaticImage2.JPG') videograbber.PlaylistIndex:= 0 videograbber.Playlist (pl_SortAlpha, '') videograbber.Playlist (pl_Loop, '') videograbber.Playlist (pl_Random, '') videograbber.Playlist (pl_Play, ''); Starting the static playlist videograbber.Playlist (pl_Clear, ''); videograbber.Playlist (pl_Add, 'vg000004.avi'); videograbber.Playlist (pl_Add, 'vg000002.avi'); videograbber.Playlist (pl_Add, 'vg000003.avi'); videograbber.Playlist (pl_Add, 'vg000005.avi'); videograbber.Playlist (pl_Add, 'vg000001.avi'); videograbber.PlayerFileName = 'PLAYLIST' videograbber.OpenPlayer()Specifying a custom video size and/or frame rate to the static playlist By defaut the static playlist plays all the clips at the same video size (640x480) and at the same frame rate (29.97 fps)

  • to customize the frame rate, set a FrameRate value > 0

  • to customize the video size, invoke UseNearestVideoSize (width, height, false) before invoking OpenPlayer

E.g.: ... VideoGrabber.PlayList (pl_Add, "vg0000006.avi") VideoGrabber.PlayerFileName = 'PLAYLIST' VideoGrabber.FrameRate = 25.0 VideoGrabber.UseNearestVideoSize (720, 480, false) VideoGrabber.OpenPlayerPlayer() It is possible to later reset the video size by invoking: UseNearestVideoSize (0, 0, false) and the frame rate by setting: FrameRate = 0 Pausing the playlist Simply invoke PausePlayer.

Stopping the playlist - to stop the playlist at the end of the current clip, invoke Playlist (pl_Stop)- to close the playlist immediately, invoke ClosePlayer

specifying start/stop positions for each clip Invoke VideoGrabber.PlayList (pl_SpecifyPositions,...) and immediately after OpenPlayerAtTimePositions or OpenPlayerAtFramePositions (this will not open the clips but just register the positions) VideoGrabber.PlayList (pl_Add, 'myvideoclip1.wmv'); VideoGrabber.PlayList (pl_SpecifyPositions, 'myvideoclip1.wmv'); VideoGrabber.OpenPlayerAtTimePositions (50000000, 120000000, true, true);

VideoGrabber.PlayList (pl_Add, 'myvideoclip2.wmv'); VideoGrabber.PlayList (pl_SpecifyPositions, 'myvideoclip2.wmv'); VideoGrabber.OpenPlayerTimePositions (30000000, 130000000, true, true);

VideoGrabber.PlayerFileName:= 'PLAYLIST'; VideoGrabber.Openplayer(); In this example the first clip will play 7 seconds (from 7 seconds to 12 seconds) and then the second will play 10 seconds (from 3 seconds to 13 seconds) to let the clip play until the end specify -1 as stop position)

Using static images or animaged GIFs in the playlist Static images (like BMP, JPG files) can be opened alternatively with video clips in the dynamic playlists. To specify the display time for static images, assign the PlayerDuration with the desired value BEFORE the PlayList (pl_Add...) statement (the display time is expressed as 100ns units, e.g. 7 seconds = 70000000).

E.g.:

VideoGrabber.PlayerDuration = 30000000; // will set 3 seconds for myvideoclip1 VideoGrabber.PlayList (pl_Add, 'myvideoclip1.wmv'); VideoGrabber.PlayerDuration = 40000000; // will set 4 seconds for myvideoclip2 VideoGrabber.PlayList (pl_Add, 'myvideoclip2.wmv'); ... VideoGrabber.PlayList (pl_Play, "");