Hello,
Back in 2019, I found some great help from the forum for a coding issue with a movie stimulus. However, that coding which still works in version 3.1.5 does not work in the latest version of PsychoPy. Due to the pandemic, the study may have to get moved online for data collection which is why I would like to make it work with the newest version. The movie still plays however when I press ‘p’, nothing happens. The movie doesn’t stop playing and the polygon does not appear. If anyone can share some insight on how to make the coding compatible, it would be much appreciated. I have provided my coding below, it is used for ‘Each Frame.’
from psychopy.constants import (PLAYING, PAUSED)
from psychopy import prefs
prefs.hardware[‘audioLib’] = [‘sounddevice’]
videopath = r’.\GregTed.mp4’
videopath = os.path.join(os.getcwd(), videopath)
if not os.path.exists(videopath):
raise RuntimeError(“Video File could not be found:” + videopath)
Check for action keys…
for key in event.getKeys():
if key in [‘escape’, ]:
win.close()
core.quit()
elif key in [‘p’]:
if mov.status == PLAYING:
print(‘PAUSING’)
polygon.setAutoDraw(True)
mov.pause()
win.flip()
elif mov.status == PAUSED:
print(‘UN-PAUSING’)
mov.play()
polygon.setAutoDraw(False)