Search code examples
luawindows-10vlc

vlc extension - load with each video and select subtitle


I made a vlc extension subtitles extension that autoloads the proper subtitle if available in the current folder. However, I can't implement the following:

  1. I can't automatically run the extension on each video load. I can only run the extension manually (ie via function activate()). This may be a built in safety feature. If there isn't a way to automatically run on each video load, is there a way to assign the extension a hotkey?

  2. After loading the subtitles, I can't have it automatically select it. I have to manually set it after its loaded. I am using the following to add subtitles with uriSub set as a file path to the subtitle:

    vlc.var.set(vlc.object.input(), 'sub-file', uriSub) vlc.input.add_subtitle(uriSub)

FYI, I am basing my code on existing extensions since I hadn't found documentation to base it off.

https://www.opencode.net/tristargod/vlcsubber


Update 1

I was able to resolve issue 2 by vlc.input.add_subtitle(uriSub, true)

Still need help with issue 1


Solution

    1. For this issue, I wasn't able to fully resolve it. It might be a security pre-caution by vlc. However, I was able to make it run on each video after the initial activation.
    2. vlc.input.add_subtitle(uriSub, true) resolved it