Merge pull request #590 from r-b-g-b/master

Option to set video playback rate
This commit is contained in:
Josh de Leeuw 2019-01-24 14:39:27 -05:00 committed by GitHub
commit d6f7002497
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 0 deletions

View File

@ -16,6 +16,7 @@ autoplay | boolean | true | If true, the video will begin playing as soon as it
controls | boolean | false | If true, controls for the video player will be available to the subject. They will be able to pause the video or move the playback to any point in the video.
start | numeric | null | If given a value, the video will start at this time point in seconds.
stop| numeric | null | If given a value, the video will stop at this time point in seconds.
rate | numeric | null | The playback rate of the video. 1 is normal, <1 is slower, >1 is faster.
## Data Generated

View File

@ -65,6 +65,12 @@ jsPsych.plugins.video = (function() {
pretty_name: 'Stop',
default: null,
description: 'Time to stop the clip.'
},
rate: {
type: jsPsych.plugins.parameterType.FLOAT,
pretty_name: 'Rate',
default: null,
description: 'The playback rate of the video. 1 is normal, <1 is slower, >1 is faster.'
}
}
}
@ -133,6 +139,10 @@ jsPsych.plugins.video = (function() {
display_element.querySelector('#jspsych-video-player').currentTime = trial.start;
}
if(trial.rate !== null){
display_element.querySelector('#jspsych-video-player').playbackRate = trial.rate;
}
// function to end trial when it is time
var end_trial = function() {