Video looping with shifting starting-point
in
Core Library Questions
•
1 year ago
Hi,
I appreciate any help! I'm still getting started with the program, but am learning a lot.
I'm trying to write a program which loads a movie file from the beginning and after playing for .5 seconds, start the movie again, but .1 seconds from the beginning. Basically, play the video from 0-.5 seconds, then .1-. 6 seconds, then .2- .7 seconds, etc. etc. I think I have the code pretty close, but there are a few elements that just aren't working for whatever reason. Here's my current code:
- import processing.video.*;
- Movie myMovie;
- void setup() {
- size(480, 320, P2D);
- background(0);
- myMovie = new Movie(this, "amarcord.mov");
- myMovie.loop();
- }
- void draw() {
- tint(255, 20);
- image(myMovie, 0, 0);
- }
- void movieEvent (Movie m) {
- m.read();
- float mt= myMovie.time();
- float i;
- float t;
- for (i=.5;mt>i; i += 0.1) {
- for ( t=0;t<i;t+= 0.1) {
- myMovie.jump(t);
- }
- }
- }
What it's doing now is basically looping the first .5 seconds over and over, and occasionally the video just quits.
1