How to loop multiple parts of a YouTube video in a row

Updated

YouTube cannot do this on its own. Its loop option repeats the whole video, and an embed link takes a single start and end point. To play, say, 1:20–1:43, then 2:02–2:10, then 2:30–2:49 and start over, you need either a few lines of JavaScript using YouTube’s IFrame Player API or a looper that chains sections for you. In ClipBack you mark the first part, click + Add section for each further part, and save them as one loop with one link.

Key facts

When one loop is not enough

A single loop repeats one stretch of video. Plenty of practice material is not one stretch:

Making one loop per part works, but then you switch between them by hand. Chaining the parts into one loop plays them in sequence and repeats the whole sequence.

Chain sections in ClipBack

  1. Load the video. Paste the link into ClipBack and click Load Video, or change youtube.com to clipback.tv in the address bar.
  2. Mark the first part. Drag the two handles, or type the times into Start and End. Turn on Snapback to hear each handle as you move it.
  3. Click + Add section. A new section appears after the current one, and the handles now move that one. The other sections stay faintly marked on the track.
  4. Repeat for each part. The list under the track shows every section with its times. Click a section to edit it again, use the arrows to change the order and ✕ to remove one.
  5. Click Play all to hear the whole sequence, including the jumps between sections. Touching a handle goes back to looping just the section you are editing.
  6. Name it and click Create Clip. The loop gets its own link and plays the sections in order, then starts over.

On the loop’s page the progress bar covers the whole sequence, with a small mark where one section hands over to the next. A loop with several sections works like any other: you can slow it down, add it to a playlist, where it moves on only after its last section, or embed it on a website.

Signed in, you can add, remove or reorder sections later with Edit Clip.

With code: the IFrame Player API

On your own website you can chain sections with YouTube’s IFrame Player API. Each section is loaded with a start and end point, and when it ends the next one is loaded. Change the video ID and the list of sections, which are in seconds from the start of the video:

<div id="player"></div>
<script>
  var VIDEO_ID = 'dQw4w9WgXcQ';
  var SECTIONS = [[80, 103], [122, 130], [150, 169]];  // [start, end] in seconds
  var current = 0, player;
  function onYouTubeIframeAPIReady() {
    player = new YT.Player('player', {
      videoId: VIDEO_ID,
      playerVars: { start: SECTIONS[0][0], end: SECTIONS[0][1], playsinline: 1 },
      events: {
        onStateChange: function (event) {
          if (event.data === YT.PlayerState.ENDED) {
            current = (current + 1) % SECTIONS.length;
            player.loadVideoById({ videoId: VIDEO_ID,
                                   startSeconds: SECTIONS[current][0],
                                   endSeconds: SECTIONS[current][1] });
          }
        }
      }
    });
  }
</script>
<script src="https://www.youtube.com/iframe_api"></script>

Which to use

YouTube loop Embed link IFrame Player API ClipBack
Parts per loopWhole videoOne, played onceAnyAny, free
RepeatsYesNoYesYes
Any order––YesYes
Code to writeNoneNoneAbout 20 linesNone
Shareable linkNoYesYour own pageYes
Saved speedNoNoIf you add itYes

Only need one part? See how to share a YouTube video with a start and end time. For using loops to learn a piece, see looping and slowing down for music practice.

Frequently asked questions

Can YouTube loop two different parts of a video?

No. YouTube's loop option repeats the whole video, and an embed link takes a single start and end, so it covers one stretch of the video and plays it once. Repeating two or more separate parts in a row needs either your own code using YouTube's IFrame Player API or a looper such as ClipBack.

Do the sections have to be in the same order as in the video?

No. The sections play in the order you put them in the list, so a chorus can come before the verse it follows in the song. Use the arrows next to each section to move it up or down.

How many parts can one loop have?

As many as you like, of any length.

Is there a gap when the loop jumps between sections?

There can be a short one. Each jump is a seek inside YouTube's player, and if that part of the video has not loaded yet the player has to buffer it first.

Can I add a section to a loop I already saved?

Yes: open the loop, click Edit Clip, and add, remove or reorder sections before you save.

Sources