【问题标题】:Link for mute toggle using JW Player flash with fallback to HTML5 video not working使用 JW Player flash 的静音切换链接,回退到 HTML5 视频不起作用
【发布时间】:2012-05-28 00:16:27
【问题描述】:

编辑:哇,通过将“文件”和“flashplayer”配置首先放在配置部分中来解决它。我猜这两个参数必须放在配置部分的第一位。

所以这行得通(由于跨域的东西,您不能像这样从 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 的链接。不工作。我什至尝试了 .click 与 JQuery 无济于事。使用 MP4 文件,使代码从 flash 回退到 HTML5 视频。

这不适用于页面中包含的 JQuery

<script type="text/javascript">
$(document).ready(function(){
$('#mutetoggle').click(function(){
jwplayer().setMute();
});
});
</script>

带有 JW javascript 嵌入的 JW Player:

<!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>

【问题讨论】:

  • jwplayer("vs").setMute(); 怎么样

标签: javascript jquery jwplayer


【解决方案1】:

似乎文件和 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>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-06-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2011-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多