PsychoPy (v2022.2.1)
Hello
I am trying to play a movie stimulus for an experiment, but I want it to start playing after I press a play button. Specifically, I want the movie to appear on the screen paused and then play after the button has been pressed. I preferably do not want a key press though.
a. The movie stimulus (VideoPres) is set to start at – time(s) 0. I do not want to use a condition (although it works), because that means the stimulus will appear when the condition is met.
b. My ‘play button’ is basically an Image with a mouse component.
c. I have a code:
Begin Routine
if VideoPres.status == PLAYING:
VideoPres.pause()
Each Frame
if PlayMouse.isPressedIn(PlayButton):
VideoPres.play()
What have I tried:
I tried using VideoPres.autoStart(False)
and other possibilities of the VideoPres.status
and functions, which I do not clearly remember right now, because I have been trying different things for the past day.
With an if/else statement, it seemed to work, but only if the mouse is being pressed continuously.
What seemed to work:
I eventually went to the python script, and changed the code here. Specifically, I changed VideoPres.play() – to – VideoPres.pause(). That worked perfectly when I was running it as a py file, but I have no idea how to run it in Pavlovia, without using the Builder. I tried syncing the file with the Pavlovia project, but when I ran it it looked like nothing was synced.
# *VideoPres* updates
if VideoPres.status == NOT_STARTED and tThisFlip >= 0-frameTolerance:
# keep track of start time/frame for later
VideoPres.frameNStart = frameN # exact frame index
VideoPres.tStart = t # local t and not account for scr refresh
VideoPres.tStartRefresh = tThisFlipGlobal # on global time
win.timeOnFlip(VideoPres, 'tStartRefresh') # time at next scr refresh
# add timestamp to datafile
thisExp.timestampOnFlip(win, 'VideoPres.started')
VideoPres.setAutoDraw(True)
VideoPres.pause()
if VideoPres.status == FINISHED: # force-end the routine
continueRoutine = False
Any ideas/help is greatly appreciated! I have run out of options