**MacOS 10.13.6
**PsychoPy version: 3.2.0
**Standard Standalone? (y)
Hi, everyone:
I have a question about timing and playing movies with moviepy (w/ ptb library & portaudio driver).
I need to know the timing of a custom response event while a movie is playing. A routine begins with a movie playing, and when the response occurs, I want to know the timing of the response relative to the start of the movie. (I can’t use any of the established response components like keyboard or button box because it is a custom response signal being read.)
Currently, I’m achieving this by grabbing the current clock time at the start of the routine in which the movie plays and then grabbing the current clock time when the response occurs, and then just subtracting the two. So I have a custom code component set to “Begin Routine” in the routine where the movie plays:
beginTime = clock.getTime()
Then, during the movie when the response occurs, I have the custom code component executed (this is triggered by the custom response signal):
shotTime = clock.getTime() - beginTime
shotTime is then saved as the time the response occurred relative to the beginning of the movie playing.
This works great. The problem is that the movies do not appear to begin immediately at the start of the routine but instead there may be a second blank screen pause before the movie starts. I’m concerned that, because of this delay, I’m not actually getting the response relative to the start of the MOVIE but instead relative to the start of the ROUTINE, which is (possibly) a second off.
My questions are, first, is it possible that movies are beginning to play slightly off from the start of the routine (even if the movie is supposed to begin at the start of the routine), and second, what is the best way to get a timing event relative to the ACTUAL start of the movie if the movies are not beginning at the exact start of the routine? Instead of grabbing the current clock time with beginTime = clock.getTime() at the start of the routine, is there a way to connect it to the flipping of the window to begin the movie or some other event that is certain to be the start of the movie playing?
Thank you for your help!
Joe