HTML5 vs. SWF

From Pin Eight
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, Firefox, and recent versions of Internet Explorer.

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. Another is VP8, a later codec by On2 whose quality at a given bitrate approaches that of H.264. All video codecs supported by SWF have patents without royalty-free licenses.
Mobile 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] Adobe at one time experimented with providing the Flash Player for Android but abandoned it in mid-2012.

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 desktop versions of Internet Explorer.
Authoring tools
Adobe publishes Flash, a timeline-based authoring tool for vector animation that emits SWF, and Edge Animate, a similar tool for HTML5. But unlike Flash, old versions of which can be found on the secondary market, Edge Animate is available only through the widely despised Creative Cloud rental model.
Audio
Some older HTML5 browsers may 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 older HTML5 browsers and XNA 3.
PC availability
A lot of PCs come with Flash Player preinstalled but no HTML5 player. Internet Explorer 8 is the latest version that will work on Windows XP, which no longer receives security updates since April 2014 yet remains in use on a few PCs especially among lower socioeconomic classes. And even on newer operating systems that are still supported, some organizations' IT departments lock their PCs at IE 8 in order to run intranet applications that don't work on newer IE. These combine to nearly 4 percent of usage share of IE 8 and earlier as of mid-2014.[1] These same IT departments are likely to lock down installation of plug-ins. Google used to provide a browser helper object called Google Chrome Frame that added HTML5 support to old versions of Internet Explorer on sites that use the X-UA-Compatible HTTP header to opt in, but Google discontinued it in mid-2013. Among computers running mainstream desktop operating systems, Flash Player simply had far closer to 100 percent penetration than HTML5 browsers in 2012.
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, a particle system written in HTML5 Canvas and Flash runs at 46 FPS in Flash and 19 FPS in Canvas.

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

  1. StatCounter GlobalStats usage table via caniuse.com Accessed 2014-06-23.

External links

Personal tools