Hello,
I am designing a study wherein participants are asked to watch a video and press the spacebar every time the people in the video show “bad behaviour”.
I’ve found some code to do this:
let question = this;
/* hide next button */
question.hideNextButton();
/* when the video end, click on next button */
jQuery($('videoPlayer')).on("ended", function() { setTimeout(function () {jQuery('#NextButton').click();},1000); });
document.onkeydown = function(event) {
if (event.which == 32) {
let pressCurnetTime = $('videoPlayer').currentTime /* the time when the subject pressed space */
event.preventDefault();
}
}
My question is this: how do I make the time an array and record each time the spacebar is pressed?
Following this, how would I convert the array to a string variable and save it to an embedded data variable?
Thank you for your help