Disabling pause and all the visual information of an embeded youtube video. | XM Community
Skip to main content

Hello everyone
I am currently building an experiment in which im using embed youtube videos (videos i created then uploaded).
Thanks to the forum i found how to put the video in full screen and automaticaly play it. I also use "timed question" to prevent the respondends to rewatch the video.
However im having trouble for finding the correct code (html and Java) for disabling pause and deleting video recommendation/name etc. I know the question has already been asked, still im stuck...
If any of you could help that would be wonderful
Here are my codes :
Html

Java
image.png
What should i add
Thanks again 🙂

Unfortunately I'm not sure how to handle the pause button in full screen.
But I do have a tip for advancing the question. Instead of using a timer, I would ask YT if the video has finished playing. That way in case there is a pause the video doesn't end to soon.
var qobj = this // qobj is now the qualtrics question
var element = document.getElementById("iframe1") // this is your player


function onPlayerStateChange(event) { // This function is called by the
 // event listener
// You can do more with this with other event codes
 // source for info: https://developers.google.com/youtube/iframe_api_reference?csw=1#Getting_Started
// (ctrl + f for onStateChange)
if (event.data == 0) { finished(); } // 0 means the video ended
}
function finished() {
//alert("finished") // Uncomment this to check if the finished fx is
// being called
qobj.clickNextButton(); // goes to next question after video end
}

// this will "listen" for the element to give a onStateChange event and then
// run the onPlayerStateChange fx
element.addEventListener("onStateChange",onPlayerStateChange);

Hope this helps!


Leave a Reply