.m4v格式的标题视频无法在IE 11中播放 [英] Header video in .m4v format doesn't play in IE 11
问题描述
我有一个问题,即IE11无法播放我的html5视频标签视频.我尝试过使用其他浏览器,例如Chrome/Firefox,并且在这里可以正常使用. IE11甚至没有在控制台中给我一个错误,为什么它不播放视频并显示白色背景.我尝试了不同的格式,例如.m4v和mp4.该视频采用h264编码并经过网络优化(我正在使用名为"Handbrake"的软件对视频进行编码"),分辨率为1920x1088.我还尝试在网站的标题中添加".
I have a problem that IE11 isn't playing my html5 video tag video. I've tried other browsers like Chrome/Firefox and there it works perfectly fine. IE11 doesn't even give me an error in the console why it isn't playing the video and shows me white background. I tried different formats like .m4v and mp4. The video is in h264 encoding and web optimized(I'm using software named "Handbrake" to encode the video"), the resolution is 1920x1088. I also tried to put "" in my website head.
我的HTML代码
My HTML code
<video autoplay loop muted id="player">
</video>
<img id="backfill-image" src="<?php bloginfo('template_url'); ?>/img/backgroundimage.jpg">
</div>
我的JavaScript
My JavaScript
let myPlayer;
let backfill;
window.addEventListener('DOMContentLoaded', (event) => {
myPlayer = document.getElementById("player");
backfill = document.getElementById("backfill-image");
myPlayer.onerror = function() {
console.error(myPlayer.error);
showPlaceholderImage();
};
// Example invalid source to throw an error
myPlayer.src = ""+templateUrl+"/img/myvideo.m4v";
// Example valid source that doesn't throw an error
// myPlayer.src = "https://www.w3schools.com/tags/movie.mp4";
function showPlaceholderImage() {
myPlayer.style.display = "none";
backfill.style.display = "block";
}
});
推荐答案
我尝试使用MP4格式的H264编码器视频进行测试.
I tried to make a test with the MP4 format H264 encoder video.
在IE 11浏览器上看起来工作正常.
It looks like it is working fine on the IE 11 browser.
这是一个测试代码:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=Edge"/>
</head>
<body>
<video width="400" autoplay>
<source src="https://test-videos.co.uk/vids/bigbuckbunny/mp4/h264/1080/Big_Buck_Bunny_1080_10s_5MB.mp4" type="video/mp4">
Your browser does not support HTML video.
</video>
</body>
</html>
在这里,您可以看到我已经使用VLC播放器验证了视频具有H264编码器.
Here, you can see that I have verified that the video has an H264 encoder using a VLC player.
在IE 11浏览器中的输出:
Output in the IE 11 browser:
从本网站
这篇关于.m4v格式的标题视频无法在IE 11中播放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!