使用 JW 播放器闪光灯进行静音切换的链接,回退到 HTML5 视频不起作用

Link for mute toggle using JW Player flash with fallback to HTML5 video not working

本文关键字:链接 回退 不起作用 视频 HTML5 闪光灯 播放器 JW 使用      更新时间:2023-09-26

编辑:哇,通过将"文件"和"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),我所要做的就是通过点击创建一个链接。不行。我什至尝试了使用 JQuery 的 .click,但无济于事。使用 MP4 文件,以便代码从 Flash 回退到 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>

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