technically argument syntax is for “creating” playlists with an array of videoIds ie what I did use there earlier, but failed to provide good way to loop it from the start, so that would be
<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 onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
height: '1080',
width: '1920',
events: {
'onReady': onPlayerReady,
}
});
}
function onPlayerReady(event) {
event.target.loadPlaylist(['56R3hU-fWZY','O-ZblMfZpuw','l3w2MTXBebg']);
event.target.setLoop(true);
}
</script>
now to use Playlist ID with loadPlaylist(), you’re suppose to use object syntax ie
loadPlaylist({list:'PLQ-7WiWmOuK9ihqYG20uqClZWaM6CIDtf', listType: 'playlist'});
<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 onYouTubePlayerAPIReady() {
player = new YT.Player('player', {
height: '1080',
width: '1920',
events: {
'onReady': onPlayerReady
}
});
}
function onPlayerReady(event) {
event.target.loadPlaylist({list:'PLQ-7WiWmOuK9ihqYG20uqClZWaM6CIDtf', listType: 'playlist'});
event.target.setLoop(true);
}
</script>
Examples added to the KB - Autoplay Embedded Youtube Videos