Drawing a figure multiple times on top of a video during one playback

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): Win 10
PsychoPy version (e.g. 1.84.x): 3.2.2
Standard Standalone? (y/n) If not then what?: y
What are you trying to achieve?:
I am trying to playback a 30 minutes video and while the video is playing I want to draw a figure on top of the video for a few seconds for 40 times randomly during the playback. Which mean the video will never stop or replay but just the visual stimuli will randomly appear.
I am not sure how to do it. Is there a way in builder that I can set the figure stimuli to appear randomly? I tried to do it in coder but it seemed that the drew figure cannot be displayed on top of the video.

Thanks for you help.

This is just a matter of drawing order: the video must be drawn first on each frame, and then the stimuli you want to appear on top of it get drawn.

In Builder, effectively you want your stimuli to be controlled in the normal way with a routine within a loop, but the video needs to continue to play across iterations of that loop. That means it can’t be presented as a standard Builder video component (which ends when the routine ends). So you would need to control the playing of the video yourself with a some custom code, so that it plays regardless of what is happening with the routines and loop.

So you would insert a custom code component, and draw each frame of the video manually. If the other stimuli are below the code component, they should get appear on top of it.