简体   繁体   English

使用JW播放器闪存进行静音切换的链接,回退到HTML5视频无法正常工作

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

EDIT: Wow, solved it by placing the 'file' and 'flashplayer' configs first in the configuration section. 编辑:哇,首先在配置部分放置'文件'和'flashplayer'配置解决它。 I guess those two parameters have to be first in the configuration section. 我想这两个参数必须首先在配置部分。

So this works (You cant load the file from longtailvideo.com like this because of cross domain stuff, just use your own local file to test) 所以这个工作(你不能像这样从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>

Can't get the mute toggle working. 无法进行静音切换工作。 According to Longtail's documentation (http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/16022/controlling-the-player-using-javascript) all I have to do is make a link with an onclick. 根据Longtail的文档(http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/16022/controlling-the-player-using-javascript),我所要做的就是制作与onclick的链接。 Doesnt work. 不起作用。 I even tried a .click with JQuery to no avail. 我甚至尝试使用JQuery的.click无济于事。 Using MP4 files so the code falls back from flash to HTML5 video. 使用MP4文件,使代码从闪存回落到HTML5视频。

This doesnt work either with JQuery included in the page 这不适用于页面中包含的JQuery

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

JW Player with JW javascript for embed: 嵌入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>

It seems the file and flashplayer parameters have to be first in the configuration section. 似乎文件和flashplayer参数必须在配置部分中排在第一位。 Go figure. 去搞清楚。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM