IE 中 Mediaelement.js javascript 错误
我正在使用 MediaElement.js 作为正在进行的网站的 HTML5 视频播放器。即使使用后备播放器,它在 Chrome、Safari 和 Firefox 中也能正常工作,但在 Internet Explorer 中,我收到此处显示的 Javascript 错误: http://d.pr/Jsfo。它似乎没有加载我的海报或我的播放器风格(在其他浏览器中工作正常)。
播放器的代码是动态加载的,因为它出现在灯箱中,并且页面上可以播放多个视频。注入 HTML 的 Javascript 位于页面底部。
I'm using MediaElement.js as my HTML5 video player for a site in progress. It works fine in Chrome, Safari, and Firefox, even with the fallback player, but in Internet Explorer I get the Javascript error seen here: http://d.pr/Jsfo. It doesn't seem to be loading my poster, or my player style (which works fine in the other browsers).
The player's code is being loaded dynamically, because it appears in a lightbox and there are multiple videos that can be played on the page. The Javascript that injects the HTML is at the bottom of the page
You can see the development site live at http://mindsmack.ryangiglio.com
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
不幸的是,您无法在 IE 中动态插入 HTML5 标记,因为它会破坏它们的嵌套
,
然后 MediaElement.js 无法找出源文件在哪里。
我的建议是将
标记放在页面上的永久位置,然后准备一个 MediaElement 对象
,然后当您准备好播放视频时,只需调用它
此外,您应删除
标记内的
Unfortunately, you can't dynamically insert HTML5 tags in IE because it breaks their nesting
becomes
And then MediaElement.js can't figure out where the source files are.
My recommendation would be to put a
<video>
tag in a permanent spot on the page, then prepare a MediaElement objectand then when you're ready to play a video, just call it
Also, you should remove the
<object>
embed HTML inside the<video>
tag since that's only for cases when IE users don't have JavaScript enabled, and your app requires JavaScript.