Page 1 of 1

Start playing a second video after the first one is finished?

Posted: 12 Mar 2024 22:43
by poodadoo
Is it possible to reuse a VLC::MediaPlayer object to play a second media file after the first one is finished? I've created an EventManager object and created a function for the OnStopped event so I can do something after the current media has stopped playing.

I try to reload the object with a new "setMedia" command but it just freezes at that point. I've even tried deleting the object and creating a new one off the VLC::Instance.


Is there any sample code that shows what to do?

Re: Start playing a second video after the first one is finished?

Posted: 20 Mar 2024 05:21
by mfkl
If you call back into libvlc from a libvlc callback, you need to switch thread otherwise a freeze occur. Otherwise, yes, you can set a new media on an existing mediaplayer and call play and this will work.

Re: Start playing a second video after the first one is finished?

Posted: 20 Mar 2024 15:19
by poodadoo
I figured it out. I wound up rewriting all the libvlc stuff into its own threads... Works like a charm now.