How can I disable the play/pause button on an embedded audio clip? | XM Community
Skip to main content
My project involves participants listening to short audio clips and then making decisions based on what they have just heard. It is important that they do not hear these clips multiple times; is there any way to disable the audio controls so that there isn't even the possibility of this happening? The audio already autoplays.



If disabling the buttons isn't an option, is there a way to hide the audio bar altogether?
Hello @kjkendro ,



Use the following code to hide the audio controls. The following code play the audio but the audio controls will not be visible.



`<embed src="source url" width="180" height="90" loop="false" autostart="true" hidden="true" />`
@kjkendro ,

Add below code to disable the mouse events & keyboard events:



//mouse disable

jQuery("ADD HERE CLASS NAME OF AUDIO").css({

"cursor": "wait",

"pointer-events": "none"

});



//keyboard disable

function disable()

{

document.onkeydown = function (e)

{

return false;

}

}

function enable()

{

document.onkeydown = function (e)

{

return true;

}

}

Hi,
I'm trying to do something similar except with embedded videos from google drive. I would also like my video to autoplay while having all of the controls disabled. I have tried to use codes from other forums but the autoplay function never seems to work; my video just keeps buffering forever without actually playing. Could it be because I'm using a google drive video instead of a youtube video?
My original code to embed the video without including any autoplay or invisible divs looks like this:

If anyone could help me out with this, that would be absolutely amazing. I'm very new to coding and have been trying to figure this out for days.


Leave a Reply