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

I hope the video starts now properly ending the sound.

We still have to find to end the video after it played once though.

in my opinion, the movie doesn’t tell you whether its finished or not according to https://www.processing.org/reference/libraries/video/index.html

Hence, let’s use

float durationVideoMovie; int startMs; before setup()

after (!) video.play(); say
durationVideoMovie = video.duration(); // measured in seconds
startMs=millis(); // startMs is in millis, see reference

in this section

if (useImageMovie) {
    image(video, 0, 0);
  } 

say

if (useImageMovie) {
    image(video, 0, 0);
    // detect if video is over
    if((millis()-startMs) / 1000 >= durationVideoMovie ) {
          // Yes, go back to default black video (sound only) 
          useImageMovie=false; 
          video.stop();
          sound.play(); 
    }
  } 

not tested…

:wink: