How can i disable pause button on embedded YouTube video | XM Community
Question

How can i disable pause button on embedded YouTube video

  • 19 December 2019
  • 1 reply
  • 329 views

Hi,

I have an embedded YouTube video in my survey. I want to make sure that the participants watch the video for the entire duration and don't hit the pause button. I tried to play with iframe but was not able to hide the play/pause control. Is there any way to do it?

1 reply

Userlevel 4
Badge +4
Last time I tried to do that, I could not find a way to modify the controls of an embedded youtube video (there was a youtube policy, if I remember correctly). I implemented a workaround where participants were just not able to click on the video at all. This was achieved by inserting a div element in front of the video iframe and disabling any clicks on the div element. The below code should work:

<div style="height=200px;width=300px;pointer-events:none;">

<iframe height="200" src="YOUR VIDEO SOURCE HERE style="border:none;" width="300"></iframe></div>

Note that the width and the height of the iframe and the div are the same.

Hope that helps!

Leave a Reply