简体   繁体   中英

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

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/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM