在OSX上使用VLC開啟連結
我已經看到像Steam,Spotify等應用程式能夠在Chrome中啟動本機應用程式,使用者在彈出框中允許呼叫.如何從我自己的網站,VLC或者失敗的,預設的系統視訊流應用程式.
比方說,Safari將會開啟VLC for rtmp:// links like
<a target="_blank"href="rtmp://zozolala.com">text</a>
您可以從JavaScript呼叫視訊播放器
window.open('rtmp://zozolala.com', '_blank');
您可以通過將OS X應用程式新增到.plist來指定您可以開啟的URL:
<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>
如果您想使用HTTPS URI(您的URI將在Safari中預設開啟此URI),您可以做一個訣竅:準備.m3u播放列表檔案,其中包含https://條目,並使該檔案可通過其他協議使用(預設應用為VLC),如RSTP或SFTP.
程式碼日誌版權宣告:
翻譯自:http://stackoverflow.com/questions/34803663/open-link-using-vlc-on-osx