Help needed to code videos play with processing by receiving data from Arduino

Hello and thanks a lot for your immediate reply!

You said that when the video is over, I should set useImageMovie to false. This means that I should write this line of code at the end of the if, else- clause?

I run the code with 2 mov-type videos but I still get the same result. The first video plays for one second and almost immediately the second video starts playing without placing any object in front of the sensor.