Jump to content

Android Chrome: Click sound on every touch


erich.wanker

Recommended Posts

SOLUTION FOUND 

yes - a manually thing would work ;-)

function playAudio() {
  var a = new Audio('files/sound/click.mp3');
  a.play();
}

On the things what should click:  ClientEvent / extEvent : function click(sender, eOpts)  {   playAudio();  }

 

BUT FOR ANDROID:

..i found a solution  :-) for every "touch"

window.addEventListener('touchstart', function playAudio() {
  var a = new Audio('files/sound/click.mp3');
  a.play();
})

Link to comment
Share on other sites

QUESTION:

performance is bad ...

the "var a = new Audio.." is allways creat  a audio-element on every touch-event 

how can i make the click sound FASTER - it takes 0.5 seconds from touch to sound ..

 

a test with following lines makes it NOT better:

<script>

var a = document.createElement('audio');
a.src = 'files/sound/click.ogg';

window.addEventListener('touchstart', function playAudio() {
  a.play();
})

 

 

Link to comment
Share on other sites

  • 2 years later...

good morning mr. erich.wanker,

I have copied your code but I do not know where to place the instruction to reproduce the sound.

My need is to read bar codes compare it with the database, if there is to emit a sound of correct or incorrect which must be issued very fast,

try another method but it is layers to emit 10 times on the mobile, in windows there is no problem.

 It is possible that you give me an aid of what code and / or example I should use to get the sound to be reproduced.  

 

thank you for your collaboration

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...