Javascript 无法使用IE9及更早版本中的VLC activeX插件播放视频
我正在尝试在IE9和早期版本中播放视频。为此,我使用activeX插件加载VLC媒体播放器(这是我的基本要求) 当我试图执行代码时,抛出了一个错误:Javascript 无法使用IE9及更早版本中的VLC activeX插件播放视频,javascript,jquery,html,video-streaming,vlc,Javascript,Jquery,Html,Video Streaming,Vlc,我正在尝试在IE9和早期版本中播放视频。为此,我使用activeX插件加载VLC媒体播放器(这是我的基本要求) 当我试图执行代码时,抛出了一个错误: Unable to get value of the property 'playlist': object is null or undefined 我的代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/
Unable to get value of the property 'playlist': object is null or undefined
我的代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>VLC API</title>
<script src="http://code.jquery.com/jquery-2.1.0.min.js"></script>
<script>
$(document).ready(function(){
play();
displayPlugins();
$(function(){
$("#vlc").css({ "width": "400px", "height": "300px" });
});
});
function play()
{
var vlc=document.getElementById("vlc");
alert("play video");
var url="rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov";
var options=new Array(":aspect-ratio=4:3","-rtsp-tcp");
var id= vlc.playlist.add(url,"",options);
vlc.playlist.playItem(id);
}
function displayPlugins()
{
alert("plugins");
var player="<object type='application/x-vlc-plugin' id='vlc' width='300' height='225' classid='clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921' codebase='http://activex.microsoft.com/controls/vb5/comdlg32.cab'></object>";
$("#video_holder").html(player);
}
</script>
</head>
<body>
<div id="video_holder" style="border:1px solid #00FF33; height:350px;"></div>
</body>
VLC API
$(文档).ready(函数(){
play();
显示插件();
$(函数(){
$(“#vlc”).css({“宽度”:“400px”,“高度”:“300px”});
});
});
函数播放()
{
var vlc=document.getElementById(“vlc”);
警报(“播放视频”);
变量url=”rtsp://184.72.239.149/vod/mp4:BigBuckBunny_115k.mov";
var options=new数组(“:纵横比=4:3”,“-rtsp-tcp”);
var id=vlc.playlist.add(url,“,选项);
vlc.playlist.playItem(id);
}
函数displayPlugins()
{
警报(“插件”);
var player=“”;
$(“#视频支架”).html(播放器);
}
有谁能帮我找出哪里出错了吗?你在做:
var vlc=document.getElementById("vlc");
但在HTML上,您必须
<div id="video_holder" style="border:1px solid #00FF33; height:350px;"></div>
在那之后你可能会有更多的问题,但从这里开始
var vlc=document.getElementById("video_holder");