Looping video playback

This forum is about all development around libVLC.
bLight
New Cone
New Cone
Posts: 2
Joined: 30 Nov 2023 17:00

Looping video playback

Postby bLight » 30 Nov 2023 17:13

I'm writing code in Delphi using the PasLibVLC library.

I got playback, seeking, volume and play/pause working, but now I'm trying to solve looping.

I am capturing the "OnMediaPlayerEndReached" event and within it I'm calling "SetVideoPosInMs" with a value of "0" to reset the position and then calling the "Resume" function. It simply does nothing and no subsequent seek/pause/resume functions do anything.

I noticed from my log files the sequence of events VLC triggers, perhaps it will help gain some insights:

Code: Select all

30-Nov-23 18:07:43 [ 12528.33360000] : VLC: MediaPlayerTimeChanged: 01:20:04.203 30-Nov-23 18:07:43 [ 12627.62540000] : VLC: MediaPlayerEndReached 30-Nov-23 18:07:43 [ 12630.63180000] : VLC: MediaPlayerTimeChanged: 00:00:00.000 30-Nov-23 18:07:43 [ 12650.15320000] : VLC: MediaPlayerVideoOutChanged: 0 30-Nov-23 18:07:43 [ 12650.48810000] : VLC: PlayerEsSelected (video), id = -1 30-Nov-23 18:07:43 [ 12658.28510000] : VLC: PlayerEsSelected (audio), id = -1 30-Nov-23 18:07:43 [ 12658.75740000] : VLC: PlayerEsSelected (text), id = -1 30-Nov-23 18:07:43 [ 12659.07060000] : VLC: PlayerEsDeleted (video), id = 0 30-Nov-23 18:07:43 [ 12659.38380000] : VLC: PlayerEsDeleted (audio), id = 1 30-Nov-23 18:07:43 [ 12661.56880000] : VLC: PlayerEsDeleted (text), id = 2 30-Nov-23 18:07:43 [ 12662.48860000] : VLC: MediaPlayerStopped
As you can see, right after MediaPlayerEndReached is triggered, the position is reset to 0 like I designed it to, but then there's a series of events I'm not familiar with and the "resume" function doesn't work.

I can probably get around this issue by re-opening the file, but it fills like overkill, what am I missing?

bLight
New Cone
New Cone
Posts: 2
Joined: 30 Nov 2023 17:00

Re: Looping video playback

Postby bLight » 05 Dec 2023 14:12

If anyone is curious,
I managed to work-around this issue by attaching the player to the medialist object and setting the looping mode on the medialist object.

wbtcpip
Blank Cone
Blank Cone
Posts: 14
Joined: 13 May 2021 16:21

Re: Looping video playback

Postby wbtcpip » 09 Dec 2023 15:08

the soultion is simple
call libvlc_media_player_get_state
if it's libvlc_Ended call libvlc_media_player_stop and media_player_play to restart it


Return to “Development around libVLC”

Who is online

Users browsing this forum: No registered users and 10 guests