Slight pause when reversing video playback speed

Hi all – I’m working on a project that requrires looping certain portions of a video by sort of scrubbing backwards and forwards over the same portion – i.e. play the video from 00:37 to 00:48, then reverse the speed so it plays backwards to 00:37, and then repeat. I have a sloppy proof of concept that works fine, with the very significant exception that there is a short (maybe 500ms) pause before it “changes direction” on both ends of the loop. Being a n00b I can’t tell if this is an inherent limitation of the video library, or my crappy code? Any ideas based on the below?

Again, please bear in mind this was just a quick and dirty proof of concept…

import processing.video.*;

Movie myMovie;

void setup(){
    size(720, 480);
    myMovie = new Movie(this, "/path/to/video.mp4");
    myMovie.play();
    myMovie.jump(37);
}

void draw(){
    image(myMovie, 0, 0);
        if (myMovie.time() <= 37){
        myMovie.speed(1.0);
        myMovie.play();
    }
    if (myMovie.time() >= 48{
        myMovie.speed(-1.0);
        myMovie.play();
    }
}

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