I created 10 trials with two conditions, each condition plays a different movie (optic flow or random flow). I loaded the mp4 movies with the function visual.MovieStim3 and displayed the movies in my trials loop with the function movie.draw(). Since I have 10 trials, the videos should be shown randomly 10 times, but instead, the code is only displaying the first two videos in a loop of 10 trials. After showing a second video, the window stays black for some second then closes. There is no error thrown.
I added the lines optic_flow_movie.seek(0) and random_flow_movie.seek(0) following the answer to my question on StackOverflow provided by @Michael, and it worked on my Linux machine that had the Python Version (3.6.4) and the PsychoPy Version (3.2.0).
Now that I am trying it on a MAC computer that has the latest Python Version (3.7.4) and PsychoPy version (PsychoPy3, version 2020.1.2 ), I am running into the same bug, and there was no error thrown. There was only the warning:
WARNING We strongly recommend you activate the PTB sound engine in PsychoPy prefs as the preferred audio engine. Its timing is vastly superior. Your prefs are currently set to use [‘sounddevice’, ‘PTB’, ‘pyo’, ‘pygame’] (in that order).
Therefore, I downgraded the PsychoPy version to 3.2.0, and it is still bugging.
Your help would be very precious because this recurrent bug is preventing me from moving forward with my experiment. ![]()
nTrials = 10
nb_conditions = np.arange(1,3) # We have two conditions : Optic flow and Random flow
conditions = nb_conditions.repeat(nTrials/2) # 5 times condition_1 and 5 times condition_2
conditions_rand = np.random.permutation(conditions) # Randomize the order of the conditions
# Load optic flow and random flow movies (duration of each movie is 200 frames)
optic_flow_movie = visual.MovieStim3(win, 'optic_flow.mp4')
random_flow_movie = visual.MovieStim3(win, 'random_flow.mp4')
# iterate through trials and play movies
for trialcount in range(nTrials):
optic_flow_movie.seek(0)
random_flow_movie.seek(0)
for Nframes in range(200):
if conditions_rand[trialcount] == 1:
optic_flow_movie.draw()
elif conditions_rand[trialcount] == 2:
random_flow_movie.draw()
win.flip()
win.close()
