// 2. This code loads the IFrame Player API code asynchronously. var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); // 3. This function creates an (and YouTube player) // after the API code downloads. var player; function onYouTubeIframeAPIReady() { var w = window.innerWidth; var h = window.innerWidth * 0.60; player = new YT.Player('player', { playerVars: { modestbranding: true, controls: 1, loop: 1, // Show pause/play buttons in player showinfo: 0, // Hide the video title modestbranding: 1, // Hide the Youtube Logo fs: 1, // Hide the full screen button cc_load_policy: 0, // Hide closed captions iv_load_policy: 3, // Hide the Video Annotations start: 0, //end: 35, autohide: 1, // Hide video controls when playing rel: 0, vq: 'hd720', }, height: h, width: w, videoId: '40pE9_y9FTI', events: { 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange } }); } // 4. The API will call this function when the video player is ready. function onPlayerReady(event) { // event.target.playVideo(); } // 5. The API calls this function when the player's state changes. // The function indicates that when playing a video (state=1), // the player should play for six seconds and then stop. var done = false; function onPlayerStateChange(event) { if (event.data == YT.PlayerState.PLAYING && !done) { setTimeout(pauseVideo, 35500); done = true; } } function pauseVideo() { document.getElementById("hidesection").style.display = "block"; document.getElementById("showvideo").style.display = "none"; player.stopVideo(); }
// 2. This code loads the IFrame Player API code asynchronously. var tag = document.createElement('script'); tag.src = "https://www.youtube.com/iframe_api"; var firstScriptTag = document.getElementsByTagName('script')[0]; firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); // 3. This function creates an (and YouTube player) // after the API code downloads. var player; function onYouTubeIframeAPIReady() { var w = window.innerWidth; var h = window.innerWidth * 0.60; player = new YT.Player('player', { playerVars: { modestbranding: true, controls: 1, loop: 1, // Show pause/play buttons in player showinfo: 0, // Hide the video title modestbranding: 1, // Hide the Youtube Logo fs: 1, // Hide the full screen button cc_load_policy: 0, // Hide closed captions iv_load_policy: 3, // Hide the Video Annotations start: 0, //end: 35, autohide: 1, // Hide video controls when playing rel: 0, vq: 'hd720', }, height: h, width: w, videoId: '40pE9_y9FTI', events: { 'onReady': onPlayerReady, 'onStateChange': onPlayerStateChange } }); } // 4. The API will call this function when the video player is ready. function onPlayerReady(event) { // event.target.playVideo(); } // 5. The API calls this function when the player's state changes. // The function indicates that when playing a video (state=1), // the player should play for six seconds and then stop. var done = false; function onPlayerStateChange(event) { if (event.data == YT.PlayerState.PLAYING && !done) { setTimeout(pauseVideo, 35500); done = true; } } function pauseVideo() { document.getElementById("hidesection").style.display = "block"; document.getElementById("showvideo").style.display = "none"; player.stopVideo(); }

The Recharge Blog

learn more about red light therapy

Get Free Shipping

Sign up to our newsletter and instantly receive a coupon for free worldwide shipping.