Play a video after clicking a button

Hi folks.
I’m posting a new thread to ask for help humbly.
QQ截图20220628190215
This is a part of my experiment, as you could see, there are two parts called “VideoInstruction” and “VideoPlayer”.
What am I going to do is to provide two video clips that participants can watch, and I wanna setup two buttons, each of the buttons directs to the video clip in the “VideoPlayer”

e.g. If a participant clicks button #1, then the video on the VideoPlayer will be video clip #1.
And if he/she clicks #2, then video clip #2 will be displayed.

But I got stuck with the coding part, I mean what codes should I write to let the program understand my need? Maybe “if…then…”? If so, what might be the exact codes?

Thanks to every kind help and advice.

Is this for an online (js) or offline (python) experiment?

Offline. Just ask each participant respond to the computer.

If you use a :button: Button component, these have a field called “callback” where you can write code to be run when the button is clicked. To set the contents of a :movie: Movie component when the button is clicked, you would put this in the callback:

myMovie.movie = "path/to/relevant/file.mp4"

(with the path and component name replaced with your own)

Then in the Movie component just leave the movie field blank, or use default.mp4 as a placeholder (PsychoPy will always be able to find this file as it’s saved within PsychoPy itself)