Audio item does not work with Safari

I cannot get the audio element to work correctly in Safari (v 5.1.2). I tried to move the file to the same folder as on the page, using both MIMM types mp3 and mpeg, and change the file names. It works fine in all other browsers, but an audio element is created in Safari, but it only shows that it is loading and not playing. Any ideas?

<audio controls preload="metadata"> <source src="audio/song.mp3" type="audio/mpeg" /> <source src="audio/song.ogg" type="audio/ogg" /> </audio> 

thanks

+6
source share
4 answers

Does your site use the wrong HTTPS certificate or HTTP out? I had this problem, but it turned out that Safari had problems with my invalid HTTPS or Basic Auth certificate (on an intermediate server).

+8
source

Safari doesn't seem to load sounds reliably with preload="metadata" .

You can try this on the console, on any web page:

 var snd = document.createElement('audio'), src = document.createElement('source'); src.src = "http://www.largesound.com/ashborytour/sound/brobob.mp3"; src.type = "audio/mpeg"; snd.appendChild(src); snd.preload = 'metadata'; snd.play(); 

This does not work. Then:

 snd.preload = null; // equivalent to 'auto' 

And voila! He starts to play.

(I filed this as rdar: // problem / 11481585, and not something that helps any of us.)

+2
source

Try setting the apple boot time. I don't know about desktop versions, but iOS versions use quicktime to play safari sound.

0
source

yes, an invalid HTTPS certificate or HTTP out does not work on safari (verified on a configured safari browser on a low-level Linux device). For it to work, use a valid https certificate.

0
source

Source: https://habr.com/ru/post/904815/


All Articles