| Title Page | 1 |
|---|
| Copyright Page | 2 |
|---|
| Contents at a Glance | 4 |
|---|
| Table of Contents | 5 |
|---|
| Foreword | 13 |
|---|
| About the Authors | 14 |
|---|
| About the Technical Reviewer | 15 |
|---|
| Acknowledgements | 16 |
|---|
| Introduction | 17 |
|---|
| Who This Book Is For | 17 |
| An Overview of This Book | 18 |
| Example Code and Companion Web Site | 18 |
| Contacting the Authors | 18 |
| Chapter 1 Overview of HTML5 | 19 |
|---|
| The Story So Far The History of HTML5 | 19 |
| The Myth of 2022 and Why It Doesn t Matter | 20 |
| Who Is Developing HTML5? | 21 |
| A New Vision | 21 |
| Compatibility and Paving the Cow Paths | 21 |
| Utility and the Priority of Constituencies | 22 |
| Secure by Design | 22 |
| Separation of Presentation and Content | 22 |
| Interoperability Simplification | 23 |
| Universal Access | 23 |
| A Plugin Free Paradigm | 23 |
| What s In and What s Out? | 24 |
| What s New in HTML5? | 26 |
| New DOCTYPE and Character Set | 26 |
| New and Deprecated Elements | 27 |
| Semantic Markup | 28 |
| Simplifying Selection Using the Selectors API | 35 |
| JavaScript Logging and Debugging | 38 |
| window.JSON | 39 |
| DOM Level 3 | 40 |
| Monkeys, Squirrelfish, and Other Speedy Oddities | 40 |
| Summary | 41 |
| Chapter 2 Using the HTML5 Canvas API | 42 |
|---|
| Overview of HTML5 Canvas | 42 |
| History | 42 |
| What Is a Canvas? | 43 |
| Canvas Coordinates | 43 |
| When Not to Use Canvas | 44 |
| Fallback Content | 44 |
| CSS and Canvas | 45 |
| Browser Support for HTML5 Canvas | 45 |
| Using the HTML5 Canvas APIs | 46 |
| Checking for Browser Support | 46 |
| Adding a Canvas to a Page | 47 |
| Applying Transformations to Drawings | 49 |
| Working with Paths | 52 |
| Working with Stroke Styles | 55 |
| Working with Fill Styles | 56 |
| Filling Rectangular Content | 57 |
| Drawing Curves | 59 |
| Inserting Images into a Canvas | 61 |
| Using Gradients | 62 |
| Using Background Patterns | 64 |
| Scaling Canvas Objects | 66 |
| Using Canvas Transforms | 69 |
| Using Canvas Text | 70 |
| Applying Shadows | 72 |
| Working with Pixel Data | 74 |
| Implementing Canvas Security | 75 |
| Building an Application with HTML5 Canvas | 76 |
| Practical Extra: Full Page Glass Pane | 80 |
| Summary | 80 |
| Chapter 3 Working with HTML5 Audio and Video | 81 |
|---|
| Overview of HTML5 Audio and Video | 81 |
| Video Containers | 81 |
| Audio and Video Codecs | 83 |
| The Codec Wars and the Tentative Truce | 83 |
| Audio and Video Restrictions | 84 |
| Browser Support for HTML5 Audio and Video | 84 |
| Using the HTML5 Audio and Video APIs | 85 |
| Checking for Browser Support | 86 |
| Understanding Media Elements | 87 |
| The Basics: Declaring Your Media Element | 87 |
| Using the Source | 88 |
| Taking Control | 90 |
| Working with Audio | 92 |
| Audio Activation | 92 |
| Working with Video | 93 |
| Creating a Video Timeline Browser | 94 |
| Adding the Video and the Canvas Element | 94 |
| Adding Variables | 95 |
| Adding the updateFrame Function | 96 |
| Adding the startVideo Function | 97 |
| Handling User Input | 98 |
| Adding the stopTimeline Function | 99 |
| Practical Extras | 100 |
| Background Noise in a Page | 100 |
| Mouseover Video Playback | 101 |
| Summary | 102 |
| Chapter 4 Using the HTML5 Geolocation AP
|