Page 1 of 1

Implementing playlist

Posted: 31 Oct 2009 03:37
by tido
Hi,

I'm trying to implement a playlist around libvlc using C#. The code I'm writing is from scratch. I got my application to play a movie, but I can't add more movies to the playlist. It seems to add movies to the list (I've checked using libvlc_media_list_count) but whenever I press next, it just plays the same movie. The second time I press next, nothing happens. If I press next one more time, the application crashes with AccessViolationException. In fact, this will always occur regardless of how many movies are in the list.

I don't know what I'm missing here. Please help.

This is my Add function

Code: Select all

libvlc_media_list_lock(this.vlc_mlist); IntPtr media = libvlc_media_new(this.vlc_instance.Handle, m.Path, ref vlc_exception.Ex); libvlc_media_list_add_media(this.vlc_mlist, media, ref this.vlc_exception.Ex); libvlc_media_release(media); libvlc_media_list_unlock(this.vlc_mlist);
Next

Code: Select all

libvlc_media_list_player_next(this.vlc_mlp, ref this.vlc_exception.Ex);
This is how I instantiated the objects

Code: Select all

this.vlc_mlist = libvlc_media_list_new(this.vlc_instance.Handle, ref this.vlc_exception.Ex); this.vlc_mlp = libvlc_media_list_player_new(this.vlc_instance.Handle, ref this.vlc_exception.Ex); this.vlc_mi = libvlc_media_player_new(this.vlc_instance.Handle, ref this.vlc_exception.Ex); libvlc_media_list_player_set_media_player(this.vlc_mlp, this.vlc_mi, ref this.vlc_exception.Ex); libvlc_media_list_player_set_media_list(this.vlc_mlp, this.vlc_mlist, ref this.vlc_exception.Ex); libvlc_media_player_set_drawable(this.vlc_mi, this.vlc_window.Handle, ref this.vlc_exception.Ex); this.vlc_window.Visible = true;