我已经用HTML和JavaScript为vlc播放器编写了一个代码来流式传输实时视频,它在IE中运行得非常好但是当我在Firefox中尝试它时出现错误typeerror:vlc.playlist is 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=utf-8" />
<title>Vids</title>
<link href="main.css" rel="stylesheet" type="text/css" />
</head>
<body onload='player("rtsp://admin:admin@stanthonys.tjcsys.com:8554/CH001.sdp");' id="Video">
<div id="player">
<object type="application/x-vlc-plugin"
id="vlcplayer"
align="middle"
width="864px"
height="540px"
classid="clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921">
<param name="Volume" value="100" />
<param name="AutoPlay" value="true" />
<param name="AutoLoop" value="false" />
</object>
</div>
<div id="controls">
<input type="button" onclick="play();" value="Play" />
<input type="button" onclick="pause();" value="Pause" />
<input type="button" onclick="stop();" value="Stop" />
<input type="button" onclick="mute();" value="Mute" />
</div>
<script type="text/javascript" language="javascript">
var vlc = document.getElementById("vlcplayer");
function player(vid) {
try {
var options = new Array(":aspect-ratio=16:10", "--rtsp-tcp", ":no-video-title-show");
var id = vlc.playlist.add(vid,'Video',options);
vlc.playlist.playItem(id);
vlc.video.fullscreen = true;
//vlc.video.toggleFullscreen();
}
catch (ex) {
alert(ex);
}
}
function mute(){
vlc.audio.toggleMute();
}
function play(){
vlc.playlist.play();
}
function stop(){
vlc.playlist.stop();
}
function pause(){
vlc.playlist.togglePause();
}
function fullscreen(){
vlc.video.toggleFullscreen();
}
</script>
</body>
</html>
有人能看到问题吗?
答案 0 :(得分:0)
据我所知,“embed”标签用于Firefox,Chrome和“object”标签用于IE。 检查参考
<embed type="application/x-vlc-plugin"
version="VideoLAN.VLCPlugin.2"
pluginspage="http://www.videolan.org"
id="vlc"
autostart="yes"
toolbar="true"
loop="yes" width="600" height="400"
target="yourvideo/stream" />