added event handler to end trial when a stop time is specified

This commit is contained in:
andrewheusser 2017-08-25 15:32:38 -04:00
parent 8f4b42fa8c
commit 13b4f88786

View File

@ -115,6 +115,16 @@ jsPsych.plugins.video = (function() {
end_trial();
}
// event handler to set timeout to end trial if video is stopped
display_element.querySelector('#jspsych-video-player').onplay = function(){
if(trial.stop != false){
if(trial.start == false){
trial.start = 0;
}
jsPsych.pluginAPI.setTimeout(end_trial, (trial.stop-trial.start)*1000);
}
}
// function to end trial when it is time
var end_trial = function() {