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

This forum is about all development around libVLC.
poodadoo
New Cone
New Cone
Posts: 3
Joined: 10 Mar 2024 22:29

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

Postby poodadoo » 12 Mar 2024 22:43

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?

mfkl
Developer
Developer
Posts: 751
Joined: 13 Jun 2017 10:41

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

Postby mfkl » 20 Mar 2024 05:21

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.
https://mfkl.github.io

poodadoo
New Cone
New Cone
Posts: 3
Joined: 10 Mar 2024 22:29

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

Postby poodadoo » 20 Mar 2024 15:19

I figured it out. I wound up rewriting all the libvlc stuff into its own threads... Works like a charm now.


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 10 guests