Saving the time of clicks during a video | XM Community
Skip to main content
Solved

Saving the time of clicks during a video

  • December 26, 2019
  • 2 replies
  • 28 views

Forum|alt.badge.img+6
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(); } } });

Best answer by TomG

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.

2 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • December 26, 2019
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.

Forum|alt.badge.img+6
  • Author
  • Level 1 ●
  • December 30, 2019
Thank you! (: