I have a jQuery statement where I call a created file to be played. The thing is that it is correctly played in the pc but when I try to execute it in the mobile phone I can hear nothing and the volume is at maximum.
<script>
$(document).ready(function(){
var audioElement = document.createElement('audio');
audioElement.setAttribute('src', './static/audio/welcome.mp3');
audioElement.play();
})
</script>
I am playing it on Safari and if I embed the code into a button it works when I press it but is there anyway I can play it when the DOM is loaded?
Could you tell me what browser did you try it please? here is an old post where the guy had the same problem :