<script>
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);
var player;
function onYouTubeIframeAPIReady() {
player = new YT.Player('youtube-vid', {
videoId: 'M7lc1UVf-VE',
events: {
'onReady': onPlayerReady,
'onStateChange': onPlayerStateChange
}
});
}
function onPlayerReady(event) {
event.target.playVideo();
event.target.setPlaybackQuality('hd1080');
}
function onPlayerStateChange(e) {
if (e.data === YT.PlayerState.ENDED) {
player.playVideo();
}
}
</script>
Please help me out to set youtube quality hd1080 and auto play on page load I used the above code but it not working for me
Thanks in advance!