This project provides a custom URL scheme handler for VLC on macOS, allowing you to open VLC with specific local files and parameters directly from web links or other applications.
Example: vlc://path/to/video.mp4?start=30&stop=60&loop=true
As a guitarist, I often need to quickly access specific sections of music videos or loop backing tracks for practice. This tool streamlines that process, allowing me to create clickable links in my Obsidian (or simple HTML) documents that open VLC with precise settings for each song or practice section. It makes my practice routine more efficient and organized.
- Open VLC with a specific file using a custom URL scheme
- Set start and stop times for video playback
- Control playback speed
- Enable looping
- macOS 10.14 or later
- VLC media player
- Xcode Command Line Tools (for building from source)
Choose one of the following installation methods:
- Go to the Releases page.
- Download the latest
VLCURLHandler.app.zip
file. - Unzip the file and move
VLCURLHandler.app
to your Applications folder.
- Clone this repository:
git clone https://github.com/ohmycode/vlc-url-handler.git
- Navigate to the project directory:
cd vlc-url-handler
- Run the install script with sudo:
sudo ./install.sh
- Follow any on-screen prompts.
- Restart your computer or log out and back in for the changes to take effect.
- Clone this repository:
git clone https://github.com/yourusername/vlc-url-handler.git
-
Open
src/VLCURLHandler.applescript
in AppleScript Editor. -
Export as an application named VLCURLHandler.app (File > Export > File Format: Application).
-
Right-click on VLCURLHandler.app, select "Show Package Contents", and navigate to Contents/Resources/.
-
Copy
src/vlc_handler.sh
into the Resources folder. -
Make sure
vlc_handler.sh
is executable: -
In order to register the URL Scheme you need to add the following lines to the Info.plist of the VLCURLHandler.app, inside of the tag.
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Custom Scheme</string>
<key>CFBundleURLSchemes</key>
<array>
<string>vlc</string>
</array>
</dict>
</array>
<key>LSApplicationQueriesSchemes</key>
<array>
<string>vlc</string>
</array>
- Restart or run following command to apply the new url scheme
/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -f /Applications/VLCURLHandler.ap
Use URLs in the following format:
vlc://path/to/video.mp4?start=30&stop=60&speed=1.5&loop=true
Parameters:
start
: Start time in secondsstop
: Stop time in secondsspeed
: Playback speed (e.g., 1.5 for 1.5x speed)loop
: Set to 'true' to loop the video
Example:
<a href="vlc://Movies/MyVideo.mp4?start=30&stop=60&speed=1.5&loop=true">Play Video in VLC</a>
You can customize the behavior of the VLC URL Handler by creating a configuration file at ~/.vlc-url-handler
. This file allows you to set the following options:
BASE_PATH
: The base path for relative URLs (default: "/x/Personal/guitar")VLC_PATH
: The path to the VLC executable (default: "/Applications/VLC.app/Contents/MacOS/VLC")
Example ~/.vlc-url-handler
file:
BASE_PATH="/Users/yourUsername/Videos"
VLC_PATH="/Applications/VLC.app/Contents/MacOS/VLC"
- If the URL scheme doesn't work after installation, try restarting your computer or logging out and back in.
- Ensure that VLC is installed in the standard Applications folder.
- Check Console.app for any error messages related to VLCURLHandler.
Feedback and contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.