mirror of
https://github.com/jspsych/jsPsych.git
synced 2025-05-10 19:20:55 +00:00
fix trial_ends_after_video when video stop time is set - fixes #1533
This commit is contained in:
parent
ae332b3347
commit
7b16a1d39a
@ -229,11 +229,16 @@ jsPsych.plugins["video-button-response"] = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
var stopped = false;
|
||||
if(trial.stop !== null){
|
||||
video_element.addEventListener('timeupdate', function(e){
|
||||
var currenttime = video_element.currentTime;
|
||||
if(currenttime >= trial.stop){
|
||||
video_element.pause();
|
||||
if (trial.trial_ends_after_video && !(stopped)) {
|
||||
stopped = true; // this is to prevent end_trial from being called twice, because the timeupdate event can fire in quick succession
|
||||
end_trial();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -196,11 +196,16 @@ jsPsych.plugins["video-keyboard-response"] = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
var stopped = false;
|
||||
if(trial.stop !== null){
|
||||
video_element.addEventListener('timeupdate', function(e){
|
||||
var currenttime = video_element.currentTime;
|
||||
if(currenttime >= trial.stop){
|
||||
video_element.pause();
|
||||
if (trial.trial_ends_after_video && !(stopped)) {
|
||||
stopped = true; // this is to prevent end_trial from being called twice, because the timeupdate event can fire in quick succession
|
||||
end_trial();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -267,11 +267,16 @@ jsPsych.plugins["video-slider-response"] = (function() {
|
||||
}
|
||||
}
|
||||
|
||||
var stopped = false;
|
||||
if(trial.stop !== null){
|
||||
video_element.addEventListener('timeupdate', function(e){
|
||||
var currenttime = video_element.currentTime;
|
||||
if(currenttime >= trial.stop){
|
||||
video_element.pause();
|
||||
if (trial.trial_ends_after_video && !(stopped)) {
|
||||
stopped = true; // this is to prevent end_trial from being called twice, because the timeupdate event can fire in quick succession
|
||||
end_trial();
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user