# Loop section of video

**URL:** <https://discourse.processing.org/t/loop-section-of-video/10713>\
**Category:** Libraries\
**Created:** [April 28, 2019, 1:06pm UTC](https://discourse.processing.org/t/loop-section-of-video/10713 "2019-04-28T13:06:20Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BarryLimestone](https://avatars.discourse-cdn.com/v4/letter/b/d6d6ee/32.png) [@BarryLimestone](https://discourse.processing.org/u/BarryLimestone)\
**Post date:** [April 28, 2019, 1:06pm UTC](https://discourse.processing.org/t/loop-section-of-video/10713/1 "2019-04-28T13:06:20Z")

</div>

Hello people,

First of, I’m a total noob, so if anything I say is obvious or stupid, I hereby apologise.

For a university project I’m trying to make an interactive (Think Bandersnatch) video that branches into different clips depending on several variables. For this I’m going to be using an arduino with a heart rate sensor and a gyroscope, through serial communication with processing.

Before I get into this part however, I first decided to try and make my ‘decision point’ in the video loop until a decision is made, or at least for a certain number of loops, until (through clicking or the heart rate/gyro values) the next clip starts.

I realise some of this might be a bit too hard for me as a total beginner, so that’s why I’m focusing on getting a simple loop going first. I would like this loop to start at a certain time code, and loop a specific section of ten seconds with a vide/audio fade to make it smoother.

I have been able to make a video player, but have only succeeded at infinitely looping the full video, rather than a short section. Can anyone give me an example/advice on how to loop a specific section of a video?

(So basically the video file should just play normally, until a specific time code is reached after which it should loop a 10-15 second bit after that.)  
Below is what I have so far.

Thanks so much for your time,

Folly

```auto
import processing.serial.*;

Serial myPort;
String myBPM="";

import processing.video.*;

String PATH = "/Users/follydentoom/Movies/Render Interactive Project Prototype/Fixed 2.0/Daan Slaapt Wide 1.mp4";
Movie mov;

String PATH1 = "/Users/follydentoom/Movies/Render Interactive Project Prototype/Fixed 2.0/Daan Slaapt Wide 1_1.mp4";
Movie mov1;

String PATH2 = "/Users/follydentoom/Movies/Render Interactive Project Prototype/Fixed 2.0/gele pil-.mp4";
Movie mov2;

void setup() {
  size(1920, 1080);
frameRate(24);
mov = new Movie(this, PATH);
mov.play(); 

mov.play(); 

}

void movieEvent(Movie m) {
  m.read();
}

void draw() {
  image(mov,0,0, width , height);
  
}

```

---

<div class="post-metadata">

**Author:** ![josephh](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/josephh/32/210_2.png) [@josephh](https://discourse.processing.org/u/josephh)\
**Post date:** [April 28, 2019, 2:49pm UTC](https://discourse.processing.org/t/loop-section-of-video/10713/2 "2019-04-28T14:49:42Z")

</div>

Hi,

Welcome to the community. 🙂  
First of all, you can format your code by pressing `Ctrl+T` in the Processing IDE code editor and on the forum when you edit your message, use the `</>` button to insert code.

I think you can use the function `.jump(where)` so when your video is going over a certain time code, you jump to the beginning :

```auto
if (myMovie.time() > 1.0){ //Over 1 second
    myMovie.jump(0);
}

```
