Created A Custom Protocol For VLC, but VLC doesn't like it?
Trying to add a custom protocol vlc:///
to my Windows 8 system so that hyperlinks using it will open the file in VLC instead of my browser. It does try to open the file, but then VLC says it's unable to open the MRL. I've checked the messages area, but I don't see any logs. How can I get VLC to accept the protocol?
What I Did:
- Open regedit, and navigate to
HKEY_CLASSES_ROOT
. - Right click on
HKEY_CLASSES_ROOT
, and create a new key calledvlc
. - Click on
vlc
, and then open the(Default)
entry in it. - In
(Default)
type"URL:VLC Protocol"
. - Right click on
HKEY_CLASSES_ROOT/vlc
, and create a new key calledUrl Protocol
. - Right click on
HKEY_CLASSES_ROOT/vlc
, and create a new key calledDefault Icon
. - In
HKEY_CLASSES_ROOT/vlc/Default Icon
, open(Default)
, and enter in it"vlc.exe,1"
. - In
HKEY_CLASSES_ROOT/vlc
create a new key calledshell
, in it create a key calledopen
, in it create a key calledcommand
, and open the(Default)
entry. - In the entry type
"C:\Program Files (x86)\Video LAN\VLC Media Player\vlc.exe" "%1"
. - Create a folder called
website
on thec:
drive, and add in a file calledexample.mp4
, and an HTML file calledexample.html
. - In the html file type:
<a href="vlc:///C:/website/example.mp4">Example Link</a>
. - Associate the protocol with VLC by opening a link using it, browsing for VLC, and setting it to always be used.
Solution 1:
As Daniel B says in the comments, the problem isn't how I've setup the protocol, it's that VLC doesn't know how to use it. The solution is to direct the output to a batch script instead of VLC. The batch script converts the output into something usable, and launches VLC.
I also decided not to use "vlc" as the protocol name, because the command line interface for vlc uses that for some things, instead I'm using "cvlc".
Steps:
- Open regedit, and navigate to
HKEY_CLASSES_ROOT
. - Right click on
HKEY_CLASSES_ROOT
, and create a new key calledcvlc
. - Click on
cvlc
, and then open the(Default)
entry in it. - In
(Default)
type"URL:CVLC Protocol"
. - Right click on
HKEY_CLASSES_ROOT/cvlc
, and create a new key calledUrl Protocol
. - Right click on
HKEY_CLASSES_ROOT/cvlc
, and create a new key calledDefault Icon
. - In
HKEY_CLASSES_ROOT/cvlc/Default Icon
, open(Default)
, and enter in it"vlc.exe,1"
. - In
HKEY_CLASSES_ROOT/cvlc
create a new key calledshell
, in it create a key calledopen
, in it create a key calledcommand
, and open the(Default)
entry. - In the entry type
"C:\convert.bat" "%1"
. - Open Notepad, and create a text file that reads:
:: This batch script takes the input and removes 8 characters from the front, and then launches VLC with that altered :: input set as the file path set vlcdata=%1 "C:\Program Files (x86)\Video LAN\VLC Media Player\vlc.exe" "%vlcdata:~8%"
- Save it as all files type with the name
convert.bat
atC:\
. - The first time you open a link in Firefox you will need to associate that protocol with the bat file by browsing for it, and choosing to remember in the future.
- Create a folder called
website
on thec:
drive, add in a file calledexample.mp4
, and an HTML file calledexample.html
. - In the HTML file type:
<a href="cvlc:///C:\website\example.mp4">Example Link</a>
.
Notes:
- Because this uses a batch script, there will be a command prompt window opened, and it will not close until VLC does.
- When using local files in hyperlinks you must use a
\
not/
. - This works in Firefox, but doesn't in Internet Explorer because the protocol isn't in the Windows list of protocols, and file types. Therefore Internet Explorer doesn't know what program to use for it. I did find a thread about adding a custom protocol to the Windows filetype and protocol association list, but it isn't yet solved. https://stackoverflow.com/questions/186723/how-to-add-custom-protocol-to-vista-set-associations-list