Controlling multiple video playback with Arduino

Hi everyone, I started learning TD a few days ago and I am trying to transfer a project I had made with Arduino and Processing but I see I need some help here.

I have data coming from Arduino and switching between 3 videos depending on the index number, however, I am completely stuck at how to create the logic for the videos to stop and play. At the moment I can switch between them but they keep looping and the audio is being played from all 3 videos constantly.

What I am trying to achieve is simply make the video play when the index number is called and to stop it and reset to start if another number comes in (from the Arduino). I would appreciate any pointers to tutorials or advice on how to solve this.

I can’t attach the file here so I have a link to my Google drive, hope that is ok.
https://drive.google.com/drive/folders/1biIZH3I-DcqmWtQM9JowrTsZstFglN5H?usp=sharing

Thank you in advance,
Ruta

Here a quick and dirty proposition for 3 movies, without stopping the non playing video (the number 0 do it).
For a more elegant proposition including more movie I would use a table and replicator to do the trick.
If I have the time, I will post if.

movieSwitcher.toe (4.1 KB)

As proposed, an universal version depending on a table, first column with path of movies (can be merged with folder Dat), second with 0 for stop and 1 for play. You can easily add lines for more films and find a script to change the play value.
Enjoy,

movieSwitcher.toe (4.7 KB)

Thank you so much for such a quick answer! I tried all sorts of ways yesterday and today but was not able to get it working with my Arduino readings. I think I have to study up a bit more before I can get this final bit working.

Got this working! Thank you again.