Hello. Audios files can't be played on safari. The player appears perfectly on firefox and explorer but not on safari. this is what i use

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

any help?

Dani AI

Generated

— the example in the first post shows the typical symptom: audio works in some browsers but not Safari. ’s pointer to Apple docs is useful background. The core issues to check are codec/container support and server headers rather than the HTML tag itself.

A short checklist and practical fixes:

  • Confirm the correct MIME type for MP3 is audio/mpeg (not audio/mp3) and that the server actually sends that Content-Type header. Inspect with a quick header check:
    curl -I https://example.com/path/song.mp3
  • Offer widely compatible sources first (MP3 or AAC/M4A for Safari). Example HTML pattern:
    <audio controls preload="metadata">
    <source src="/media/song.mp3" type="audio/mpeg">
    <source src="/media/song.m4a" type="audio/mp4">
    Your browser does not support the audio element.
    </audio>
  • Ensure the source files are distinct and correct (the original post used the same src twice by mistake). If the server is Apache/Nginx, map extensions to MIME types (AddType / types.conf).

Other common gotchas to rule out: CORS when serving media from another domain (set Access-Control-Allow-Origin), Safari autoplay/user-gesture restrictions on mobile, file-path/case-sensitivity errors, and corrupted/unsupported codecs inside a container. Use Safari’s Web Inspector Network/Console tabs to see HTTP status, Content-Type, and media errors.

Recommended workflow: re-encode master files to MP3 and M4A with ffmpeg if needed, verify headers with curl or DevTools, then test on an up-to-date Safari. For up-to-date compatibility details on containers and codecs, consult the browser support tables such as the MDN reference on supported media formats and the compatibility notes for Ogg support.

References: Supported media formats on MDN | Ogg support on Can I use

Recommended Answers

All 2 Replies

I haven't tried programming in Safari before (normally just Chrome and Firefox) but I did a little digging and this seems to explain how to do a bit of it.

Thanks man. For people who have the same problem. The solution is that you need to install Quicktime at least if you want to use the latest version of Safari. Other browsers work fine but if you want the <audio> or <video> element to work the user must have installed Quicktime

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.