[英]Pause audio player when video player starts
I have an instance of Jplayer (HTML5 audio player for jQuery) and an instance of JW Player (HTML5 video player) on the home page of a website I'm jazzing up for a friend: http://www.creativetuition.co.uk/cgt/index.php 我在为一个朋友着迷的网站的主页上有一个Jplayer(用于jQuery的HTML5音频播放器)实例和一个JW Player(用于HTML5视频播放器)的实例: http : //www.creativetuition.co。英国/cgt/index.php
I have not yet been able (with my limited JavaScript knowledge) to successfully get the audio player to pause when the video is played, and preferably vice versa. 我还无法(凭我有限的JavaScript知识)成功地使音频播放器在播放视频时暂停播放,最好反之亦然。
I presume I have to use some sort of event 'listener', but really I am struggling and would really appreciate any help you guys can offer. 我想我必须使用某种事件“侦听器”,但是我确实很挣扎,并且非常感谢你们可以提供的任何帮助。 If you want me to post code just say which bits and I will happily oblige.
如果您要我发布代码,只需说出几位,我将很乐意为您服务。
Thanks 谢谢
This one 这个
$(function(){
$("video").prop('muted', true);
});
... ...
<video class='0' autoplay="true" src="http://media.w3.org/2010/05/sintel/trailer.webm">
</video>
..also ..也
$("video").prop('muted', false); // Unmutes
I used the jplayer and jwplayer documentation to identify what I needed to do. 我使用了jplayer和jwplayer文档来确定我需要做什么。 This is the script that I used and put at the bottom of the appropriate page.
这是我使用的脚本,并放在相应页面的底部。
<script>
$(document).ready(function () {
jwplayer('mediaspace').onPlay(function () {
$('#jquery_jplayer_2').jPlayer("pause");
});
});
</script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.