How do I insert sounds into a hybrid application?

-1

Good evening, I'm a beginner in programming and I'm developing a hybrid application. I need to play a specific sound by tapping an image on the screen ... I'm using the bootstrap to layout the application. Any suggestions?

    
asked by anonymous 29.06.2018 / 22:30

1 answer

1

Good afternoon, yes, it is possible using the HTML audio tag. You must specify a url, or the path of the file to be played. You can hide the player using display: none. As for playback, you can use a Javascript function in your img tag, where, when clicking on the image, a trigger is triggered to play the audio. Here's the audio tag example:

 <audio src="caminho_do_arquivo.mp3" style="display: none;" id="id_audio"> 
 </audio>

Together with the js function:

 <img class="card-img-top" src="caminho_da_imagem.png" 
  onclick="$('#id_audio').trigger('play');">
    
29.06.2018 / 22:32