HTML5 vs. SWF

From Pin Eight
Revision as of 15:21, 10 April 2012 by Eighty5cacao (Talk | contribs)

Jump to: navigation, search

This is a mini-rant, a short essay refuting a common misconception among users of an Internet forum. If you think this essay is FUD, feel free to explain why on the essay's talk page.

A lot of people who post comments to Slashdot advocate abandoning SWF, the technology stack used by Adobe's Flash Player, in favor of HTML5, the technology stack used by Safari, Chrome, Opera, and Firefox.

Both have their pluses and minuses.

Contents

HTML5 advantages

Open specification
The license of the SWF specification banned third-party players until May 2008,[1] and one of the transport protocols wasn't published until June 2009.[2] Things have improved since then.[3] But HTML5 has been open from the start,[4] which allows for diversity and competition in implementations.
Royalty-free video codec
One video codec option available to HTML5 is Theora. This codec is based on the VP3 codec, whose patents are licensed royalty-free by On2, a Google company. All video codecs supported by SWF have patents without royalty-free licenses.
iPhone and iPad availability
Mobile Safari on iPhone and iPad can play HTML5, not SWF. Apple prefers HTML5 because Flash Player for Mac OS X is so unstable and CPU-inefficient and because of HTML's longer history of open specification.[5]

SWF advantages

Guaranteed codec
No disjoint video and audio codecs among players. Virtually all SWF players are Flash Player, and Flash Player has H.264, unlike HTML5 where some popular browsers have only Ogg video and audio (Theora and Vorbis) and others only MPEG video and audio (H.264 and AAC), due to the various browsers' different patent policies. Google's release of WebM in mid-2010 helped soften this, and Microsoft pledged to support third-party codecs such as WebM in Internet Explorer 9.
Authoring tools
As of 2010, the best-known timeline-based authoring tool for vector animation emits SWF. It could emit a JSON file for use by a JavaScript-based player that renders to an HTML5 canvas, and in fact Adobe has demonstrated this, but such a tool isn't public yet. Steve Fulton wrote an article about library features that Flash has and HTML5 Canvas lacks; development will be difficult until someone makes counterpart libraries in JavaScript.
Audio
It appears some HTML5 browsers do not support playing more than one <audio> element at once. Flash Player, on the other hand, lets a script play sound effects on top of the background music. Reportedly, even those that do allow multiple simultaneous <audio> don't support playing the same sound multiple times at once, such as two car engines using the same sample. Moreover, Flash supports procedural decompression and synthesis of audio on the client, unlike both HTML5 and XNA 3.
PC availability
A lot of PCs come with Flash Player preinstalled but no HTML5 player. Organizations' IT departments are likely to lock down installation of plug-ins. Google provides a browser helper object called Google Chrome Frame that adds HTML5 support to Internet Explorer versions 6 through 8 on sites that use the X-UA-Compatible HTTP header to opt in. But as long as far more sites use SWF than HTML5, IT departments are more likely to authorize the deployment of Flash Player than Chrome Frame. Among computers running mainstream desktop operating systems, Flash Player simply has far closer to 100 percent penetration than HTML5 browsers.
Script type system
Both ActionScript (SWF's script language) and JavaScript (HTML5's script language) are based on ECMAScript. But unlike JavaScript, ActionScript supports static typing of variables. Static typing lets the programmer specify which data types a variable can store. This allows the script compiler to make better assumptions about how variables will be used, leading to stronger optimizations. In addition, ActionScript has a class-based inheritance system, which is more familiar to programmers coming from C++, Java, or C# than JavaScript's Self-style prototype system.
Performance
On one PC running Windows XP and Firefox 3.6, a particle system written in HTML5 Canvas and Flash ran at 46 FPS in Flash and 19 FPS in Canvas. This relative lack of performance has remained the case even for Firefox 11.

The challenge

Here's a challenge for fans of HTML5 technologies: "Badgers" is a 36-second-long SWF vector animation that takes 436 KiB. HTML5 will be ready to replace Flash once it is as easy to make "Badgers" in HTML5 as it is to make "Badgers" in Flash without making the HTML5 download size more than 50% bigger than the SWF download size. (One example of "cheating" involves rendering each frame of the SWF and compressing the result as H.264 or WebM.) I recommend starting with Synfig or KToon.

References

External links

Personal tools