LUA - vlc.volume.get() returns previous value before set() (most of the time)

Microsoft Windows specific usage questions
Forum rules
Please post only Windows specific questions in this forum category. If you don't know where to post, please read the different forums' rules. Thanks.
hedgehog90
Blank Cone
Blank Cone
Posts: 12
Joined: 16 Nov 2018 13:04

LUA - vlc.volume.get() returns previous value before set() (most of the time)

Postby hedgehog90 » 05 Mar 2020 00:46

Let's say my volume is set to 100% (256 in status.xml)

If I do the following to set it to 200%:
http://127.0.0.1:9090/requests/status.xml?command=volume&512

The status I receive back however doesn't reflect the changes, although the player has updated the volume to 200%, status.xml still says 100%. It's only when I request status.xml again that it gives me the updated value.

I've looked at the Lua source code and I can't work out why this is happening, it is extremely weird behaviour.
I ran some tests and found if I ran a LUA script calling vlc.volume.set(vlc.volume.get()+1) & then vlc.volume.get(), the value returned will not be the previous value incrememnted by 1...
However, if I ran that command 10 times in a loop, it would increase the volume 4 or 5 times, sometimes 3.
So inconsistent. This deserves some kind of explanation.

I'm using VLC 3.0.8

EDIT:

OK, it's time based... what the hell !?
The following script outputs 1 to 20 consistently...

Code: Select all

for i = 1,20 do vlc.volume.set(vlc.volume.get()+1) vlc.misc.mwait(vlc.misc.mdate() + 2000) print(vlc.volume.get()) print("\n") end
However, if i reduce the wait to vlc.misc.mdate() + 1000, then it usually gets to 18 or 19.

Can someone please offer a less hacky, better way to get consistent results like this?

Return to “VLC media player for Windows Troubleshooting”

Who is online

Users browsing this forum: No registered users and 57 guests