1

enter image description here

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:

  1. Open regedit, and navigate to HKEY_CLASSES_ROOT.
  2. Right click on HKEY_CLASSES_ROOT, and create a new key called vlc.
  3. Click on vlc, and then open the (Default) entry in it.
  4. In (Default) type "URL:VLC Protocol".
  5. Right click on HKEY_CLASSES_ROOT/vlc, and create a new key called Url Protocol.
  6. Right click on HKEY_CLASSES_ROOT/vlc, and create a new key called Default Icon.
  7. In HKEY_CLASSES_ROOT/vlc/Default Icon, open (Default), and enter in it "vlc.exe,1".
  8. In HKEY_CLASSES_ROOT/vlc create a new key called shell, in it create a key called open, in it create a key called command, and open the (Default) entry.
  9. In the entry type "C:\Program Files (x86)\Video LAN\VLC Media Player\vlc.exe" "%1".
  10. Create a folder called website on the c: drive, and add in a file called example.mp4, and an HTML file called example.html.
  11. In the html file type: <a href="vlc:///C:/website/example.mp4">Example Link</a>.
  12. Associate the protocol with VLC by opening a link using it, browsing for VLC, and setting it to always be used.

enter image description here

  • 1
    just a note for future posts, rather than <code> [sample code] </code> with notes to replace with <>, instead use back ticks `<sample code>` & SE will format it correctly. – Tetsujin Oct 6 '14 at 7:58
  • back on topic - a quick Google points mainly at firewalls or Samba credentials Though idk how that would apply to a local file, it might be worth a quick check. – Tetsujin Oct 6 '14 at 8:14
  • 1
    Your approach is fine. VLC doesn’t support what you’re trying, though. So you might as well give up. Otherwise, you’d have to write a wrapper program that strips the protocol and then launches VLC. – Daniel B Oct 6 '14 at 8:43
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:

  1. Open regedit, and navigate to HKEY_CLASSES_ROOT.
  2. Right click on HKEY_CLASSES_ROOT, and create a new key called cvlc.
  3. Click on cvlc, and then open the (Default) entry in it.
  4. In (Default) type "URL:CVLC Protocol".
  5. Right click on HKEY_CLASSES_ROOT/cvlc, and create a new key called Url Protocol.
  6. Right click on HKEY_CLASSES_ROOT/cvlc, and create a new key called Default Icon.
  7. In HKEY_CLASSES_ROOT/cvlc/Default Icon, open (Default), and enter in it "vlc.exe,1".
  8. In HKEY_CLASSES_ROOT/cvlc create a new key called shell, in it create a key called open, in it create a key called command, and open the (Default) entry.
  9. In the entry type "C:\convert.bat" "%1".
  10. 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%"
  1. Save it as all files type with the name convert.bat at C:\.
  2. 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.
  3. Create a folder called website on the c: drive, add in a file called example.mp4, and an HTML file called example.html.
  4. 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.