Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iOS Browsers not respecting HTML5 audio preload tag

Has anyone else noticed that Safari (and even Chrome) for iOS attempt to preload all audio tags even if you use the preload="none":

<audio src="test.mp3" preload="none"></audio>

Desktop browsers appear to work correctly, but as soon as I load the page from the iPhone the Apache server registers a request for the file.

like image 346
Tom Rossi Avatar asked May 08 '14 20:05

Tom Rossi


People also ask

What browser that support audio element?

So Firefox 3.5 and Opera are your best bet.

Does HTML5 support audio tag?

HTML5 <audio> Tag. Since the release of HTML5, audios can be added to webpages using the “audio” tag.

How do I preload audio in HTML?

We use preload=”auto” attribute to preload the audio file. The HTML Audio Preload Attribute is used to specify how the author thinks the audio should be loaded when the page loads. The audio preload attribute allows the author to indicate to the browser how the user experience of a website should be implemented.

Is audio tag deprecated?

The <bgsound> HTML element is deprecated. It sets up a sound file to play in the background while the page is used; use <audio> instead. Warning: Do not use this!


1 Answers

According to Apple Docs, Mobile Safari never loads music file or metadata until user touch is detected. This is to make sure a webpage doesn't request a lot of music or data to be downloaded on mobile devices which might take up a lot of mobile data. So preload tag is essentially always set to "none" in mobile Safari regardless of what your code has. Here's the link to the docs where they explain everything.

Quote straight from the docs "Note: The preload attribute is supported in Safari 5.0 and later. Safari on iOS never preloads."

like image 180
Manu Sodhi Avatar answered Sep 28 '22 04:09

Manu Sodhi