Merge pull request #464 from andrewheusser/video-stop-event-handler

added event handler to video plugin to end trial when a stop time is specified
This commit is contained in:
Josh de Leeuw 2017-08-25 16:20:04 -04:00 committed by GitHub
commit 1885be8e36

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() {