How to create a VLC Lua extension that does something at particular timestamps?

For example, let’s say I want to run vlc.audio.set_mute(true) at 10 seconds into the current video file and vlc.audio.set_mute(false) at 20 seconds (thereby muting seconds 10 through 20).

I have the basic structure of the script down, but I keep running into the issue of how to wait for the moment to take the action.

  • Lua itself does not have a built-in sleep function
  • Calls to the OS seem to be blocked.
  • Busy waiting in a loop causes the extension to be perceived as unresponsive (and it’s bad anyway).
  • vlc.misc is not available in Extensions, so I can’t do something like a while loop and then run vlc.misc.mwait(vlc.misc.mdate() + 500) at the end of each iteration.

Leave a Comment