beg, borrow or steal: the art of flashing without flashing

29
Beg, Borrow or Steal The Art of Flashing without Flashing

Upload: spjwebster

Post on 18-Dec-2014

2.498 views

Category:

Technology


0 download

DESCRIPTION

HTML5 is awesome. Well, it will be awesome when it\'s finally ready. Probably. The bad news is that by the time the W3C have finished monkeying with HTML5, I\'ll probably have given up on the web as a whole and taken up meat goat farming. The good news (for you, me and the goats) is that there\'s no need to wait for a lot of the functionality that HTML5 promises; we can start using them right now. In this session I\'m going to show you how you can steal these features from the Flash Player and use them in your standards-based sites or applications, without even a sniff of Flash on the page.

TRANSCRIPT

Page 1: Beg, Borrow or Steal: The Art of Flashing Without Flashing

Beg, Borrow or StealThe Art of Flashing without Flashing

Page 2: Beg, Borrow or Steal: The Art of Flashing Without Flashing

Who am I?

Page 4: Beg, Borrow or Steal: The Art of Flashing Without Flashing

I am an author

Page 5: Beg, Borrow or Steal: The Art of Flashing Without Flashing

I am a Yahoo!

http://flickr.com/photos/niallkennedy/

Senior Front-End Engineer on the Front-End Architecture teamCatalyst for this talk - standards vs. Flash.

Page 6: Beg, Borrow or Steal: The Art of Flashing Without Flashing

I am an idiot

http://flickr.com/photos/thevoicewithin/

Page 7: Beg, Borrow or Steal: The Art of Flashing Without Flashing

I am misleading

Page 8: Beg, Borrow or Steal: The Art of Flashing Without Flashing

This session should have been...

Page 9: Beg, Borrow or Steal: The Art of Flashing Without Flashing

HTML5Features you want desperately

and can use TODAY!

Based on Ian Hickson’s Google presentation

Page 10: Beg, Borrow or Steal: The Art of Flashing Without Flashing

So what’s wrong with HTML5?

Page 11: Beg, Borrow or Steal: The Art of Flashing Without Flashing

http://flickr.com/photos/hassman/

Lots of nice features

Video and audio supportPush-technology (Web Sockets)Many other great features

Page 12: Beg, Borrow or Steal: The Art of Flashing Without Flashing

Not ready until 2022

2022 date taken from WHATWG roadmapSome HTML5 features supported in bleeding-edge nightly build browsersStill won’t be suitable for general use for a good few years

Page 13: Beg, Borrow or Steal: The Art of Flashing Without Flashing

But you don’t have to wait that long

Page 14: Beg, Borrow or Steal: The Art of Flashing Without Flashing

You can borrow features from the Flash Player

Page 15: Beg, Borrow or Steal: The Art of Flashing Without Flashing

How does thisall work?

Page 16: Beg, Borrow or Steal: The Art of Flashing Without Flashing

How does this work?

HTML

HTML lives in browser-landLimited in functionality by the browser’s capabilities

Page 17: Beg, Borrow or Steal: The Art of Flashing Without Flashing

How does this work?

SWF HTML

SWF playing in Flash Player has access to advanced featuresHow can we get the two to communicate?

Page 18: Beg, Borrow or Steal: The Art of Flashing Without Flashing

How does this work?

JavaScript

SWF HTML

JavaScript is can interact with HTML/DOM

Page 19: Beg, Borrow or Steal: The Art of Flashing Without Flashing

How does this work?

Text

JavaScript

SWF HTML

We need to find something to communicate between JS and SWF

Page 20: Beg, Borrow or Steal: The Art of Flashing Without Flashing

How does this work?

Text

ExternalInterface

classJavaScript

SWF HTML

The ExternalInterface class provides a Flash-to-JS bridgeAvailable since Flash Player 8

Page 21: Beg, Borrow or Steal: The Art of Flashing Without Flashing

How does this work?

ExternalInterface

classJavaScript

SWF

InvisibleFlash

HTML

Now the Flash content doesn’t even have to be visible on the page.Show ’01 ExternalInterface’ demo

Page 22: Beg, Borrow or Steal: The Art of Flashing Without Flashing

Great, so what can we do with it?

Page 23: Beg, Borrow or Steal: The Art of Flashing Without Flashing

Video playback

In HTML5 this is implemented by the <video> elementYouTube etc. have been using Flash for video for yearsUse out-of-the-box solution like JW FLV Media Player

Page 24: Beg, Borrow or Steal: The Art of Flashing Without Flashing

Audio playback

In HTML5 this is implemented by the <audio> elementLatest WebKit nightly also has Audio JS class for pure JS audioScott Schiller’s SoundManager library uses Flash to play JS-controlled audio

Page 25: Beg, Borrow or Steal: The Art of Flashing Without Flashing

Multiple file upload

Part of Web Forms, but missing in HTML5 specFlash-based solutions include SWFUpload and YUI UploaderFlash Player 10 introduces clickjacking security restriction that means file browse dialog can only be invoked by a click on the Flash movie itself (not through ExternalInterface)YUI Uploader allows creation of transparent overlay on links to get around thisUsed on the current Flickr Web Upload page

Page 26: Beg, Borrow or Steal: The Art of Flashing Without Flashing

Cross-frame communication

HTML5 introduces window.postMessage method and ‘message’ eventFlash allows LocalConnection objects to communicateUsing LocalConnections in conjunction with ExternalInterface allows HTML5-like functionality NOWShow ’05 Cross Frame Comms’ example and code

Page 27: Beg, Borrow or Steal: The Art of Flashing Without Flashing

Offline storage

HTML5 introduces localStorage object and methodsDifferent to cookies - not sent to/from the serverFlash has has Local Shared Object for client-side data storage, so it’s easy to build emulation layerShow ’06 Offline Storage’ example and code

Page 28: Beg, Borrow or Steal: The Art of Flashing Without Flashing

Socket-based communication

Client side, comet is a mess of browser hacks - a virtual house of cardsHTML5 introduces Web Sockets for bidirectional communicationFlash has both XML and raw (byte-based) socket supportShow ’07 Sockets’ example and code

Page 29: Beg, Borrow or Steal: The Art of Flashing Without Flashing

Thank you!http://dynamicflash.com/my-talks#head08