psychopy.org | Reference | Downloads | Github

Not play the video, sound is ok, but image is not moving

Hi all,

We would like to show a video optionally during the experiment. MovieStim3 displays the video in an separate script but when we added it in our main experiment script, it shows only one frame and it gets stuck. The sound continues to plays during this time. I have added the code below. Any suggestions for this problem is welcomed.

        if event.getKeys(["f"]):
            background.setAutoDraw(False)
            fixkreuz_neutral.setAutoDraw(False)
            per_stim.setAutoDraw(False)
            image_stimulus.setAutoDraw(False)
            mov = visual.MovieStim3(win, './videos/animated_target.avi') 
            while mov.status !=constants.FINISHED:
                 mov.draw()
                 win.flip()
                 #mov.play()
                 if event.waitKeys(maxWait=3000, keyList=["w"]):
                    break
                    #background.setAutoDraw(True)
                    #fixkreuz_neutral.setAutoDraw(True)
                    #per_stim.setAutoDraw(True)
                    #image_stimulus.setAutoDraw(True)

Hi There!

Please could I check why you are preferring a code based approach here rather than builder view? In builder you could add a movieStim to a routine, then add a loop around that routine and in the nReps field use a variable to control if the routine is presented (i.e. nReps could be 0 or 1 - which would either skip or play the movie respectively).

Thanks!
Becca

Hi Becca,

Thank you for your suggestion! We were able to fix the code, now it is working smoothly. For your question, we are coregistering EEG and Eyetracker, and collecting both brain signal and eye movements simultaneously. Therefore, we need to start them at the beginning and send specific triggers for each type of stimulus. Using the code based approach helps us to integrate them with the stimulus presentation.

Best,
Sahura

Hi Sahura,

Pleased you managed to find your solution!
Happy testing!
Becca