How to play an audio object instance in Safari?

Asked

Viewed 28 times

0

How do I play an audio instance in Safari?

var som = new Audio("http://www.sousound.com/music/healing/healing_01.mp3");

function tocar() {
   this.play();
}
som.addEventListener('canplay', tocar, false);

See that in this example it does not work on Safari.

  • In this reply, https://stackoverflow.com/a/31777081/4312593, you comment on the possibility of disabling automatic playback.

  • Put text between tags <audio ...>Não suportado</audio>... If text is displayed, the tag is not compatible with the browser. Then there is nothing you can do, except another way to incorporate sound in this browser.

  • Your jsFiddle works for me on Safari...

  • Yes, it works, but it takes time to load.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.