Page 1 of 1

Repeat or loop a video

Posted: 30 Aug 2016 15:25
by fasteque
Hello guys,

I'm trying to repeat a video in a loop but even if I thought it would have been an easy task, I've found out I'm not able to do it.

I'm using libvlc for Android and I'm playing a video over the network. I simply instantiate a LibVLC object and then I create a MediaPlayer, set a Media to it and play.
When I get event EndReached, I try to set the position of the MediaPlayer to 0 but the video is not played back.

I've also try to see options like "--repeat", "--loop", "-L", "--global-key-loop=Loop" without any success.

The only working thing is to set the position to 0 at about 95% of the video length: it's working but the visual effect is not good, because the video is made to start and end with the same frame, so if I skip some of them it's a little bit "nervous" the transaction.


Thanks in advance for your help!

Re: Repeat or loop a video

Posted: 30 Aug 2016 15:28
by Rémi Denis-Courmont
Stop the media player and start (play) again.

Re: Repeat or loop a video

Posted: 30 Aug 2016 15:46
by fasteque
Ok thanks, stop and playing again for EndReached event works, but of course there's a gap in the playback because of buffering.
Considering it's an http video, I guess that's the best result I can quickly/easily get with libvlc right?

Re: Repeat or loop a video

Posted: 30 Aug 2016 15:56
by Rémi Denis-Courmont
There's also a gap when seeking backward.

Re: Repeat or loop a video

Posted: 02 Sep 2016 03:36
by trickbiker121
The way I am doing it is by checking if the state is ended if so set the media in the player again and play the media.

Re: Repeat or loop a video

Posted: 03 Sep 2016 11:41
by Rémi Denis-Courmont
That is probably racy.