Path: blob/main/website/Youtube/player_control.js
2940 views
var player;1// Callback for when the YouTube iFrame player is ready2function onYouTubeIframeAPIReady() {3player = new YT.Player('player', {4// Set Player height and width5height: '390',6width: '640',7// Set the id of the video to be played8videoId: 'M7lc1UVf-VE',9// Setup event listeners10// These are covered in the next section11events: {12'onReady': onPlayerReady13}14});15};1617function onPlayerReady (){18player.playVideo();19setTimeout(pauseVideo, 4000);20setTimeout(loadNewVideo, 6000);21setTimeout(stopVideo, 8500);22setInterval(getContent, 1000);23};2425function pauseVideo(){26player.pauseVideo();27}2829function loadNewVideo(){30player.loadVideoById("me91AGSVsyo");31}3233function stopVideo(){34player.stopVideo();35}3637function getContent(){38var content39content = player.INSERT_METHOD_HERE;40document.getElementById('content').innerText = content41}4243