Saving the time of clicks during a video | XM Community
Skip to main content
Hey (:

I uploaded a video from Qulatrics libary.

The subject need to press space when he recognize a dangerous situation (while watching the video).

I want to save the time of all the presses.

The subject can press many times and I need to save each time

how can i do that?

and how can I get access to saved data ?



this is my code:

Qualtrics.SurveyEngine.addOnReady(function()

{



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 pressCuurnetTime = $('videoPlayer').currentTime /* the time when the subject pressed space */

event.preventDefault();



}

}



});
Make 'pressCuurnetTime' an array and push the time onto it each time space is pressed.



Add an addOnPageSubmit function to convert the array to a comma separated string and save it to an embedded data variable.
Thank you! (:

Leave a Reply