HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/SBogers10/honger7.komma.pro/resources/assets/js/site/includes/youtube.js
/* ==========================================================================
 Youtube handler
 ========================================================================== */
var tag = document.createElement('script');
tag.src = "https://www.youtube.com/iframe_api";
var firstScriptTag = document.getElementsByTagName('script')[0];
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

// Replace the 'ytplayer' element with an <iframe> and
// YouTube player after the API code downloads.
var player;
function onYouTubePlayerAPIReady() {
    player = new YT.Player('ytplayer', {
        height: '360',
        width: '640',
        videoId: 'L1SzPfYkeF4',
        playerVars: {
            modestbranding: 0,
            showinfo: 0,
            rel: 0,
            controls: 0,
            host: 'https://www.youtube-nocookie.com',
            disablekb: 1
        },
        events: {
            'onReady': onPlayerReady,
            'onStateChange': onPlayerStateChange
        }
    });
}

function onPlayerStateChange(state) {

    // Loop video
    if (state.data === YT.PlayerState.ENDED ) {
        player.playVideo();
    }
}

function onPlayerReady() {

    // Show video
    setTimeout(function(){ $('#ytplayer').stop().animate({ opacity: 1 },1000) },800);

    // If not on tablet or mobile, play on high quality
    player.mute();
    player.playVideo();
    player.setPlaybackQuality('hd1080');
}