I am trying to encode a movie stimulus. I know that the builder view has a movie component, but I am trying to add the movie in a routine that contains a 2-back task. I have found that certain keys, such as pausing, attributed to the movie reset themselves when the letters in the task change. So, I have decided to try to code the movie stimulus into the routine (within Builder) in hope that it may run continuously and the keys remain operable throughout the duration of the task.
However, I have found that the coding that I have tried to use from both the demos and previous responses to my other topics allows the audio to play but the movie will not actually appear on the screen. I do not have any experience with coding, so I am not certain what the issue could be. If there is anyone who could point out which part of coding needs to be corrected or what needs to added so that movie will play correctly, it will be much appreciated. Thank you.
from psychopy.constants import (PLAYING, PAUSED) from psychopy import prefs prefs.hardware['audioLib'] = ['sounddevice'] from psychopy import visual, core, event import time, os videopath = r'C:\Users\\alezu\\Downloads\\MattCutts_2011U-480p.mp4' videopath = os.path.join(os.getcwd(), videopath) if not os.path.exists(videopath): raise RuntimeError("Video File could not be found:" + videopath) win = visual.Window([1366, 768]) mov = visual.MovieStim3( win, videopath, size=[555,200], pos=[-250, 250], flipVert=False, flipHoriz=False, loop=False) shouldflip = mov.play() #Check for action keys..... for key in event.getKeys(): if key in ['escape', 'q']: win.close() core.quit() elif key in ['p', ]: # To pause the movie while it is playing.... if mov.status == PLAYING: print('PAUSING') mov.pause() elif mov.status == PAUSED: # To /unpause/ the movie if pause has been called.... print('UN-PAUSING') mov.play()