Frederik.L
Frederik.L

Reputation: 5620

Get VLC remote control interface player state

I am currently on a java project that uses a vlc socket remote control interface to play audiovisual content (e.g. vlc -I rc --rc-host=localhost:[portnumber]). The interface leads to some particular cases that seem complex to deal with:

A constraint of the client is that videos need to be paused on the last frame. Fortunately, there is a parameter to deal with it : --play-and-pause.

The problem is as following. If vlc gets to the last frame and pause the video by itself, how can I know about it ? For now, I use get_time in hope of simply considering the video paused if the countdown is equal to 0. However, it occurs that vlc pauses the video itself at 0:01, forcing me to also consier 0:01 as a finishing value. This results in a glitch when the user starts another video while there really is one second remaining before the last frame, since the 0:01 check is considering it as paused while it's not. Here's a summary of what happens:

Is there a safe approach to deal with the player state so there is no undefined behavior? I noticed that the remote control console sometime outputs something when vlc pauses by itself. However, it seems unsafe since it may output some events that are fired before of after this event.

Thank you.

Upvotes: 1

Views: 1618

Answers (2)

was seo
was seo

Reputation: 1

Why don´t you prevent the player from reaching 00:01? E.g. if countdown = 00:02 start next.

Upvotes: 0

ninesided
ninesided

Reputation: 23263

What is the granularity of the countdown timer? Could you sample the time remaining twice with a gap equal to the smallest supported time unit? For example, if it's seconds, you check the time, wait a second and then check it again. If the time has changed, it's still playing, if it hasn't it's paused. Only downside is that it will introduces a one second delay to the responsiveness of your application.

Upvotes: 1

Related Questions