Home > Forum > Plugins > Embed a videoplayer

Embed a videoplayer
0

MVP

Hi,

You can use html attribute to embed the player.
As for video status tracking, perhaps with js you can get that, but I don't know. Out of curiosity, I'll try to check it out, unless someone provides a ready-made solution beforehand.

Regards

--Edit , The script will display an alert when the video ends, you can insert another script ,










var player;

function onYouTubeIframeAPIReady() {
player = new YT.Player('youtube-player', {
events: {
'onStateChange': onPlayerStateChange
}
});
}

function onPlayerStateChange(event) {
if (event.data === YT.PlayerState.ENDED) {
// Show alert when the video ends
alert('End of video :) ');
}
}
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);


Privacy overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognizing you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.


To see a full list of the cookies we use and learn more about their purposes, visit our Privacy Policy.