我使用嵌入式vlc插件在我的网页上演示rtsp视频流。
我将它包含在我的页面主体中,方式如下:
<embed type="application/x-vlc-plugin" name="VLC" autoplay="yes"
loop="no" volume="100" width="800" height="600" target="rtsp://url.to.stream">但是如果用户没有安装vlc播放器插件,就没有镜像,也没有提供安装它的链接。我如何识别用户是否有插件(可能是通过JavaScript ),或者是否可以添加更多<embed>元素的属性,从而自动提供插件安装?
发布于 2012-05-13 07:17:20
一种选择是使用VLC媒体播放器插件检测器。
http://www.pinlady.net/PluginDetect/VLC/
在大多数情况下,is工作得很好,但也有一些缺点,您应该考虑一下。
发布于 2012-05-13 07:15:04
您可以使用以下函数:
isVLCInstalled: function() {
var name = "VLC";
if (navigator.plugins && (navigator.plugins.length > 0)) {
for(var i=0;i<navigator.plugins.length;++i)
if (navigator.plugins[i].name.indexOf(name) != -1)
return true;
}
else {
try {
new ActiveXObject("VideoLAN.VLCPlugin.2");
return true;
} catch (err) {}
}
return false;
}发布于 2015-09-24 16:31:03
这是我第一次访问Vlc对象时使用的:
// First get Vlc object (using getElementById or jquery $('#vlc') etc.)
// Now you test if Vlc web plugin is available checking a method or a property of Vlc object
try {
vlc.playlist.stop();
// Or you can try another method or properties for example vlc.playlist.clear()
} catch (error) {
console.log("Vlc Web Plugin is not available");
// Or put your code when Vlc web plugin is not available
}https://stackoverflow.com/questions/10568119
复制相似问题