Test Question Play audio only once

Discussion created by plaverty on Mar 6, 2017

I would like to create a test question where there is an audio file in the question area. I only want students to be able to listen to the audio file once and I don't want them to be able to download the audio file. Any one have any idea how to code this? I have tried a couple of suggestions that I found on the web but they don't work. Listing one of the ones I tried below:

<div id="audioDiv">
<audio onclick="playedOnce()" src="sound.mp3" type="audio/mp3" preload="auto" controls="controls" oncontextmenu="return false;">Audio could not be loaded.</audio>

function playedOnce(){ 
var children = document.getElementById("audioDiv").getElementsByTagName('*');
   for(var i = 0; i < children.length; i++){ children[i].disabled = true; }