求助:MP4格式背景视频在IE11无法显示,主流浏览器正常
Alright, let's figure out why your background MP4 isn't playing in IE11—this is a super common compatibility headache, and I’ve got a few proven fixes for you:
First, check your video’s encoding (most likely culprit)
IE11 has super strict rules for MP4 playback: it only supports H.264 Baseline Profile (Level 3.0 or lower) paired with AAC-LC audio. If your video uses a higher profile (like High) or non-compliant audio codecs, IE11 will just ignore it.
Use a tool like FFmpeg to re-encode your video to be IE11-friendly. Here’s a copy-paste command to do that:ffmpeg -i your-original-video.mp4 -c:v libx264 -profile:v baseline -level 3.0 -c:a aac -b:a 128k ie11-compatible-video.mp4Tweak your HTML video tag for IE11 quirks
IE11 handles autoplay, muted, and loop attributes differently than Chrome/Firefox. Make your video tag look like this to avoid issues:<video autoplay muted loop poster="your-fallback-image.jpg"> <source src="ie11-compatible-video.mp4" type="video/mp4"> <!-- Fallback image if IE11 still won't play the video --> <img src="your-fallback-image.jpg" alt="Background content" /> </video>A critical note: IE11 blocks autoplay for any video that isn’t muted, so the
mutedattribute is non-negotiable for background videos that auto-play. Skip theplaysinlineattribute too—IE11 doesn’t support it, and it can cause weird glitches.Verify your server’s Content-Type header
Make sure your server sends the correctContent-Type: video/mp4header when serving the MP4 file. If it’s set to something likeapplication/octet-stream, IE11 won’t recognize it as a valid video. You can check this using IE11’s F12 DevTools: go to the Network tab, find your video request, and look at the response headers.Last resort: Flash fallback (use sparingly)
If you absolutely have to support IE11 and the above fixes don’t work, you can add a Flash fallback. But keep in mind Flash is deprecated and insecure—most users have it disabled, so this should only be a final option.
内容的提问来源于stack exchange,提问作者RichardMiracles

