AbortError: The play() request was interrupted by a call to pause (). https://goo.gl/LdLk22

URL of experiment: motion experiment Y [PsychoPy]
*** If you would like to try and replicate the error, please write in “test” for the participant box since I have already started data collection ***

Description of the problem: A couple of participants encountered the following error (screenshot attached). However, I am able to run their experimental conditions just fine (Conditions 1, 12), and other participants seem to be able to complete it as well. The routine is supposed to play a mp4 clip. Are there any OS or security preference issues to be aware of when running on Pavlovia?

Thanks in advance!

Screen Shot 2023-05-31 at 6.46.28 PM

Though I do not have a solution, I am experiencing the same error! It is very frustrating.

Description of the problem:
Hello everyone,

I am working on a PsychoJS experiment where I aim to play 16 videos with different starting points (jittered) or a single fixed jitter for all videos, depending on the condition. Here’s a summary of my setup:

  1. Jittered Condition (time = "jittered"):**
    I defined an array of jitter values: [0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2, 2.4, 2.5, 2.6, 2.8].
    I randomly sample 16 unique jitter values from this array for the current trial. The first jitter value is used for the target video, while the remaining 15 jitter values are assigned to the distractor videos.
    The file paths for the target and distractor videos are dynamically generated based on the selected jitter values. My video files with related jitters are available in my video files so I basicle changing the video paths in my trails excel with the jittered video paths.
  2. Fixed Condition (time = "fixed"):**
    I randomly select a single jitter value from the same array.
    The target and all distractor videos use this same jitter value for their file paths.

In the “Begin Routine” section , I define the video file paths dynamically using the jitter values.
The target video path is assigned to $target, and the distractor video paths are stored in an array as $distractor[0], $distractor[1], etc.
I have 16 movie stimuli (e.g., VID16_1, VID16_2, …) in my routine, and I assign their movie parameters using $target for the target video and $distractor[i] for the distractor videos. When I try to run this experiment on Pavlovia, I encounter an AbortError: The play() request was interrupted by a call to pause(). https://goo.gl/LdLk22 . The code works fine whe I try to run the experiment locally on Psychopy however due to 16 video stimuli I encounter a lagging problem therefore I used Pavlovia.

Here is the relevant JS code for defining the jittered and fixed conditions in the “Begin Routine” section:

function randomChoice(array) {
return array[Math.floor(Math.random() * array.length)];
}
function randomSample(array, numSamples) {
let shuffled = util.shuffle([…array]);
return shuffled.slice(0, numSamples);
}
jitter_values = [0, 0.2, 0.4, 0.6, 0.8, 1, 1.2, 1.4, 1.6, 1.8, 2, 2.2, 2.4, 2.5, 2.6, 2.8];
target_path = Target_video.split(“/”).slice(0, -1).join(“/”);
target_file = Target_video.split(“/”).slice(-1)[0];
distractor_path = Distractor_Video.split(“/”).slice(0, -1).join(“/”);
distractor_file = Distractor_Video.split(“/”).slice(-1)[0];

let target, distractor;
let fixed_jitter;

if (time === “jittered”) {
const selected_jitters = randomSample(jitter_values, 16);
const target_jitter = selected_jitters[0];
const distractor_jitters = selected_jitters.slice(1);
target = ${target_path}/final_${target_jitter}_${target_file};
distractor = distractor_jitters.map(jitter => ${distractor_path}/final_${jitter}_${distractor_file});
} else {
fixed_jitter = randomChoice(jitter_values);
target = ${target_path}/final_${fixed_jitter}_${target_file};
distractor = Array(15).fill(${distractor_path}/final_${fixed_jitter}_${distractor_file});
}
psychoJS.experiment.addData(“target”, target);
psychoJS.experiment.addData(“distractor”, distractor);

Has anyone encountered a similar issue with dynamically generated video paths in PsychoJS?

According to the link in the error message you might be asking a video to pause before it has started playing.

It takes longer to start a video playing online than locally. Do you have any code which might be interpreted as a pause call? Are your videos set to start at 0 seconds?

When I set the start time to 0 in the GUI or leave it blank, I still encounter the same error. Could the issue be that the experiment tries to play all the videos simultaneously, and this is being interpreted as a pause() call?

After the code I shared in the “Begin Routine” section, my movie stimuli components in the GUI are set up like this:

// VID16_1 updates
if (t >= 0.0 && VID16_1.status === PsychoJS.Status.NOT_STARTED) {
// keep track of start time/frame for later
VID16_1.tStart = t; // (not accounting for frame time here)
VID16_1.frameNStart = frameN; // exact frame index

VID16_1.setAutoDraw(true);
VID16_1.play();
}

Maybe the simultaneous display and playback of all videos is contributing to the error, but I’m not sure how to fix this.

Are you trying to play all 16 videos simultaneously (with 16 different start times)? If so, then aren’t you setting the start times to your jitter values. Maybe try adding a couple of seconds to all of the start times to give them some time to load – or try loading them in a prior static component (this may not work online).

The lag for videos is likely to be worse online than locally. For simultaneous videos you need them to be very small. Try with just two or three to get a proof of concept.

Actually, the videos I use in my experiment already have jittered starting points; they are pre-cut to start from different points. In the Begin Routine code, I randomly select video paths with these different starting points. Therefore, all videos are technically starting from the same point in time within the routine.

I also tried adding a couple of seconds to allow the videos to load before starting, but that didn’t resolve the issue either. When I run the experiment locally, playing all 16 videos simultaneously causes constant lagging.

I also tried adding jitter to the videos using PsychoPy’s seek function to reduce the number of video paths I had to handle, but that didn’t work online either.

Does it work (locally or online) with four videos?

How many Mb are the videos?

Videos are 222 KB. It works fine with four videos locally, however I get the same error with the four videos when I tried to run online.

Try setting all your online start times to 1 second.

Can you get 1 video working online?

I tried starting the videos at 1 second, but the lagging issue persisted. When I reduced the number of videos to 2, they played without lag; however, I still encountered the AbortError twice. It seems like the next step will be to test the experiment locally on a higher-performance computer to see if that resolves the issue.

In what format are your videos?

Are you using any custom code to play/affect the videos other than your code to select the file names?

They are H. 264 MP4. Inside this routine, I don’t have any other custom code to affect the play of the videos. Yesterday, I tried to run it locally on a high-functioning computer and it worked without lagging.