Quantcast
Channel: Active questions tagged youtube-api - Stack Overflow
Viewing all articles
Browse latest Browse all 3831

I can't put a loop and limit the video size to 2 minutes

$
0
0

Good evening! I got this code here on the forum and it's working fine, but I'm not able to put a loop for the video to keep repeating all the time and the time of 2 minutes. When he arrives in 2 minutes he will return to the beginning. Can someone help me?

<!DOCTYPE html><html><head><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=2.0, minimum-scale=1.0, user-scalable=yes"></head><body><!-- 1. The <iframe> (video player) will replace this <div> tag. --><div id="player"></div><script>  // 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 <iframe> (and YouTube player)  //    after the API code downloads.  var player;  function onYouTubeIframeAPIReady() {    player = new YT.Player('player', {      width: '100%',      videoId: 'osz5tVY97dQ',      playerVars: { 'autoplay': 1, 'playsinline': 1 },      events: {'onReady': onPlayerReady      }    });  }  // 4. The API will call this function when the video player is ready.  function onPlayerReady(event) {     event.target.mute();    event.target.playVideo();  }</script></body></html>

Viewing all articles
Browse latest Browse all 3831

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>