Open anasophiarc opened 4 months ago
One way of doing it would be to not set trial_duration
at all, but to listen to the ended
event of the video element yourself and end the trial manually then. Here is my way of doing it:
const impossible_key = 'impossible-key';
let trial = {
type: jsPsychVideoKeyboardResponse,
stimulus: ['./video.mp4'],
choices: [impossible_key],
on_load: function () {
document.querySelector('video').addEventListener('ended', function () {
jsPsych.pluginAPI.keyDown(impossible_key);
jsPsych.pluginAPI.keyUp(impossible_key);
});
}
};
I have not used the jsPsych finishTrial
method because that would mean a lot of extra work. Instead, I set the choices
to a key that nobody could possible press as the key is non-existent. Then, I just have to manually dispatch the key down and key up events when video reaches its end.
Hi, I am having an issue as I want to use an html response to display a video as well as some text without giving the participant an option to respond (ie. I just want them to watch the video). The issue is that not all of the videos that could possibly be displayed in the trial variable are exactly the same length and so when I set the trial_duration parameter to one fixed value certain clips get cut off/ there is a lot of screen hitching. Does anyone have an idea on a way I can improve upon this/reduce the stutters? Thanks
Here is a snippet of the stimulus function plus some of the other parameters I am currently using:
return