Html5 视频和 Flash 方法
研究 HTML5 视频标签,并研究哪些浏览器支持哪些视频文件类型,我最初的想法是事情变得比仅使用 Flash 更困难。
我想知道是否有一些骨架代码(与视频的开发方法相结合)可以执行以下操作:
- 如果 flash 可用,请使用它
- 如果没有,请尝试 html5 视频 ogg 格式
- 如果这不起作用,请尝试html5 视频 h.264 格式
- 如果这不起作用,请尝试 html5 视频 webM 格式
根据我所看到的,我现在的想法是否正确,为了适应所有浏览器上的所有用户,视频需要发布在4种格式?如果是这样,那么这个 HTML5 视频就是一个史诗般的失败!
不管怎样,任何想法、过程、图书馆链接等都值得赞赏。
谢谢 -
Looking into HTML5 video tag, and researching which browsers support which video file types, and my initial thought is things just got harder than just using flash.
I am wondering if there is some skeleton code (combined with development approach for videos) that someone has figured out to do the following:
- If flash is available, use it
- If not, try html5 video ogg format
- If that doesn't work, try html5 video h.264 format
- If that doesn't work, try html5 video webM format
Based on what I am seeing, am I correct in thinking that now, in order to accommodate all users on all browsers, a video needs to be published in 4 formats? If so, this HTML5 video thing is an epic fail!
Anyway, any ideas, processes, links to libraries, etc are appreciated.
Thanks -
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这并不难。您可以为单个
标记提供多个源(多种格式)。
另外,更好的选择是首先搜索原生 html5 视频,然后回退到 Flash。
您需要的两个格式是 WebM(免版税,受替代浏览器 Mozilla、Opera、Chrome 等支持)和用于大型浏览器(IE 和 Safari)的 H.264。您的后备选项(闪存)也可以播放 H.264。
如果您还没有阅读过本指南,我建议您阅读一下。
编辑:
如果您正在寻找最常见的恶魔,那么它肯定是暗示的 H.264 over HTTP。 Flash 可以在没有媒体服务器的情况下播放它,而且它是 iOS 支持的唯一格式,因此暂时只使用一种格式就可以了。
但即使使用这种单一格式,您也可以在两个工厂团队(Safari 和 IE)上支持基于 HTML5 的播放。我知道视频标签有点新,但它们建立在操作系统的坚实基础上。即使在这种情况下,它们也是比 Flash 更好的选择。
所以真正的困境毕竟是替代浏览器。您可以使用两种格式而不是一种(加入 WebM),或者仅使用 H.264 并在非 h264 浏览器上使用 Flash。
这是个人喜好的问题(以及双重存储的成本)。但如今存储通常是免费的,无论如何带宽才是真正的成本因素。
It's not that hard. You can give multiple sources (in multiple formats) for a single
<video>
tag.Also the better choice is to search for native html5 video first, then fallback to flash.
The two fromats you need are WebM (royaltiy free, supported by alternative briwsers Mozilla, Opera, Chrome and others) and H.264 for the big ones (IE and Safari). Your fallback option (flash) is also able to play H.264.
I suggest reading this guide if you haven't already.
Edit:
If you're looking for the lowest common demoninator then it's surely hinted H.264 over HTTP. Flash can play it without a media server and it's the only format iOS supports anyway, so you are OK for one single format for the time being.
But even with this single format you can support HTML5-bsed playback on the two factory teams (Safari and IE). I know the video tag is kinda new but they build on solid foundations in the OS's. Even at this state they are a better option than Flash.
So the real dilemma after all is ith the alternative browsers. You can use two formats instead of one (to throw in WebM) or you only stay with H.264 and use Flash on non-h264 browsers.
This is rather a question of personal preference (and the cost of double storage). But storage is generally free these days, bandwidth is the real cost factor anyway.
您看到JWPlayer了吗?它可能会节省你一些时间。
Did you see the JWPlayer? It might save you some time.