How to record how many times a participant has replayed a mp4 video? | XM Community
Skip to main content
Solved

How to record how many times a participant has replayed a mp4 video?

  • November 1, 2021
  • 4 replies
  • 263 views

Hi! I've searched for custom code to get the information from replay video and I couldn't find an exact answer.
(I've tried both of these:
https://community.qualtrics.com/XMcommunity/discussion/2832/how-to-record-how-many-times-a-participant-has-replayed-a-video
https://stackoverflow.com/questions/48492796/javascript-to-track-how-many-times-an-audio-video-file-is-played-in-qualtrics)
I've embedded a mp4 video in my survey and I want to check how many times the participant has clicked play on the video. Is there a way to record how many times they hit play?
Thank you!

Best answer by grahulp5

var vid = document.getElementById("audi_player");
var i=0; 

vid.onplaying = function() {
  i=1;
var actual_click=i;
//console.log("played"+ i)
//alert("The video is now playing");
Qualtrics.SurveyEngine.setEmbeddedData('Q1_click',actual_click)


};

4 replies

grahulp5
QPN Level 3 ●●●
Forum|alt.badge.img+13
  • QPN Level 3 ●●●
  • 238 replies
  • November 9, 2021

Just set an embedded/ increment the value whenever the respondent clicks on play button.

example:
if(jQuery('#QID17 a').data('clicked', false))
{

errCnt+=1;
console.log(errCnt)


grahulp5
QPN Level 3 ●●●
Forum|alt.badge.img+13
  • QPN Level 3 ●●●
  • 238 replies
  • Answer
  • November 9, 2021

var vid = document.getElementById("audi_player");
var i=0; 

vid.onplaying = function() {
  i=1;
var actual_click=i;
//console.log("played"+ i)
//alert("The video is now playing");
Qualtrics.SurveyEngine.setEmbeddedData('Q1_click',actual_click)


};


  • Author
  • 1 reply
  • November 9, 2021

Thank you!


Forum|alt.badge.img+1
  • Level 1 ●
  • 6 replies
  • January 15, 2024

Do you put this code in the html or java?