playback stops after first file in playlist (1 Viewer)

junkixl

Portal Member
August 14, 2007
14
0
Home Country
Germany Germany
Hi,

I'm writing my first plugin at the moment. I have information about movies in a mySQL database (movieinfo, where and how much files belong to the movie and so on). this plugin simply shows a list of movies which can be generated throug an SQL statement. after clicking on a movieentry, the plugin generates a videoplaylist with all the files belonging to that one movie and starts playing (it's like the myvideo plugin). and there's my problem: I can create the playlist, but if i playback the list, it stops after the first file and won't continue with the next on in the list.
Here's what I got so far:
Code:
PlayListPlayer player = new PlayListPlayer() ;
            DataTable files = new DataTable();

            player.Reset();
            player.CurrentPlaylistType = PlayListType.PLAYLIST_VIDEO_TEMP;
            PlayList playlist = player.GetPlaylist(PlayListType.PLAYLIST_VIDEO_TEMP);
            playlist.Clear();

            files = SqlQuery("SELECT * FROM dateien WHERE movie_id = " + data.Rows[curListSelection]["id"].ToString(), files);

            for (int i = 0; i < files.Rows.Count; i++)
            {
                PlayListItem item = new PlayListItem();
                item.FileName = files.Rows[i]["gspot_file_name_with_path"].ToString();
                item.Type = PlayListItem.PlayListItemType.Video;
                playlist.Add(item);
            }

            playlist.Sort();
            player.Play(0);

I was looking for a method in the playlist-object where I can set how to behave when a file comes to an end. but it seems that such a method doesn't exist.

any idea how to solve that?

greez
JunkiXL

Ok, I found a quick and dirty fix, but I'm still searching for a more straight forward solution.
for everyone who has the same trouble, just add an g_Player eventhandler as shown below

Code:
protected override void OnPageLoad()
{
    .....
     g_Player.PlayBackEnded += new g_Player.EndedHandler(g_Player_PlayBackEnded);
}
void g_Player_PlayBackEnded(g_Player.MediaType type, string filename)
        {
            player.PlayNext();
        }

greez
JunkiXL
 

Users who are viewing this thread

Top Bottom