Html HTML5 如何“取代”Flash?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2172626/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can HTML5 "replace" Flash?
提问by Mike Willekes
A topic of debate that's seen a resurgence since the unveiling of the iPad is the issue of Flash versus HTML5. There are those that suggest that HTML5 will one day supplant/replace Adobe Flash.
自从 iPad 面世以来,一个重新兴起的争论话题是 Flash 与 HTML5 的问题。有些人认为 HTML5 有一天会取代/取代 Adobe Flash。
I do not develop software that runs in a browser,so my (limited) understanding is:
我不开发在浏览器中运行的软件,所以我的(有限的)理解是:
- HTML is a pure-text markup language that is delivered over HTTP to a client browser. The client browser interprets the markup and renders (with varying degrees of success) the page according to an standard specification.
- Adobe Flash is a propriety framework for working with audio, video, sound and raster/vector graphics. It requires special authoring tools (a compiler perhaps?) and a custom player that's available as a plug-in to most common browsers.
- HTML 是一种纯文本标记语言,通过 HTTP 传送到客户端浏览器。客户端浏览器根据标准规范解释标记并呈现(具有不同程度的成功)页面。
- Adobe Flash 是用于处理音频、视频、声音和光栅/矢量图形的专有框架。它需要特殊的创作工具(也许是编译器?)和一个自定义播放器,可作为大多数常见浏览器的插件使用。
Could someone please explain (to this C/C++ developer) how it is possible from a technical/coding point-of-viewthat a text-based markup language (HTML5) could be considered a replacement to a multimedia framework (Flash)?
有人可以(向这个 C/C++ 开发人员)解释一下,从技术/编码的角度来看,基于文本的标记语言(HTML5)如何被视为多媒体框架(Flash)的替代品?
Please no opinionated arguments - just technical facts.
请不要有固执的论点 - 只是技术事实。
采纳答案by Yuji
What people loosely refer to HTML5 in the context of this discussion is the combination of HTML as a markup language, CSS which specifies how it is rendered, and the javascript code which manipulates the HTML and CSS dynamically.
在本次讨论的上下文中,人们松散地提到 HTML5 是将 HTML 作为标记语言、指定其呈现方式的 CSS 以及动态操作 HTML 和 CSS 的 javascript 代码的组合。
Furthermore, HTML5 not only has the standard text elements, but also <canvas>
on which 2d graphics can be drawn, and <video>
elements which embeds the video (as the name suggests).
此外,HTML5 不仅有标准的文本元素,还有可以<canvas>
在其上绘制 2d 图形的<video>
元素,以及嵌入视频的元素(顾名思义)。
So, in a full-fledged implementation of HTML5, you can implement dynamic web sites without using Flash. An example is the HTML5 version of Youtube, recently introduced as beta for Safari/Chrome users, see here. Another is an NES emulatorin javascript + HTML. (Well the latter does not really concern HTML5... it uses <canvas>
.)
因此,在 HTML5 的成熟实现中,您可以在不使用 Flash 的情况下实现动态网站。一个例子是 Youtube 的 HTML5 版本,它最近作为 Safari/Chrome 用户的测试版推出,请参见此处。另一个是javascript + HTML 中的NES 模拟器。(好吧,后者并不真正关心 HTML5……它使用<canvas>
.)
回答by Dresden2
When Steve J. made the comments about HTML5 being the future, he didn't bother to explain that this statement really refers to the most widespread use of Flash today, that being Video. Perhaps he didn't explain this purposely, so that many misinformed end users who want to watch Hulu on their iPhones would unleash their rage against Flash. Which is exactly what has been happening..It is annoying and I lost respect for Steve.
当 Steve J. 发表关于 HTML5 是未来的评论时,他并没有费心解释这个声明实际上是指当今最广泛使用的 Flash,即视频。或许他并没有刻意解释这一点,让许多想在 iPhone 上观看 Hulu 的最终用户误入歧途,从而对 Flash 大发雷霆。这正是正在发生的事情......这很烦人,我失去了对史蒂夫的尊重。
The HTML5 stack (html, css and JS) will NOT be a direct replacement for Flash. I have been developing Flash content for over 10 years, I am also very competent in JS. I cringe thinking about using JS for tasks where ActionScript can accomplish the same thing in 50% less code. There are tasks that will be very difficult if not impossible to achieve with JS and CSS. For rudimentary animations and JQuery-like functionality, sure, HTML5 can be a viable option instead Flash. But for complex games and RIAs, I just don't see it. Actionscript has evolved into a robust, full featured language.
HTML5 堆栈(html、css 和 JS)不会直接替代 Flash。我已经开发Flash内容超过10年了,我在JS方面也很能干。想到将 JS 用于 ActionScript 可以用少 50% 的代码完成相同任务的任务时,我感到畏缩。使用 JS 和 CSS 完成一些任务,即使不是不可能,也将是非常困难的。对于基本的动画和类似 JQuery 的功能,当然,HTML5 可以是一个可行的选择,而不是 Flash。但是对于复杂的游戏和 RIA,我只是看不到它。Actionscript 已经发展成为一种强大的、功能齐全的语言。
The other important thing is that the Flash player is updated by Adobe periodically to address any issues that may arise. How will they update/improve HTML5 spec if it becomes the norm and Flash went bye-bye?? They won't. You have to wait for HTML6 and all the browsers to support it. Which means you end up waiting 5-10 years. Great way to bring us back to 1998. No thanks, I'll stick with Flash for now.
另一件重要的事情是 Adobe 会定期更新 Flash 播放器,以解决可能出现的任何问题。如果 HTML5 规范成为常态而 Flash 再见了,他们将如何更新/改进 HTML5 规范?他们不会。你必须等待 HTML6 和所有浏览器支持它。这意味着您最终要等待 5-10 年。让我们回到 1998 年的好方法。不,谢谢,我现在会坚持使用 Flash。
As much as open standards are a worthy goal, I don't see this panning out the way they are saying...
尽管开放标准是一个有价值的目标,但我认为这并不像他们所说的那样......
My two cents.
我的两分钱。
回答by Katryna
I think some people here are programming snobs and aren't listening. I, too, am a beginning Flash developer and I don't want it to go away. You know why? Because CREATIVE people can use Flash to develop what's in our brains very easily. A person who likes to draw and create scenes does not necessarily like to code. Typing a bunch of "sentences" is NOT drawing and animating! What you're saying about HTML5 is like saying that Picasso and Dali should have learned a programming language in order to paint. Ridiculous, right?
我认为这里有些人是编程势利眼,不听。我也是 Flash 的初级开发人员,我不希望它消失。你知道为什么?因为 CREATIVE 的人可以使用 Flash 非常轻松地开发我们大脑中的内容。喜欢画画和创造场景的人不一定喜欢编码。输入一堆“句子”不是绘图和动画!你说的 HTML5 就像是说毕加索和达利为了绘画应该学习一门编程语言。可笑,对吧?
That's why people prefer Flash to HTML5. It's not self-serving, it's just acknowledging that the people capable of creating cool animated web content would rather be able to create our own visions rather than learn an unrelated skill or rely on someone else to interpret for us.
这就是为什么人们更喜欢 Flash 而不是 HTML5。这不是自私自利,它只是承认有能力创建酷炫动画网络内容的人宁愿能够创建我们自己的愿景,而不是学习无关的技能或依赖其他人为我们解释。
Instead of ridiculing, you might want to come up with an HTML5 visual environment that rivals Flash.
与其嘲笑,不如想出一个与 Flash 相媲美的 HTML5 视觉环境。
回答by Nickolay
how it is possible from a technical/coding point-of-view that a text-based markup language (HTML5) could be considered a replacement to a multimedia framework (Flash)?
从技术/编码的角度来看,基于文本的标记语言 (HTML5) 怎么可能被视为多媒体框架 (Flash) 的替代品?
HTML5 is the new hot name for "web technologies stack", not just a "markup language".
HTML5 是“网络技术堆栈”的新热门名称,而不仅仅是“标记语言”。
It has a programming language (JavaScript), like Flash does; a set of APIs, significantly expanding as part of the efforts commonly labeled as "HTML5", ways to draw graphics (SVG, <canvas>), play audio and video (<audio>, <video>).
它有一种编程语言 (JavaScript),就像 Flash 一样;一组 API,作为通常标记为“HTML5”的工作的一部分,显着扩展,绘制图形的方法(SVG,<canvas>),播放音频和视频(<audio>,<video>)。
Unlike Flash, the "HTML5 applications" are processed by the browser, not by a proprietary browser plugin, which is good - at least for browser vendors (see the relevant piece of this blog post- thanks Jotham). For example, it makes possible for a browser vendor to fix issues (and not wait for Adobe) -- IIRC Apple cited Flash as being #1 reason for crashes among all crashes on the Mac.
与 Flash 不同,“HTML5 应用程序”由浏览器处理,而不是由专有浏览器插件处理,这很好 - 至少对浏览器供应商而言(请参阅本博客文章的相关部分- 感谢 Jotham)。例如,浏览器供应商可以修复问题(而不是等待 Adobe)——IIRC Apple 将 Flash 列为 Mac 上所有崩溃的第一大原因。
[edited to remove "open standards are better" claims which I am too lazy to back up]
[编辑以删除我懒得备份的“开放标准更好”的说法]
回答by Doug Neiner
It is not simply HTML5, but when browser adoption of it is complete. For instance, the presence of the HTML5 <video>
tag means nothing without a browser provided video player to actually present the video (At which point, the hope is, Flash Video will no longer be needed). Same goes for the <audio>
tag.
它不仅仅是 HTML5,而是当浏览器完全采用它时。例如,如果<video>
没有浏览器提供的视频播放器来实际呈现视频,HTML5标签的存在就没有任何意义(此时,希望不再需要 Flash 视频)。这同样适用于<audio>
标签。
Additionally, HTML5's canvas element (combined with JS) allows for far more advanced graphics inside a browser than could be achieved before.
此外,HTML5 的画布元素(与 JS 结合)允许在浏览器中实现比以前更高级的图形。
回答by none
Well, to get an impression of the capabilities of HTML5/canvas + JavaScript, you may want to take a look at thiswhich is an implementation of Wolfenstein 3Dpurely done in HTML5, without using any Flash (note that you need a canvas-enabled browser such as Firefox to see this working).
好了,拿到的HTML5 /月+ JavaScript的能力的印象,你可能想看看这是一个实现德军总部3D在HTML5纯粹进行的,没有使用任何Flash(请注意,需要启用帆布Firefox 等浏览器以查看此工作)。
回答by VoidPointer
It is not so much that HTML5 can replace Flash by matching it feature by feature. It is more that the HTML5 stack (including JavaScript and CSS) can be used to build the same sort of rich web applications for which Flash was the only viable option before. Because HTML holds the promise to also address some of the shortcoming of the Flash platform, there is a potential that it can replace Flash in this space in the future.
HTML5 可以通过逐个功能匹配 Flash 来取代 Flash。更重要的是,HTML5 堆栈(包括 JavaScript 和 CSS)可用于构建相同类型的富 Web 应用程序,而 Flash 以前是唯一可行的选择。因为 HTML 承诺还可以解决 Flash 平台的一些缺点,所以它有可能在未来在这个领域取代 Flash。
This discussion is very much centered around the technology that is used to render the application at the users end. It does not address the ease with which authors are actually able to create the content which will be delivered to their users. You already mentioned that Flash is associated with a set of commercial tools which are specifically built and marketed by Adobe to address the need of rich-content authors. Such solutions for HTML5 are not that much adopted yet. For developers who view authoring mostly as coding this is not a big concern and they will not have a hard time getting traction with HTML5 (and many already do). For those authors that don't have a developer/coding background, this may be another story and for them the viability of HTML5 will greatly depend upon the availability of integrated authoring tools. Maybe the Adobe Flash tools will output to HTML5 instead of SWF in a few years...
此讨论主要围绕用于在用户端呈现应用程序的技术展开。它没有解决作者实际上能够创建将交付给其用户的内容的难易程度。您已经提到 Flash 与一组商业工具相关联,这些工具由 Adobe 专门构建和销售,以满足丰富内容作者的需求。此类针对 HTML5 的解决方案还没有被广泛采用。对于主要将创作视为编码的开发人员来说,这不是一个大问题,他们不会很难获得 HTML5 的吸引力(而且很多人已经这样做了)。对于那些没有开发人员/编码背景的作者来说,这可能是另一回事,对他们来说,HTML5 的可行性将在很大程度上取决于集成创作工具的可用性。
回答by Shinto
What these silly non-creative people haven't realized is that HTML5/Javascript/CSS is very bloated to begin with. All of that asset is still entirely RAW text file. no compression no bytecode optimization and it will always be like that. So for game developers that is not an option having all your source in easy reach of theft. Flash allows you to compile your source code in a more compact means while still be able to create your dynamic content in a tight vector graphics manner. Ontop of that flash already supports shaders, hardware acceleration, pixel filters (Pixel bender) and Layer effects. Till this day you can't get html elements to drop a shadow with ease and simplicity. HTML5 will merely try to replace flash as a media player but since Flash's popularity is due to its consistency it will be a hard sell. MY hatred of CSS and Javascript can be surmised by the fact that 40% of javascript code is for browser compatibility and CSS implimentation is NEVER consistent on different browser vendors. Till you nerds get around this problem Flash will never be replaced. Fact is for whatever you can do in HTML5 we can do in flash faster and better.
这些愚蠢的没有创造力的人没有意识到 HTML5/Javascript/CSS 一开始就非常臃肿。所有这些资产仍然完全是 RAW 文本文件。没有压缩没有字节码优化,它永远都是这样。因此,对于游戏开发者来说,让您的所有来源易于被盗是不可能的。Flash 允许您以更紧凑的方式编译源代码,同时仍然能够以紧密的矢量图形方式创建动态内容。在该闪存之上已经支持着色器、硬件加速、像素过滤器(像素弯曲器)和图层效果。直到今天,您还无法让 html 元素轻松简单地投下阴影。HTML5 将仅仅尝试取代 Flash 作为媒体播放器,但由于 Flash 的流行是由于其一致性,因此很难销售。我对 CSS 和 Javascript 的憎恨可以通过以下事实来推测:40% 的 javascript 代码是为了浏览器兼容性,而 CSS implimentation 在不同的浏览器供应商上从来没有一致。除非你这些书呆子解决这个问题,否则 Flash 永远不会被取代。事实是,您在 HTML5 中可以做的任何事情,我们都可以在 Flash 中更快更好地完成。
I've already seen the Wolfenstein 3D in Canvas. Its inferior. and tiny. We can make a better 3D engine with a larger window. Beat that?
我已经在 Canvas 中看到了德军总部 3D。它的劣等。和微小的。我们可以用更大的窗口制作更好的 3D 引擎。打败那个?
回答by Damo
I hope we're talking about How can HTML5 replace swf and flv. Not Flash entirely. I'm a Flash developer (amature). For me, someone who is more artistic minded rather than script programming minded, Flash is fairly easy (most of the time) to use. How do I make a cartoon character walk across the screen in HTML5? Or something simple like morphing (tweening) a circle into a square? Surely I don't have write that as code. I simply am not that clever in the are of programming to achieve that. Flash is relativley simple. Draw all your graphics in what ever app you're comfy with (illustrator for me) then stitch them together with action script. I love you both Apple and Adobe. Please come up with some sort of compromise.
我希望我们谈论的是 HTML5 如何替代 swf 和 flv。不完全是 Flash。我是一名 Flash 开发人员(业余)。对我来说,一个更具有艺术头脑而不是脚本编程头脑的人,Flash 相当容易(大部分时间)使用。如何让卡通人物在 HTML5 中穿过屏幕?或者像将圆形变形(补间)成正方形这样简单的事情?当然我没有把它写成代码。我在编程方面并不那么聪明来实现这一目标。Flash 相对简单。在你喜欢的任何应用程序中绘制所有图形(对我来说是插画师),然后用动作脚本将它们拼接在一起。我爱你苹果和 Adobe。请拿出某种妥协。
回答by Satish
There's much more to Flash than Audio/Video. Recently Flex has been very popular because of it's rich programming model and ability to develop high performance user interfaces.
Flash 不仅仅是音频/视频。最近 Flex 非常流行,因为它具有丰富的编程模型和开发高性能用户界面的能力。
if HTML 5 or anything has to become popular, first of all the in-built JavaScript engine has to be more efficient. Flex/Flash these days are popular because of robust ActionScript engine.
如果 HTML 5 或任何东西必须变得流行,首先内置的 JavaScript 引擎必须更加高效。由于强大的 ActionScript 引擎,Flex/Flash 现在很流行。