API can only be initiated by a user gesture event handler

API can only be initiated by a user gesture event handler

Hi,

I am trying to play an html5 audio in a vmousedown handler in chrome on Android, but it says "API can only be initiated by a user gesture  event handler". The issue is, obviously, that I am doing in an event handler and responding to a user gesture. The code is like below:

  1. <a id="btn1" data-role="button" data-inline="true" data-mini="true">Play</a>
  2. <audio class="audio" id="audio1"></audio>
  3. <script >
  4. $("btn1").on("vmousedown", function() {
  5. var a = $("audio1")[0];
  6. a.play();
  7. });
  8. </script>

Any idea?

Many thanks!