Hello,
I’m working on an experiment that will record eye tracking data during three movie clips. The movie clips are being presented with MovieStim.
I would like to allow the experimenter to press “escape” during the clip to end it early and proceed to the next clip.
However when I run it with my current code, the 1st clip (which has sound) continues to play sound throughout the other two clips and make the video clips choppy and sometimes freeze.
I’ve tried to add mov.stop() into my ‘break while’ loop but I get the error: AttributeError: ‘ManagedSoundPlayer’ object has no attribute ‘stop’.
I am using PsychoPy 1.86.6 on a Windows 7 64
I would appreciate your help!
# Initialise a PsychoPy MovieStim
mov = MovieStim(win, 'Experiment.mp4',size=[1920,1080], flipVert=False)
# Run for the duration of the video
while mov.status != visual.FINISHED:
# Fill the Display with the Screen. The right
# frame from the video will automatically
# be selected by PsychoPy.
disp.fill(movscr)
# Show the Display, and record its onset
t1 = disp.show()
# Log the screen flip.
tracker.log('FLIP; time=%d' % (t1))
# Check if the Escape key was pressed.
key, presstime = kb.get_key(keylist=['Escape', 'escape'], timeout=1, flush=False)
if key in ['Escape', 'escape']:
# Break the while loop.
tracker.log('ESCAPE; time=%d' % (presstime))
mov.stop()
break
# Initialise a PsychoPy MovieStim
mov = MovieStim(win, 'Resting_somesound.mp4',size=[1920,1080], flipVert=False)
# Run for the duration of the video
while mov.status != visual.FINISHED:
# Fill the Display with the Screen. The right
# frame from the video will automatically
# be selected by PsychoPy.
disp.fill(movscr)
# Show the Display, and record its onset
t1 = disp.show()
# Log the screen flip.
tracker.log('FLIP; time=%d' % (t1))
# Check if the Escape key was pressed.
key, presstime = kb.get_key(keylist=['Escape', 'escape'], timeout=1, flush=False)
if key in ['Escape', 'escape']:
# Break the while loop.
mov.stop()
tracker.log('ESCAPE; time=%d' % (presstime))
break
# Initialise a PsychoPy MovieStim
mov = MovieStim(win, 'VPCstim3.m4v',size=[1920,1080], flipVert=False)
# Run for the duration of the video
while mov.status != visual.FINISHED:
# Fill the Display with the Screen. The right
# frame from the video will automatically
# be selected by PsychoPy.
disp.fill(movscr)
# Show the Display, and record its onset
t1 = disp.show()
# Log the screen flip.
tracker.log('FLIP; time=%d' % (t1))
# Check if the Escape key was pressed.
key, presstime = kb.get_key(keylist=['Escape', 'escape'], timeout=1, flush=False)
if key in ['Escape', 'escape']:
# Break the while loop.
tracker.log('ESCAPE; time=%d' % (presstime))
mov.stop()
break