Stop video stimulus 500 ms after key press

Hi,
I have a video stimulus that needs to stop 500 ms after a keypress. In a related issue, it was suggested here to split it into two routines (so that participants do not realize) since using timing loops with builder creates a problem. However, the video stimulus is set every repeat depending on the condition randomly. So the video that is in the next trial may be a different one.

So, how can I present a video stimulus which is the same with the previous routine that actually changes every repeat?

Or do you have another suggestion for stopping the video 500 ms after key press?

Thank you all in advance.