我有很好的iframe与简单的js但我的问题我想在MUTE中播放,但我无法做,所以可以帮助我做,记住我不想要自动播放,只是我想让它成为MUTE音频时点击播放,,,这里我的代码
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="http://code.jquery.com/jquery-latest.min.js"></script>
<script type="text/javascript" src="http://www.jqueryscript.net/demo/Easy-jQuery-Video-Controller-Plugin/dist/jquery.videoController.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#my-video').videoController({
videoReady: function() { displayEvent('ready'); },
videoStart: function() { displayEvent('start'); },
videoPlay: function() { displayEvent('play'); },
videoPause: function() { displayEvent('pause'); },
videoEnded: function() { displayEvent('ended'); }
});
});
function playVideo() {
$('#my-video').videoController('play');
}
function pauseVideo() {
$('#my-video').videoController('pause');
}
function stopVideo() {
$('#my-video').videoController('stop');
}
function displayEvent(eventType) {
var textarea = $('.events');
textarea.val(textarea.val() + '\n' + eventType);
textarea.scrollTop(textarea[0].scrollHeight);
}
</script>
</head>
<body>
<iframe id="my-video" src="http://www.youtube.com/embed/oaDkph9yQBs?enablejsapi=1" width="560" height="315" frameborder="0" allowfullscreen></iframe>
<div class="controls"> <a href="#" onclick="playVideo();">Play</a> <a href="#" onclick="pauseVideo();">Pause</a> <a href="#" onclick="stopVideo();">Stop</a> </div>
<textarea class="events" cols="50" rows="10">Events:</textarea>
</body>
</html>
答案 0 :(得分:0)
这是重复的。在你的例子中,没有任何东西可以使视频静音。 但这里有正确答案的副本。
<iframe id="my-video" src="http://www.youtube.com/embed/oaDkph9yQBs?enablejsapi=1" width="560" height="315" volume="0" frameborder="0" allowfullscreen></iframe>
似乎视频控制器插件没有静音视频的方法。所以...:
var myVideo = iframe.getElementById('myVideo');
myVideo.mute();