Search code examples
macosprotocolslauncherexternal-application

Open link using VLC on OSX


I've seen that applications like Steam, Spotify, and others, are able to launch native applications from inside Chrome, after the user allows the invocation in the pop up box. How can I do this from my own website, for VLC, or failing that, the default system video streaming application.


Solution

  • Sure, Safari, for example, will open VLC for rtmp:// links like

    <a target="_blank"  href="rtmp://zozolala.com">text</a>
    

    You can invoke video player from JavaScript:

    window.open('rtmp://zozolala.com', '_blank');
    

    You can specify URLs your OS X app can open by adding them to .plist:

    <key>CFBundleURLTypes</key>
    <array>
        <dict>
            <key>CFBundleTypeRole</key>
            <string>Editor</string>
            <key>CFBundleURLIconFile</key>
            <string></string>
            <key>CFBundleURLName</key>
            <string>abc</string>
            <key>CFBundleURLSchemes</key>
            <array>
                <string>abc</string>
            </array>
        </dict>
    </array>
    

    If you want to feed your VLC with HTTPS URI (this URI will be opened in Safari by default), you can do a trick: prepare .m3u playlist file with https:// entry inside and make this file be available via some other protocol (for which default app is VLC), like RSTP or SFTP.