Есть предложения? Br />
Код: Выделить всё
(function () {
const tag = document.createElement("script");
tag.src = "https://www.youtube.com/iframe_api";
const firstScriptTag = document.getElementsByTagName("script")[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
window.addEventListener("load", () => {
const iframe = document.getElementById("video2_youtube");
try {
const player = new YT.Player(iframe, {
events: {
onReady: (event) => {
console.log("Player ready");
},
onError: (event) => {
console.error("Error in the player:", event);
},
},
});
console.log(player.getIframe());
console.log(player.getIframe().getElementsByTagName("body")); //dont show anything
} catch (error) {
console.error("Initialisation error:", error);
}
});
})();
< /code>
Я пытался использовать API YouTube, но я не знаю, делаю ли я это правильно или нет. < /p>
Если я создаю Объект игрока из API и используйте player.getiframe () Подробнее здесь: https://stackoverflow.com/questions/794 ... essibility
Мобильная версия