Answer the question
In order to leave comments, you need to log in
YouTube API. Replacing another block with a player. How is the player generated?
Hello. There is such a function.
function cteateIframe(videoID, divID){
var player;
player = new YT.Player(divID, {
videoId: videoID,
events: {
'onReady': onPlayerReady
}
});
function onPlayerReady(event) {
event.target.stopVideo();
}
return player;
}
this.parentNode.replaceChild(iframe, this);
var iframe= cteateIframe(this.parentNode.dataset.id, 'youtube-iframe');
this.parentNode.dataset.id = "<img id="playVideo" ...>"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question