通过浏览器在 VLC Player 上打开视频流 [英] Open video stream on VLC Player through the browser

查看:38
本文介绍了通过浏览器在 VLC Player 上打开视频流的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在网页上添加一种可以打开 VLC 播放器并开始播放流视频的链接?喜欢这个:

Is it possible to add a type of link on a webpage that will open up VLC Player and start playing a stream video? Like this one:

或者,是否可以在浏览器中嵌入 VLC 播放器?

Alternatively, is it possible to embed VLC Player in the browser?

推荐答案

UPDATE: 2018-09-25 此回复大部分仅适用于较旧的浏览器,因此更新了一些部分.

UPDATE: 2018-09-25 Most of this response only applies to older browsers, so updating some sections.

在较旧的浏览器上是可能的,但需要客户端浏览器插件取决于您的浏览器和操作系统版本,请参阅:https://web.archive.org/web/20150212035837/http://www.videolan.org/doc/play-howto/en/ch04.html

It was possible on older browsers, but required a client-side browser plugin depending on your Browser and OS versions, see: https://web.archive.org/web/20150212035837/http://www.videolan.org/doc/play-howto/en/ch04.html

以下摘录展示了如何嵌入和回退下载或点击流式传输:

Here's an excerpt showing how to embed and fallback to download or click to stream:

<object type="application/x-vlc-plugin" data="http://server.example.com/video1.mpeg" width="400" height="300" id="video1">
     <param name="movie" value="http://server.example.com/video1.mpeg"/>
     <embed type="application/x-vlc-plugin" name="video1"
     autoplay="no" loop="no" width="400" height="300"
     target="http://server.example.com/video1.mpeg" />
     <a href="http://server.example.com/video1.mpeg">Download Video1</a>
</object>

VLC 播放器插件公开了一个有用的 JavaScript API,可以通过名称或 ID 访问:

The VLC player plugin exposes a useful JavaScript API accessed either by name or ID:

<a href="javascript:;" onclick='document.video1.play()'>Play video1</a>
<a href="javascript:;" onclick='document.getElementById('video1').pause()'>Pause video1</a>
<a href="javascript:;" onclick='document.video1.stop()'>Stop video1</a>
<a href="javascript:;" onclick='document.video1.fullscreen()'>Fullscreen</a>

MIME 类型 application/x-vlc-plugin 用于激活 VLC 插件(如果可用).您应该提供某种形式的后备,例如常规链接.

The MIME-type application/x-vlc-plugin is used to activate the VLC plugin (when it is available). You should provide some form of fallback, such as a regular link.

至于链接到 VLC 支持的协议,这将取决于用户的设备和/或操作系统设置,尤其是他们选择哪个应用程序作为给定协议的默认媒体播放器.但一个例子可能是:

As for linking to VLC-supported protocols, it will depend on the user's device and/or OS settings, particularly which application they've selected as the default Media player for a given protocol. But an example could be:

http://www.example.com/your_file.mpg

或:

rtsp://www.example.com/your_file.3gp

您可以包含有关如何将 VLC 设置为默认播放器的帮助"说明,或者您需要在客户端安装一些您自己的软件以确保 VLC 是打开的应用程序,不是别的.VLC 可以通过命令行轻松运行(在 VLC 第 4 章链接的页面顶部指定).

You could include "help" instructions on how to set VLC as your default player, or, alternatively you would require some software of your own to be installed on the client-side to ensure that VLC is the application that gets opened, not something else. VLC can easily be run by command-line (specified at the top of the page in that VLC Chapter 4 link).

请注意,随着 HTML5 支持变得越来越普遍可能要考虑使用 HTML5

Note that with HTML5 support getting more and more ubiquitous you might want to consider using HTML5 <video> tag and encoding in a supported profile of Ogg, MP4 or WebM.

更新:2018-09-25上述通知现在比以往任何时候都更需要考虑.坚持 HTML5 &开放标准.以上只是不再起作用,除非 VLC 团队通过开发与 WebExtensions 标准配合使用的版本使插件复活.对于个人用途,如果您使用旧浏览器专门为自己的视频流构建了一些东西,您仍然可以在本地网络上使用旧浏览器,但不建议您以这种方式为普通网络用户/访问者构建任何东西.

UPDATE: 2018-09-25 The above notice is now more important to take into consideration than ever. Stick to HTML5 & open standards. The above just won't work anymore, unless VLC team brings the plugin back from the dead by developing a version that works with WebExtensions standard. For personal use, you could still use an old browser on your local network if you had built something in particular for your own video streaming using that, but would not suggest you build anything for regular web users/visitors this way.

这篇关于通过浏览器在 VLC Player 上打开视频流的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆