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:
- 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.
- 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?