jQuery("video").on('play', function() does not run when video is played | XM Community
Skip to main content
Solved

jQuery("video").on('play', function() does not run when video is played

  • July 9, 2021
  • 3 replies
  • 959 views

Hello,
I'm trying to get a timestamp when a participant starts watching a video. I'm using Vimeo to upload my videos and embed them in the survey. For some reason, the function jQuery("video").on('play', function()  does not run when the video is played. Maybe it is somehow related to using Vimeo?
I'm using the following code:
Qualtrics.SurveyEngine.addOnReady(function()
{
    var s='';
    alert(Date.now())
    jQuery("video").on('play', function() {
alert(Date.now())
      if(s==''){
      s= Date.now();
         Qualtrics.SurveyEngine.setEmbeddedData( 'Vid1PlayTime', s);
      }
    });
});

Best answer by ahmedA

The on play method works for HTML media elements. The vimeo api exposes other methods, read the docs.

3 replies

Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • Answer
  • July 9, 2021

The on play method works for HTML media elements. The vimeo api exposes other methods, read the docs.


  • Author
  • July 10, 2021

Thank you. Can you please post here a reference of these docs?


Forum|alt.badge.img+22
  • Level 7 ●●●●●●●
  • July 12, 2021