Implement Looping with LibVLC
Posted: 07 Apr 2016 12:16
I am developing a standalone video player using LibVLC. I have a test video playing successfully and I'm now trying to implement an optional looping feature.
To do this I am attaching to the libvlc_media_player event libvlc_MediaPlayerEndReached, as expected at the end of the video I receive this event followed by libvlc_MediaPlayerVout count = 0.
At this point I want to restart the video from the beginning. My initial tests I just called libvlc from within the event handler but this sometimes caused crashes, so I'm now setting a flag for later processing.
Once the EndReached event occurs I have tried.
and various other combinations of start/stop/set_time but the video does not play from the beginning.
Is there any way to do this without releasing the player and recreating it?
Thanks
Jules
To do this I am attaching to the libvlc_media_player event libvlc_MediaPlayerEndReached, as expected at the end of the video I receive this event followed by libvlc_MediaPlayerVout count = 0.
At this point I want to restart the video from the beginning. My initial tests I just called libvlc from within the event handler but this sometimes caused crashes, so I'm now setting a flag for later processing.
Once the EndReached event occurs I have tried.
Code: Select all
libvlc_media_player_set_time(myVLCMediaPlayer, 0);
libvlc_media_player_play(myVLCMediaPlayer);
Is there any way to do this without releasing the player and recreating it?
Thanks
Jules