Authors: John Brosnan, Kyle Copeland
ISBN-13: 9780470054277, ISBN-10: 0470054271
Format: Paperback
Publisher: Wiley, John & Sons, Incorporated
Date Published: February 2007
Edition: (Non-applicable)
John Brosnan co-wrote the TiVo HME Developer Challenge grand-prize winning application, AudioFaucet. He has been involved in HME applications for other companies and brings a strong background in Java. John has been a Java programmer for the past five years, primarily in the telecom industry, writing web enterprise applications.
Kyle Copeland co-wrote the TiVo HME Developer Challenge grand-prize winning application, AudioFaucet, and has been involved in the ongoing development for AudioFaucet. Working in the cable industry for the past ten years developing products for consumers nationwide has given Kyle great insight into the customer experience, and a rich background in developing products and services for consumers.
Book Synopsis
Now you can extend the world's most popular DVR by utilizing the TiVo Home Media Engine SDK. With the Java-based HME you can build new and exciting applications for broadband-connected Series 2 devices, and inside you will find numerous real-world examples that will help you deploy your own applications to TiVo quickly and easily.
Java developers John Brosnan and Kyle Copeland walk you through the design and architecture of TiVo applications and provide a clear path to implementation. They begin by describing software development for the TiVo platform, covering the basic building blocks of application design and how to respond to events. Next you'll find out how to create more advanced applications using TiVo's component library. You'll then discover how to polish your final product and package it for others to integrate into their TiVo experience.
What you will learn from this book
- Techniques for configuring your development environment
- How the TiVo HME SDK functions
- Methods for displaying images & text
- How to play audio files and streams
- Ways to optimize the behavior of your application
- How to include animations in your application
- Best practices for packaging your application for deployment
- How to manage the application lifecycle
Who this book is for
Readers with Java experience who want to build interactive applications for TiVo Series 2 DVRs.
Wrox Beginning guides are crafted to make learning programming languages and technologies easier than you think, providing a structured, tutorial format that will guide you through all the techniques involved.
Table of Contents
Acknowledgments ix
Introduction xxi
Introduction to TiVo Applications 1
The TiVo Platform 1
Brief History of Software Development for TiVo 2
Home Media Option and TiVo Desktop 3
TiVo Desktop as a Server 4
HMO Protocol 6
HMO Applications 7
TiVo Server-Hosted Applications 7
Desktop Applications 7
Home Media Engine 8
Software Development Kit 10
How HME Interacts with TiVo 11
What HME Is and Isn't 11
Summary 12
Questions 12
Getting the Tivo Box Ready for HME 13
TiVo Requirements for HME 13
Supported TiVo Boxes 13
Series1 Standalone 14
Series2 Standalone 15
DirectTV Integrated TIVo (DirectTiVo) 15
Series3 16
Active TiVo Service Subscription 17
Checking the Version of TiVo Software 17
Forcing a Connection to the TiVo Service 18
The Household Network 19
Wired vs. Wireless 20
NetworkAdapters 20
Wired Adapters 20
Wireless Adapters 21
Adding TiVo Boxes to a Household Network 21
Setting up Wired Access 21
Setting up Wireless Access 22
TCP/IP Settings 22
Music, Photos, & More 23
Summary 24
Questions 25
Your Development Environment 27
Required Software 27
Java SDK 28
Windows 28
Mac OS X 29
Linux and Unix 29
Text Editor 30
Getting the TiVo HME SDK 30
Exploring the SDK 30
Classpath 31
Recommended Software 32
Ant 32
Log4j 33
JDIC 33
JUnit 33
Subversion 33
Setting up Eclipse 33
Installation 34
Running Eclipse 34
Starting a New Project 35
Running the Sample Applications 39
Starting the Applications 40
Using the Sample Applications in Eclipse 41
The HME Simulator 44
Limitations of the Simulator 46
Summary 46
Questions 46
Your First TiVo HME Application 47
Hello World 47
Creating Hello World 47
Running the Example in the Simulator 50
Simulator in Discovery Mode 50
Simulator in Direct Mode 52
Starting Hello World on the TiVo Box 53
Handling Events 56
Application Lifecycle 57
Startup 57
Running Events 57
Errors 58
Shutdown 58
Summary 58
Questions 59
Displaying Resources 61
Understanding Views 61
Introduction to Views 61
View Hierarchy 61
Drawing Order and Hiding Views 63
Properties of Views 64
Translation 64
Scaling 65
Visibility, Transparency, and Focus 66
Extending Views 67
Code Example 69
Text 72
Creating Text Resources 72
Image Resources 80
Supported Graphic Formats 80
Creating Image Resources 80
Size, Scaling, and Alignment 87
Updating the Weather Application with Graphics 89
Sounds 92
Creating Sound Resources 92
Built-in Sounds 93
Summary 93
Questions 94
Events 95
Types of Events 95
Device Info 96
Init Info 97
Application Info 97
Idle Info 97
Key Event 98
Font Info 98
Event Flow 98
Key Events 98
Optional Keys 100
Events Example 101
Sending Custom Events 105
Ticker Events 106
Focus Events 112
Application Event Handling 114
Summary 115
Questions 116
Going Bananas 117
How to include Bananas in Your Application 117
Reasons to Use Bananas 119
Bananas Sample Application 119
BApplication 122
Other Features of BApplication 124
BScreen 125
New Methods in BScreen 126
Pushing and Popping BScreens 127
Transitions 129
Creating Custom Transitions 130
BView 134
BList 136
Using BLists 138
Styling the List 138
Managing the List 139
BList Example 139
BList Methods 142
Focus 144
BText 146
BButton 147
Using BButtons 147
BKeyboard 149
Using the Keyboard Widget 151
BSkin 154
BDirSkin 155
BZipSkin 155
BResSkin 155
Example 155
Summary 157
Questions 158
Using Bananas Events 159
Event Model 159
New Events in Bananas 161
Using Actions 164
Custom Actions 164
Custom Widgets 166
Weather Applicatton Example 170
Summary 178
Questions 178
Advanced Resources 179
Streaming Resources 179
Streaming Graphics 179
Streaming Audio 180
MPEG Video Backgrounds 181
Creating MPEG Video Backgrounds 182
Using TiVo's MKLOOP FFMPEG Wrapper 182
Using a Web-Based MKLOOP FFMPEG Wrapper 183
Setting MPEG Video Backgrounds 183
MPEG Video Background Caveats 184
Simulator 184
Not Pixel Perfect 187
Root View Method Behavior 190
System Reboots 191
Resource Management 191
Caching and Removing Resources 191
Debugging the Resource Tree 192
Resource Limitations 193
Pixel Buffer and Rendering Engine 194
Best Practices for Predictable Rendering 195
Debugging Software Rendering 196
CPU Resource Concerns 197
Network Resource Constraints 198
Summary 198
Questions 199
Advanced HME Application Lifecycle 201
HME SDK Architecture Impact 201
Overriding the Factory 202
Accessing Files and Resources 205
Changing the Application Name 206
Handling Arguments 207
Common Actions 208
Using Factory for Shared Data 208
Singletons 210
Threads 211
Using Threads 212
Java 4 Threads 212
Java 5 Executor 212
Stopping Threads Correctly on Application Exit 214
Keeping Shared Threads Running between Applications 215
Calling Other Applications 215
Transitioning to Another Application 215
Running the Example 217
Transitioning Back to the Original Application 220
Summary 220
Questions 220
Application Preferences 223
Per-TiVo Preferences 223
Using Per-TiVo Preferences 223
How the Data Is Stored 225
Per-Application Preferences 227
Using Persistent Data 227
Using the Java Preference System 228
Details of Java Preference API 228
Converting BWeatherApp to use Java Preferences 229
Why Use the Preferences API? 230
Other Methods of Saving Preference Data 230
Summary 231
Questions 231
Animation 233
Animation Resources 233
What Can Be Animated 234
Moving Views 235
Animating Transparency 236
Graphics Scaling 237
Visibility 237
Animating Events 238
Chaining Animations 238
Putting It All Together 240
Summary 242
Questions 242
Connecting to External Resources 243
Data from the Web 243
Setting the Resource as a URL 243
Retrieving the Resource and Saving It Locally 244
SOAP, RSS, & XML 246
SOAP 246
RSS 247
XML Data 248
JDBC 248
Other Options 251
Summary 251
Questions 251
Deploying an HME Application 253
Jar from Command Line 253
Creating a Web Start Application 255
Using Web Start with HME 256
OS X Native App 258
Creating an Application Icon 258
Bundler 258
Preparing Your Resources 259
Creating a Jar Bundle 259
Final Touches 261
Packaging 263
Creating the Disk Image 263
Stylizing the Disk Image 264
Compressing and Locking Down the Disk Image 267
Launching a Disk Image Automatically Upon Download 267
Displaying a Software License Agreement 268
Windows Native App 268
Creating an Application Icon 268
Bundler 269
Installer 269
Packaging 270
Selling Your Application 270
Summary 270
Questions 270
Tips and Troubleshooting 271
Logging 272
Common Problems 274
Additional Resources 275
Summary 275
Exercise Answers 277
Index 283
Subjects