Recording time | XM Community
Skip to main content

Recording time

  • December 3, 2021
  • 2 replies
  • 120 views

Forum|alt.badge.img

Good afternoon,
I have an audio file loaded into one of my questions. I am running a Stop-Signal measure. I have instructed the participants to press the spacebar when they would like to stop the audiotape (the audiotape does not actually need to stop, I just need to know when they would stop it). Therefore, I need to record 1) the time someone presses play and 2) record the time from the play button press until they press the space bar. I have set this javascript on both the question and a timing block:

Qualtrics.SurveyEngine.addOnReady(function() {
var start = new Date();

function getTime(e)
  { e = e || window.event;
    var key = e.which || e.keyCode;
    if(key===32){
      var t = new Date() - start;

      Qualtrics.SurveyEngine.setEmbeddedData( 'embeddedsolutiontime', t)
      alert(t);
      document.removeEventListener('keydown', getTime);
      window.top.document.removeEventListener('keydown', getTime); 


               }

      }

document.addEventListener("keydown", getTime);
window.top.document.addEventListener('keydown', getTime); 


});

However, I can only get the first click (play button) and last click (arrow button for next page), I'm not getting the results for the spacebar.
I also think that if I can't get this type of recording, I could try to have the audio play automatically once they click onto that page, therefore the spacebar would be the first click, which Qualtrics timer settings do easily. How would I get the audio to play automatically instead of having to click the play button?
Screen Shot 2021-12-02 at 10.17.50 PM.pngAny help with either of these two would be greatly appreciated!

2 replies

KarlaEDU
Qualtrics Employee
Forum|alt.badge.img
  • Qualtrics Employee
  • December 7, 2021

Forum|alt.badge.img
  • Author
  • December 8, 2021

Hi Karla! I think your mother-in-law gave me this page as well on a fb group I'm in. (She speaks wonders of you, btw!) I think this is what I need, unfortunately, I have no idea how to implement it. This reads like a foreign language to me. Any help is greatly appreciated!