Getting a movie to play multiple times (once per trial)

360 views
Skip to first unread message

Danielle Smith

unread,
Jul 28, 2013, 2:20:18 PM7/28/13
to psychop...@googlegroups.com
Like in Eric Flyn's question, I'm trying to get the same movie to play at the end of each trial. It works for the first iteration of a loop, but nothing is shown in subsequent iterations (not even the last frame of the movie) - it's like the stimulus never existed.

I'm using the syntax described in the MovieStim demo:
while mov.status != visual.FINISHED:
    mov
.draw()
    win
.update()

I have tried including
mov.seek(0)
and
mov.status = visual.NOT_FINISHED
in the appropriate places, but it doesn't appear to make any difference in this case.

I have also tried to show the movie using the syntax:
for frameN in range(100):
    mov
.draw()
    win
.flip()
but this does not help my problem.

If anyone has any suggestions I'd be very grateful.

Michael MacAskill

unread,
Jul 28, 2013, 6:39:38 PM7/28/13
to psychop...@googlegroups.com
Hi Danielle,

I tried the same thing and could replicate your problem. The only thing that worked for me to fix it was to put this code in a code component in the "Begin Routine" box:

movie.loadMovie("jwpIntro.mov")

Replace "movie" with the name of your movie component and "jwpIntro.mov" with the name of your movie file. Also make sure the code component appears above your movie component in the Builder window.

Playing and replaying a movie seems a bit flaky. Re-loading the movie seems to reset it properly. This needs to be addressed but I can't quite see where the problem lies in the PsychoPy code. Hopefully this workaround will help you out in the meantime.

Regards,

Michael

PS actually, re-reading your message, you might not be using Builder at all, but the suggested line above should work in Coder as well, if you put it at the beginning of each trial.

Jonathan Peirce

unread,
Jul 29, 2013, 5:39:59 AM7/29/13
to psychop...@googlegroups.com
Yes, I'm and not sure if it's for all movie formats that seek(0) doesn't
work or whether it's just some. But reloading the movie is the most
definite way to do it. Builder-generated scripts do that for the same
reason.

Jon
--
Jonathan Peirce
Nottingham Visual Neuroscience

http://www.peirce.org.uk

This message and any attachment are intended solely for the addressee and may contain confidential information. If you have received this message in error, please send it back to me, and immediately delete it. Please do not use, copy or disclose the information contained in this message or in any attachment. Any views or opinions expressed by the author of this email do not necessarily reflect the views of the University of Nottingham.

This message has been checked for viruses but the contents of an attachment
may still contain software viruses which could damage your computer system, you are advised to perform your own checks. Email communications with the University of Nottingham may be monitored as permitted by UK legislation.




Michael MacAskill

unread,
Jul 29, 2013, 5:59:17 AM7/29/13
to psychop...@googlegroups.com

On 29 Jul, 2013, at 21:39, Jonathan Peirce <jonatha...@nottingham.ac.uk> wrote:
> But reloading the movie is the most definite way to do it. Builder-generated scripts do that for the same reason.
Hi Jon,

As far as I can see, Builder doesn't use loadMovie(). The movie file is specified just once, when the movie stimulus is initially created.

I had thought Danielle was using Builder, and so I used that to see what was happening. It was only by adding .loadMovie() in a Code component that Builder could successfully repeat the same movie multiple times.

Cheers,

Mike

Jonathan Peirce

unread,
Jul 29, 2013, 6:03:58 AM7/29/13
to psychop...@googlegroups.com
Yes, not using loadMovie() but creating a new movie instance every time
it's needed. But that works, doesn't it? Oh, well, maybe you have to
mark it as setting the movie file 'every repeat' even if it's actually
constant. Actually, maybe for movie's that the only sensible option and
we shouldn't provide any choice.

Jon

Michael MacAskill

unread,
Jul 29, 2013, 6:13:59 AM7/29/13
to psychop...@googlegroups.com

On 29 Jul, 2013, at 22:03, Jonathan Peirce <jonatha...@nottingham.ac.uk> wrote:

> Yes, not using loadMovie() but creating a new movie instance every time it's needed. But that works, doesn't it? Oh, well, maybe you have to mark it as setting the movie file 'every repeat' even if it's actually constant. Actually, maybe for movie's that the only sensible option and we shouldn't provide any choice.

Ahh, I see, you're right.

For anyone Googling this again in the future: the secret for Builder to play a single movie multiple times in a loop is to specify the movie file to be "set every repeat" rather than "constant". Even though the movie file doesn't change, this setting causes it to be recreated from scratch on every trial.

Cheers,

Mike


Danielle Smith

unread,
Jul 29, 2013, 6:41:16 AM7/29/13
to psychop...@googlegroups.com
This worked perfectly, thank you!
Reply all
Reply to author
Forward
0 new messages