Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Safari cannot play HTML5 audio over https?

I'm try to play voice in safari using HTML5 Audio. But it not work over https, http is fine.

var audio = new Audio();
audio.src = "https://example.com/xxxx.wav";
audio.play();

Is impossible to play audio over https? If not use html5 audio, is there any other alternative solution to play voice over https under safari?

Thanks

like image 272
Jeffrey Hsu Avatar asked Oct 21 '11 09:10

Jeffrey Hsu


1 Answers

As far as I have found out this is Webkit bug and thus happens also in iPhone and Android mobiles. We serve all audio over standard cross domain site over http and they work fine, even when DOM itself is retrieved over https.

It might work in some versions of Safari over https if you load the audio from same host as DOM though. See here: http://areweplayingyet.org/

like image 125
Teemu Ikonen Avatar answered Sep 21 '22 15:09

Teemu Ikonen