Prompt
My video embed looks broken in Safari. How do I fix it?
Latest observation
Safari video embeds usually break for one of a few reasons: unsupported format/codec, autoplay restrictions, CSS/layout issues, or an iframe/player compatibility problem. Here’s a practical checklist to fix it.
1) Make sure the video format is Safari-friendly
Safari is picky about codecs.
Best supported web video:
- MP4 with H.264 video + AAC audio
- WebM support is limited compared to Chrome/Firefox
- HEVC/H.265 may work on newer Safari versions, but isn’t the safest default
If you’re embedding a self-hosted video, encode it like this:
- Container:
.mp4 - Video codec:
h264 - Audio codec:
aac
Example ffmpeg conversion:
ffmpeg -i input.mov -c:v libx264 -c:a aac -movflags +faststart output.mp4
2) Use the HTML5 <video> element correctly
If it’s your own video embed, try this pattern:
<video controls playsinline preload="metadata" width="100%">
<source src="video.mp4" type="video/mp4">
Your browser does not support the video tag.
</video>
Important attributes:
controls— shows player controlsplaysinline— helps on iPhone/iPad Safaripreload="metadata"— safer for loading behaviormuted— required if you want autoplay
If you want autoplay:
<video autoplay muted playsinline loop>
<source src="video.mp4" type="video/mp4">
</video>
Safari generally blocks autoplay unless muted.
3) Check the server’s MIME type
Safari may refuse to play the video if the server sends the wrong content type.
For MP4, the response should usually be:
Content-Type: video/mp4
Also ensure:
- Range requests are supported
- The file is accessible over HTTPS if your page is HTTPS
- The server isn’t forcing downloads instead of streaming
4) Fix common CSS/layout issues
Sometimes the video is “broken” because it’s invisible or stretched oddly.
Try:
video, iframe {
max-width: 100%;
height: auto;
display: block;
}
If it’s inside a container, ensure the container has a size:
.video-wrap {
width: 100%;
aspect-ratio: 16 / 9;
}
.video-wrap video,
.video-wrap iframe {
width: 100%;
height: 100%;
}
5) If it’s an iframe embed, check Safari compatibility
For YouTube/Vimeo/other embeds:
- Use the provider’s recommended embed URL
- Ensure the iframe has proper permissions
Example:
<iframe
src="https://www.youtube.com/embed/VIDEO_ID"
title="Video player"
allow="autoplay; encrypted-media; picture-in-picture"
allowfullscreen>
</iframe>
Notes:
- Missing
allow="autoplay"can break autoplay - Some browsers require
allowfullscreen - Third-party cookies/tracking settings can interfere with some players
6) Disable autoplay assumptions
Safari is strict about autoplay and audio. If the embed relies on autoplay with sound, it may fail.
Use:
mutedplaysinline- user interaction to start playback
7) Check for CORS or cross-origin issues
If the video is hosted on another domain:
- Make sure the host allows access
- Check CORS headers if you’re doing anything beyond plain playback
- Some players need special headers or signed URLs
8) Test in Safari’s developer tools
Open Safari DevTools and look for:
- Console errors
- Network errors
- Media playback errors
- MIME type mismatches
- 404/403 on the video file
If the video URL is blocked, expired, or redirecting oddly, Safari may fail while other browsers seem fine.
9) Try a minimal test case
This helps isolate whether the issue is the video file, CSS, or embed code:
<!doctype html>
<html>
<body>
<video controls width="640">
<source src="https://example.com/video.mp4" type="video/mp4">
</video>
</body>
</html>
If this works, the problem is likely with your surrounding page/player code.
Most common fix
If I had to guess the most common Safari issue, it’s this:
- Convert to MP4 (H.264 + AAC)
- Add
playsinline - Add
mutedfor autoplay - Make sure the server sends
video/mp4
If you want, paste your embed code here and I can point out the exact Safari problem.