Sending markers during the presentation of a video
Hey all,
I am trying to have triggers sent through during the prsentation of a video. At the moment, I am working with the console to have them appear and I have produced the following code which is designed to send through a marker every 2 seconds. It works, but obviously Python run sequentially and begins printing the clock_time in 2 second intervals and prevents the video from playing. How do i get this to run simultanously with the video? I currently have the video files stored in a variable called [videos] within a loop.
start_time = clock.time()
while True:
current_time = clock.time()
elapsed_time = current_time - start_time
if elapsed_time >= 2:
print("Current time:", current_time)
start_time = current_time
exp.clock.sleep(2000)
Thank you in advance
Comments
I've found a built in variable, "frame" which can be used. Issue is, it now sends through multiple markers (because multiple frames are being sent and each is divisible by 60.5 to give 1).
def after_frame():
global frame
if frame % 60.5 == 1:
print('marker')
after_frame()