HTML5视频和音频无效 [英] HTML5 video and audio not working

查看:102
本文介绍了HTML5视频和音频无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Backstory

我刚花了整整一天的时间,试图找出为什么我的HTML5视频和音频标签在 IE11 IE10 ,当我将它们上传到一个特定的LMS(在其他所有浏览器中都可以正常工作)。我将它剥离,以便现在这就是HTML文件中的所有内容。 p>

 <!doctype html> 
< html>
< head>
< meta charset =UTF-8>
< title>无标题文档< / title>

< / head>
< body>
<视频控制>
< source src =video.mp4height =450pxwidth =800px/>
< / video>
< / body>
< / html>

非常简单,您可以看到,在IE11和IE10本地工作,并且文件绝对在LMS,因为我可以链接到他们。只有当他们使用HTML5视频标签时,才会出现任何内容 - 字面意思是白色屏幕。

问题:
当LMS加载内容时,一系列嵌套的帧,如下所示。 (请注意,我删除了所有内联属性{有堆})。

 < html> 
< head>< / head>
< frame>
< frame>
< frame>
//这是我的HTML生活的地方。

在头顶标签中,我无法改变,谎言这个坏男孩:< meta http-equiv =X-UA-Compatiblecontent =IE = 8> 。现在我可能不正确,但我认为这是问题的根源,因为ie8文档标准会否定任何HTML5标记...?

问题:
有什么方法可以用< meta http-equiv =X-UA-Compatiblecontent =IE = edge> 来覆写这个元标记吗?
或者随后,我可以重新配置文档标准/模式,不刷新页面(刷新自动关闭窗口{LMS / SCORM功能}) 。?或者我是否需要尝试让LMS Tech窥视他们的源代码?


更新:当我添加< meta http-equiv =X-UA兼容时,注意到以下内容content = IE = 8> DOM由原来的变为:

 < ;视频控制>< /视频> 
< source src =video.mp4height =450pxwidth =800px/>
< / video>< // video>


解决方案

真正的答案在于您真的应该联系LMS高科技人士。他们真的需要更新他们的代码,因为它真的过时了。

我使用< meta http-equiv =X -UA-Compatiblecontent =IE = 8> ,我遇到了视频加载的问题。 (我在IE 11中测试过)。据说,我也认为< frame> 标记也存在问题。



X-UA-Compatible 需要更新为 IE = edge < frame> 应该被移除。



不幸的是,我不知道重写 X-UA兼容标签。我相信(虽然不是100%肯定)IE会在父文档中看到 X-UA兼容标签并使用它。



如果您无法及时更新LMS技术人员的代码,您可以尝试几个选项。我不知道这些能否解决您的问题,但值得一试。 上传视频到YouTube或类似的视频托管服务并使用iFrame嵌入到视频中。 如果由于某种原因无法使用视频托管服务,请尝试将视频托管在您控制的服务器上, ,使用iFrame嵌入视频。 尝试使用 mediaelement。 js 作为解决兼容性问题的解决方法。


同样,真正的解决方案是让LMS更新他们的代码,否则,你必须找到一些可行的解决方法。

Backstory:
I have just spent an entire day trying to work out why my HTML5 video and audio tags haven't been working in IE11 and IE10 when I upload them to a particular LMS (Works perfectly in every other browser).
I stripped it right back so that now this is everything that is in the HTML file.

<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>

</head>
<body>
    <video controls>
        <source src="video.mp4" height="450px" width="800px"/>
    </video>
</body>
</html>

Very simple as you can see, works locally in IE11 and IE10, and the files are definitely on the LMS as I can link to them. It is only when they are in HTML5 video tags that nothing appears - literally a white screen.

The Issue:
When the content is loaded by the LMS, there are a series of nested frames, as seen below. (note that I removed all inline properties {there are heaps}).

<html>
<head></head>
<frame>
    <frame>
        <frame>
            // This is where my HTML lives.

In the top head tag, which I can't alter, lies this bad boy: <meta http-equiv="X-UA-Compatible" content="IE=8">. Now I may be incorrect, but I think this is the source of the issue, as ie8 document standard would be negating any HTML5 tags...?

The Question:
Is there any way to over-write this meta tag with <meta http-equiv="X-UA-Compatible" content="IE=edge"> ?
Or subsequently, can I reconfigure the document standards / mode, without refreshing the page (refreshing automatically closes the window {LMS/SCORM function}), either within my frame or above with javascript etc..? Or do I need to try and get the LMS Tech peeps to alter their source code?

Update:
Noticed the following when I add <meta http-equiv="X-UA-Compatible" content="IE=8"> The DOM changes from the original to:

<video controls></video>
    <source src="video.mp4" height="450px" width="800px"/>
</video><//video>

解决方案

The real answer here is you really should contact the LMS tech people. They really need to update their code as it is really outdated.

I ran a few test using the <meta http-equiv="X-UA-Compatible" content="IE=8"> and I ran into issues with the video loading. (I was testing in IE 11.) With that said, I also believe there are issues with the <frame> tag as well.

The X-UA-Compatible needs to be updated to IE=edge and the <frame> should be removed.

Unfortunately, I don't know of anyway to override the X-UA-Compatible tag. I believe, (though not 100% certain) that IE sees the X-UA-Compatible tag in the parent document and uses that.

If you cannot get the LMS tech people to update their code in a timely manner, you can try a few options. I do not know if these will solve your problems, but worth a try.

  • Upload the video to YouTube or similar video hosting service and embed to video using the iFrame.

  • If you cannot use a video hosting service for some reason, try hosting the video on a server you control and again, embed the video using an iFrame.

  • Try using mediaelement.js in the site as a workaround to solve compatibility issues.

Again, the real solution is to get LMS to update their code, otherwise, you have to find some workaround that works.

这篇关于HTML5视频和音频无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆