2018-04-27

VLC Player, modify Lua web interface to enqueue YouTube links

Problem:

VLC Player has a neat Lua Web interface, which can do a lot of things including making streams and transfer video to you browser, and so on.
However the "Open Media" button browses only the local folders, and can't add URL links.
That is a shame, because VLC player itself has such functionality -> Media/Open Network Stream.

It doesn't matter the format, it automatically recognizes every link, and how to interpret it.


Solution:

So I decided to mod the Media Browser a little bit. Here is how it looks like:


I added an URL input field, and a PlayURL button (enqueue & play). Works like a charm.
I am using encodeURIComponent() function in my code, because using the standard encodeURI() does not work with normal YouTube URLs, only the short ones!
Tested this file both on Linux and Windows - it is OK.


Then replace the original browse_window.html in:
Windows - C:\Program Files\VideoLAN\VLC\lua\http\dialogs
Linux - /usr/share/vlc/lua/http/dialogs


More Notes:

In VLC 2.2.6 - it works fine even youtube picture appears in the player
In VLC 3.0.1 / 3.0.2 - it works crappy long codes appear in the title and overlay your controls sometimes. VideoLan has to fix it, I guess it was not tested.

If you cannot play youtube links and get some strange errors perhaps your youtube.lua file is old.
Get the newest one from here:
https://raw.githubusercontent.com/videolan/vlc/master/share/lua/playlist/youtube.lua

And replace it in your:
Windows - C:\Program Files\VideoLAN\VLC\lua\playlist
Linux - /usr/share/vlc/lua/playlist

/rename or delete your original youtube.luac file/


Happy playing! \m/
Cheers!