Pausing and Resuming Movie Component

Hi,

I am trying to create an experiment where participants watch a video lecture. At random points during the video lecture, participants will be provided with a prompt (slider component) that they need to respond to.

When these prompts appear I would like to pause the video lecture (movie component) and remove it from the screen. Once participants have responded to the prompt I would then like the lecture to reappear and resume from the point that it was paused.

I have been able to pause and resume the video using the pause() and play() methods. However, I am having difficulty in figuring out how to do this whilst also removing/showing the video lecture.

Initially, I tried creating separate routines. The first routine played the video lecture up until the point at which the first probe appeared and then moved to the probe screen (see code below).

if (t == probeTime) {
// pause the video
segment1.pause();

// move to the probe screen
continueRoutine = false;

}

After the probe routine I then created another routine in the hope that I would be able to resume the video in this new routine. However, when I use segment1.play() in this new routine it just starts the video from the beginning. I am assuming this is because the progress of the video is not saved/shared across routines.

I am just wondering if anyone is able to offer some insight/s into how best to approach this issue. Apologies for the lengthy post.

Hi there,

Yes, I don’t think we’ve exposed functions to keep track of the same movie object across routines. I think it would be hard to do cleanly and know when we should then delete the movie or reset it. As in, making it work for you would likely create new issues for other users that do expect movies to start from the beginning.

If the only part you still need is to prevent the movie frame from being rendered you should be able to do one of:

  • set the autodraw attribute of the movie to False to prevent drawing and then set to True when you want drawing to continue
  • set the opacity of the movie to 0 when you don’t want it to be seen
  • simply obscure the movie with a rectangle or other image in front of it (Components render in the order they appear on the Routine, so you can obscure the movie by having a rectangle after it in the routine view)

Alternatively, to control a movie across Routines, you’ll need to use your own movie-loading/playing code instead of the Movie Component I think.

Best wishes,
Jon

I’ve just tried this in a demo and it works both locally and online.

I started off with a component with a static period so that in the trial that start the movie it can be set during the ISI instead of every repeat or constant. This isn’t necessary, but it helps with video and audio syncing if the movie starts at 0 seconds.

In the movie component I unticked “Stop with Routine?”.

In the next routine I put movie.pause() in the Begin Routine tab of a code component.

In the routine after that I put movie.play() and movie.setAutoDraw(True) in Begin Routine and then movie.setAutoDraw(False) and movie.stop() in End Routine.

Hi,

Thank you for the response. I took your advice and used the autodraw attribute to show and hide the movie component.