Skip to main content

Playlist API

Products: Media Player SDK .Net

Sample code

Using Playlist API, you can create a playlist with files for playback. You can add/remove file names and play the next or previous file.

Add files to the playlist

this.mediaPlayer1.Playlist_Add(@"c:\1.mp4");
this.mediaPlayer1.Playlist_Add(@"c:\2.mp4");
this.mediaPlayer1.Playlist_Add(@"c:\3.mp4");

Play the next file

this.mediaPlayer1.Playlist_PlayNext();

Play the previous file

this.mediaPlayer1.Playlist_PlayPrevious();

Remove a file from the playlist

this.mediaPlayer1.Playlist_Remove(@"c:\1.mp4");

Clear playlist

this.mediaPlayer1.Playlist_Clear();

Get the current file index

int fileIndex = this.mediaPlayer1.Playlist_GetPosition();

Get file name by index

string fileName = this.mediaPlayer1.Playlist_GetFilename(1);

Get files count

int filesCount = this.mediaPlayer1.Playlist_GetCount();

Reset the playlist to start from the first file

this.mediaPlayer1.Playlist_Reset();

Set the current playlist index

this.mediaPlayer1.Playlist_SetPosition(1);