15

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.

4

2 回答 2

12

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.

于 2016-01-18T12:00:23.987 回答
0

Do not assume the user has VLC installed. To answer exactly your request :

  1. If you are using web technologies, you'll probably have no other choice than a Java plugin, Flash, ActiveX or SilverLight to Exec an external application.

    1. This one for ActionScript (Flash) : Execute external exe from projector flash
    2. May be this one for your Java Plugin Executing an external program using process builder or apache commons exec
  2. If you are using native technologies (C/C++, Objective-C, etc). You can use Exec... More specifically, on Mac OSx, you'll probably want to refer to Execute a terminal command from a Cocoa app

于 2016-01-25T02:58:24.330 回答