所以这个工作(你不能像这样从longtailvideo.com加载文件因为跨域的东西,只需用你自己的本地文件来测试)
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="jwplayer.js"></script>
</head>
<body>
<div id="vs" style="width:300px;height:250px;"></div>
<a href="javascript:void(0);" onclick="jwplayer().setMute();">Toggle the audio</a>
</body>
</html>
<script type="text/javascript">
jwplayer("vs").setup({
file: "http://content.longtailvideo.com/videos/flvplayer.flv",
flashplayer: "player.swf",
autostart:true,
controlbar: "none",
icons: "false",
repeat:"always",
stretching:"exactfit",
width:300,
height:250,
mute:"true"
});
</script>
无法进行静音切换。根据Longtail的文档(http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/16022/controlling-the-player-using-javascript)我所拥有的一切要做的是与onclick建立链接。不起作用。我甚至尝试使用JQuery的.click无济于事。使用MP4文件,使代码从闪存回落到HTML5视频。
这不适用于页面中包含的JQuery
<script type="text/javascript">
$(document).ready(function(){
$('#mutetoggle').click(function(){
jwplayer().setMute();
});
});
</script>
使用JW javascript进行嵌入的JW播放器:
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="jwplayer.js"></script>
</head>
<body>
<div id="vs" style="width:300px;height:250px;"></div>
<a href="#" id="mutetoggle" onclick="jwplayer().setMute();">Toggle the audio</a>
</body>
</html>
<script type="text/javascript">
jwplayer("vs").setup({
autostart:true,
controlbar: "none",
icons: "false",
repeat:"always",
stretching:"exactfit",
file: "http://content.longtailvideo.com/videos/flvplayer.flv",
flashplayer: "player.swf",
volume:50,
width:300,
height:250,
mute:"true"
});
</script>
答案 0 :(得分:2)
似乎文件和flashplayer参数必须在配置部分中排在第一位。 去图。
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="jwplayer.js"></script>
</head>
<body>
<div id="vs" style="width:300px;height:250px;"></div>
<a href="javascript:void(0);" onclick="jwplayer().setMute();">Toggle the audio</a>
</body>
</html>
<script type="text/javascript">
jwplayer("vs").setup({
file: "http://content.longtailvideo.com/videos/flvplayer.flv",
flashplayer: "player.swf",
autostart:true,
controlbar: "none",
icons: "false",
repeat:"always",
stretching:"exactfit",
width:300,
height:250,
mute:"true"
});
</script>