我无法弄清楚如何通过javascript禁用全屏双击。我正在尝试的一切都没有。有人可以帮我吗?
要防止从iframe中双击全屏,您要做的就是从iframe代码中删除 allowfullscreen 。
但是,如果您不使用iframe,该如何通过youtube javascript API完成?
我似乎不明白
https://jsfiddle.net/zb6mkug3/331/
<div class="wrapg ">
<div class="js-player"></div>
</div>
(function iife() {
"use strict";
var tag = document.createElement("script");
tag.src = "https://www.youtube.com/player_api";
var firstScriptTag = document.getElementsByTagName("script")[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
function onPlayerReady(event) {
const youtubePlayer = event.target;
youtubePlayer.setVolume(0); // percent
}
window.onYouTubePlayerAPIReady = function() {
new YT.Player(document.querySelector(".js-player"), {
height: '315',
width: '560',
host: 'https://www.youtube-nocookie.com',
videoId: 'M7lc1UVf-VE',
playerVars: {
autoplay: 0,
controls: 1,
showinfo: 1,
rel: 0,
iv_load_policy: 3,
cc_load_policy: 0,
fs: 0,
disablekb: 1
},
events: {
"onReady": onPlayerReady
}
});
};
}());