PlaylistAdd Method (IMPlaylist)
reference to external object (for example, live source)
path of the item
additional parameters of element (“Live” to add live source, “Playlist” to add playlist). If you want to add a new playlist with any file then you should use PlaylistAdd( “my_file.avi”, “playlist”). If you add file, you can set file properties here (like in FileNameSet method), see MFile object: properties.
place of element in playlist
Possible values:
output playlist item
Inserts a new item into the playlist at the specified position.
Syntax
Sub PlaylistAdd( _
   ByVal _pExternOrRef As Object, _
   ByVal _bsPath As String, _
   ByVal _bsParam As String, _
   ByRef _pnIndex As Integer, _
   ByRef _ppPlaylistItem As MItem _
) 
void PlaylistAdd( 
   object _pExternOrRef,
   string _bsPath,
   string _bsParam,
   out int _pnIndex,
   out MItem _ppPlaylistItem
)
procedure PlaylistAdd( 
    _pExternOrRef: TObject;
    _bsPath: String;
    _bsParam: String;
   Out  _pnIndex: Integer;
   Out  _ppPlaylistItem: MItem
); 
void PlaylistAdd( 
   IUnknown* _pExternOrRef,
   BSTR* _bsPath,
   BSTR* _bsParam,
   [PARAMFLAG::Out] int _pnIndex,
   [PARAMFLAG::Out] MItem* _ppPlaylistItem
) 

Parameters

_pExternOrRef
reference to external object (for example, live source)
_bsPath
path of the item
_bsParam
additional parameters of element (“Live” to add live source, “Playlist” to add playlist). If you want to add a new playlist with any file then you should use PlaylistAdd( “my_file.avi”, “playlist”). If you add file, you can set file properties here (like in FileNameSet method), see MFile object: properties.
_pnIndex
place of element in playlist
Possible values:
  • 0 - insert new file to first position of playlist: [newfile] [first] ... [last]
  • 1 - insert new file to second position of playlist: [first] [newfile] ... [last]
  • etc.
  • -1 - insetf new file to the end of playlist: [first] ... [last] [newfile]
  • -2 - insert new file to second position from the end of playlist: [first] ... [newfile] [last]
  • -3 - insert new file to third position from the end of playlist: [first] ... [newfile] [pre-last] [last]
  • etc.
_ppPlaylistItem
output playlist item
Example

Here is example or playlist initialization and adding a file to it:

Dim myPlaylist As New MPlaylistClass()
myPlaylist.PreviewWindowSet("", panelPreview.Handle.ToInt32())
myPlaylist.PreviewEnable("", 1, 1)
myPlaylist.ObjectStart(New Object())
'Insert clip at the end of playlist
Dim nIndex As Integer = -1
Dim pFile As MItem
Dim strPath As String = "d:\clips\SampleClip1.wmv"
myPlaylist.PlaylistAdd(Nothing, strPath, "", nIndex, pFile)
myPlaylist.FilePlayStart()
MPlaylistClass myPlaylist = new MPlaylistClass();
myPlaylist.PreviewWindowSet("", panelPreview.Handle.ToInt32()); 
myPlaylist.PreviewEnable("", 1, 1);
myPlaylist.ObjectStart(new object());
//Insert clip at the end of playlist
int nIndex = -1;
MItem pFile;
string strPath = @"d:\clips\SampleClip1.wmv";
myPlaylist.PlaylistAdd(null, strPath, "", ref nIndex, out pFile);
myPlaylist.FilePlayStart();
var
nIndex: integer;
pItem: MItem;
myPlaylist: MPlaylist;
myPreview: IMPreview;
myEvents: TEvents;
myFile:IMFile;
myObject:IMObject;
cookie: LONG_PTR;
begin
myPlaylist:= CreateComObject(CLASS_MPlaylist) as MPlaylist;
myPreview:= myPlaylist as IMPreview;
myObject:= myPlaylist as IMObject;
myEvents:=TEvents.Create();
myObject.ObjectCallbackSet(myEvents, cookie);
myFile:=myPlaylist as IMFile;
myPreview.PreviewWindowSet('', panelPreview.Handle);
myPreview.PreviewEnable('', 1, 1);
nIndex:=-1;
myPlaylist.PlaylistAdd(nil, 'c:\myFile.avi', '', nIndex, pItem);
myFile.FilePlayStart();
end;
See Also

Reference

IMPlaylist Interface
IMPlaylist Members