content_dev_ref

Reviews
Shared by: Alex Cameron
Categories
Tags
Stats
views:
57
rating:
not rated
reviews:
0
posted:
7/11/2008
language:
Unknown
pages:
0
Content Developer’s Reference Liberate TV Producer™ Liberate TV Navigator™ Standard 1.2.6.1 Liberate TV Navigator™ Standard 1.3 Content Developer’s Reference Liberate TV Navigator Standard 1.2.6.1 and 1.3 Part number: N00067-09 Copyright © 1997–2001 Liberate Technologies. All Rights Reserved. Revised April 23, 2001. Restricted Rights This document contains proprietary and confidential information that is the property of Liberate Technologies. It is protected by copyright and distributed under licenses restricting its use, copying, and distribution. No part of this document may be reproduced in any form without prior written authorization from Liberate Technologies. This manual is provided “as is” without warranty of any kind, either expressed or implied, including, without limitation, merchantability, fitness for a particular purpose or noninfringement. It may include technical inaccuracies or typographical errors. Changes are periodically made to the information it contains. Liberate Technologies may make improvements and/or changes in the programs and/or interfaces described in this publication at any time. Trademarks Notice Liberate, the Liberate logo and design, IQView, Liberate Command, Liberate Connect, Liberate Datapoint, Liberate Imprint, Liberate Mediacast, Liberate microVM, Liberate Profile, Liberate Security, Liberate Transcode, Liberate TV Browse, Liberate TV Chat, Liberate TV Customizer, Liberate TV Emulator, Liberate TV Extender, Liberate TV Info, Liberate TV Mail, Liberate TV Message, Liberate TV Navigator, Liberate TV Phone, Liberate TV Platform, Liberate TV Porter, Liberate TV Producer, Liberate TV Ticker, PopTV, ShowLinks, ShowSurf, ShowSync, and TV Bar are trademarks or registered trademarks of Liberate Technologies. Macromedia, Dreamweaver, Fireworks, Flash and any other Macromedia product names are trademarks or registered trademarks of Macromedia, Inc. in the United States and/or other countries. Macromedia does not sponsor, affiliate, or endorse Liberate products, and/or services. All other brand names or product names are, or may be, trademarks of their respective owners and are used to identify the products or services of those owners. This software is based in part on the work of the independent JPEG group. Feedback Please send comments and feedback to: Liberate Technologies Technical Publications Department 2 Circle Star Way San Carlos, CA 94070 e-mail Technical Publications: docs@liberate.com e-mail the TV Producer team: tvproducer@liberate.com CONTENTS Chapter 1: Introduction The Master Application 1 . . . . . . . . . . . . . . . . . . . . . . . . 1 The Service Manager and Standard Services . . . . . . . . . . . . . . . . . . . 2 Exported API . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2 HTML and JavaScript . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Compatibility . . . . . . . . . Differences from Standard JavaScript . Omissions . . . . . . . . Modifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 4 4 5 JavaScript Security . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 Access to the API . . . . . . . . . . . Controlled API: Access Control Lists . . . . Calculating a Match . . . . . . . Setting Up the Lists . . . . . . . . Access to Shared Objects . . . . . Trusted for Reading or Writing . . . . Exclusive API: the Service Manager’s Domain . . 7 . 7 . 8 . 9 . 9 . 9 .10 Defining Event Handlers . . . . . . . . . . . . . . . . . . . . . . . .10 Organization of this Manual . . . . . . . . . . . . . . . . . . . . . . .12 Notation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .14 JavaScript Data Types . . . Read/Write Permission . . . Functions and Event Handlers Object and Array Types . . . Font Conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .15 .15 .16 .17 .18 Chapter 2: TV Display Television in the Background . . . . . . . Frameset Background . . . . . . . Transparent and Opaque Backgrounds Backgrounds beyond Window Borders 19 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .21 .21 .22 .23 HTML for TV Display . . . . . . . . . . . . . . . . . . . . . . . . . .21 Table of Contents iii Cursorless Navigation . . . . . . . Setting the Initial Focus . . . . Preventing Image Cursors . . . Highlighting Links . . . . . . Preventing Focus on a Text Area . Adjustments for the TV Screen . . . . Font Size . . . . . . . . . Headings . . . . . . . . . . Image Spacing . . . . . . . Image Width . . . . . . . . Image and Frame Borders . . . Horizontal Rules . . . . . . . Preventing Line Breaks . . . . Table Borders, Cell Separation, and Table Width and Height . . . . Table Cell Width . . . . . . . Overview . . . . . . . . Properties . . . . . . . . alpha . . . . . . . format . . . . . . preferredFormat . . . programDefaults . . screenArea, safeArea . settingsAlwaysRetained tvVisible . . . . . . videoOn . . . . . . wideScreenStyle . . . Methods . . . . . . . . retainSettings() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Cell Margins . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 26 27 28 29 30 30 31 32 32 33 33 34 34 35 36 37 39 39 39 39 40 41 41 42 42 43 44 44 45 45 47 47 47 47 47 48 48 49 49 49 50 50 Display Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Link Object Additions Overview . . . . Properties . . . . highlightable name . . . Methods . . . . focus(), blur() . . . . . . . . . . . . . . . . . . . . . . . . . ScreenArea and SafeArea Objects . . . . . . . . . . . . . . . . . . . Overview . . . . . . . . . . Judging the Safe Area . . . Using the Safe Area . . . . Screen Size and Aspect Ratio iv Content Developer’s Reference ScreenArea Properties width, height . SafeArea Properties . left, top, width, Overview . . Properties . . mute . volume . . . . . . . . . height . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .50 .50 .51 .51 .53 .53 .53 .53 Speaker Object . . . . . . . . . . . . . . . . . . . . . . . . . . . .53 . . . . . . . . . . . . Chapter 3: Extending the Standard API Transient History . . . . . . . HTTP Header Equivalents . . . . Images and Colors in Selection Lists Prefetching . . . . . . . . . 55 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .57 .57 .61 .63 .65 .65 .66 .66 .67 .67 .68 .69 .69 .70 .70 .71 .71 .72 .72 .72 .73 .73 .73 .74 HTML Extensions . . . . . . . . . . . . . . . . . . . . . . . . . . .57 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Cookie Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . .65 Overview . . . . . . . . . . . . . . Access to Cookies . . . . . . . . Transmitted and Untransmitted Cookies Setting Up a Cookie Object . . . . . Storing Cookie Data . . . . . . . The Cookie Database and Cache . . . Memory Limitations . . . . . . . Constructor . . . . . . . . . . . . . Cookie() . . . . . . . . . . . . Properties . . . . . . . . . . . . . . domain, path . . . . . . . . . . expiration . . . . . . . . . . . name . . . . . . . . . . . . . secure . . . . . . . . . . . . transmitted . . . . . . . . . . value . . . . . . . . . . . . . Methods . . . . . . . . . . . . . . load() . . . . . . . . . . . . remove() . . . . . . . . . . . store() . . . . . . . . . . . . Table of Contents v Document Object Additions . Overview . . . . . . . . . . . Properties . . . . . . . . . . . cookies . . . . . . . . . Overview . . . . . . . . History Properties . . . . . curIndex . . . . . History Methods . . . . . add(), remove() . . . back(), forward(), go() fullGo() . . . . . . HistoryEntry Properties . . . appData . . . . . . title . . . . . . . HistoryEntry Methods . . . go() . . . . . . . toString() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 77 77 77 79 79 80 80 80 80 81 81 83 83 83 84 84 84 85 85 85 86 86 87 87 88 88 88 89 89 90 90 91 91 92 94 95 95 95 95 History and HistoryEntry Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Navigator Object Additions . . . . . . . . . . . . . . . . . . . . . . Overview . . . . . . . . . . . . . . . . . . Properties . . . . . . . . . . . . . . . . . . cache . . . . . . . . . . . . . . . . . curUser . . . . . . . . . . . . . . . . display . . . . . . . . . . . . . . . . extensions . . . . . . . . . . . . . . . indicators . . . . . . . . . . . . . . . input . . . . . . . . . . . . . . . . . length . . . . . . . . . . . . . . . . net . . . . . . . . . . . . . . . . . . serviceManager . . . . . . . . . . . . . speaker . . . . . . . . . . . . . . . . sysServices . . . . . . . . . . . . . . . system . . . . . . . . . . . . . . . . tvTuners . . . . . . . . . . . . . . . . userAgent, appName, appCodeName, appVersion userManager . . . . . . . . . . . . . . String Object Additions . . . . . . . . . . . . . . . . . . . . . . . . Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . encrypt() . . . . . . . . . . . . . . . . . . . . . . . . . . . . vi Content Developer’s Reference Text and Textarea Object Additions . . . . . . . . . . . . . . . . . . .97 Overview . . . . . . . . . . Text Object Properties . . . . . bgColor . . . . . . . . Textarea Object Properties . . . bgColor . . . . . . . . curLineCount, maxLineCount focusable . . . . . . . topLine, bottomLine . . . wrap . . . . . . . . . Textarea Methods . . . . . . . append() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .97 .97 .97 .98 .98 .98 .99 .99 100 100 100 103 103 103 103 103 104 105 105 105 109 110 110 110 Window Object Additions Overview . . . . . Properties . . . . . layer . . . . overscan . . visible . . . Methods . . . . . close() . . . open() . . . releaseContext() Event Handlers . . . onkeyout() . . onvisible() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Chapter 4: Dynamic Tables Named Tables and JavaScript Objects Limitations on Content . . . . . . Font Attributes of Cells . . . . . . Scrolling . . . . . . . . . . . Matching Cells to Columns . . . . Overview . . . . . . . . . Table Attributes . . . . . . Table Name . . . . . Minimum Number of Cells Table Event Handlers . . 113 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 114 115 115 117 119 119 119 120 121 HTML for Dynamic Tables. . . . . . . . . . . . . . . . . . . . . . . 119 . . . . . . . . . . Table of Contents vii Cell Attributes . . . . . . Focusable Cells . . . Highlighting the Cell in Cell Background . . . Animated Text in Cells . . . . Focus . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 121 122 122 123 125 126 126 126 127 127 127 127 128 130 130 133 133 133 133 134 136 137 137 138 139 139 140 140 140 141 141 141 Table Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 Overview . . . . . . . . . . . . . . . Properties . . . . . . . . . . . . . . . drawingDisabled . . . . . . . . . name . . . . . . . . . . . . . . rows . . . . . . . . . . . . . . Methods . . . . . . . . . . . . . . . clear() . . . . . . . . . . . . . focus(), blur() . . . . . . . . . . . scrollRows() . . . . . . . . . . . Event Handlers . . . . . . . . . . . . . onnavigate(), onfocus(), onblur(), onclick() TableCell Objects . . . . . . . . . . . . . Overview . . . . . . . . . . . . . . . . . . Properties . . . . . . . . . . . . . . . . . . align, valign . . . . . . . . . . . . . . background, bgColor . . . . . . . . . . . behavior, direction, loop, scrollAmount, scrollDelay colSpan . . . . . . . . . . . . . . . . elisionString . . . . . . . . . . . . . . fgColor . . . . . . . . . . . . . . . . focusable . . . . . . . . . . . . . . . highlightable . . . . . . . . . . . . . . wrappingEnabled . . . . . . . . . . . . Methods . . . . . . . . . . . . . . . . . . findColsNeeded() . . . . . . . . . . . . findFit() . . . . . . . . . . . . . . . . read() . . . . . . . . . . . . . . . . . write() . . . . . . . . . . . . . . . . TableRow Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 Properties . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 cells . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 143 viii Content Developer’s Reference Chapter 5: The Network 145 Requests and Sessions . . . . . . . . . . . . . . . . . . . . . . . . . . 145 NetEvent Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 Cache Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Methods . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 remove() . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 Headers Array . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 Overview . . . Properties . . . length . . Methods . . . getValue() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 149 149 149 149 151 151 151 151 151 152 152 153 153 157 157 158 158 159 159 159 159 160 161 162 162 162 Net Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 151 Overview . . . . . . . . . . . . . . . . Properties . . . . . . . . . . . . . . . . connected . . . . . . . . . . . . . Methods . . . . . . . . . . . . . . . . ensureConnection() . . . . . . . . . NetEvent() . . . . . . . . . . . . . NetRequest(), NetSession(), NetMsgSession() Event Handlers . . . . . . . . . . . . . . onprogress() . . . . . . . . . . . . Overview . . . . . . . . Received NetEvents . . Constructed NetEvents Two Views of the Data . Constructor . . . . . . . NetEvent() . . . . . Properties . . . . . . . . binaryData . . . . . contentType . . . . headers . . . . . . textData . . . . . type . . . . . . . url . . . . . . . . NetEvent Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 157 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table of Contents ix NetMsgSession Objects . . . . . . . . . . . . . . . . . . . . . . . . 165 Overview . . . . . . . . . The Messaging System . Using a NetMsgSession . Asynchronous Methods . NetEvent Objects . . . Constructor . . . . . . . . NetMsgSession() . . . Properties . . . . . . . . . appId, nodeId, nodeType sessionId . . . . . . Methods . . . . . . . . . attach(), detach() . . . register(), unregister() . . send() . . . . . . . Event Handlers . . . . . . . onerror() . . . . . . onreceive() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 165 165 166 167 167 168 168 168 168 169 169 169 170 171 173 173 173 175 175 175 176 176 176 177 177 177 178 179 179 181 182 182 182 183 183 185 185 186 186 NetRequest Objects . . . . . . . . . . . . . . . . . . . . . . . . . 175 Overview . . . . . . . . . . . . . . . . . . Preparing the Object . . . . . . . . . . . Initiating the Request . . . . . . . . . . . Server Constraints . . . . . . . . . . . . Constructor . . . . . . . . . . . . . . . . . NetRequest() . . . . . . . . . . . . . . Properties . . . . . . . . . . . . . . . . . . cache . . . . . . . . . . . . . . . . . direct . . . . . . . . . . . . . . . . . headers . . . . . . . . . . . . . . . . post . . . . . . . . . . . . . . . . . postData . . . . . . . . . . . . . . . url . . . . . . . . . . . . . . . . . . Methods . . . . . . . . . . . . . . . . . . cancel() . . . . . . . . . . . . . . . . fetch() . . . . . . . . . . . . . . . . Event Handlers . . . . . . . . . . . . . . . . onstart(), onerror(), oncancel(), onload(), ondone() NetSession Objects . Overview . . . . . . . Constructor . . . . . . NetSession() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . x Content Developer’s Reference Properties . . . . . . . headers . . . . . url . . . . . . . Methods . . . . . . . send() . . . . . start() . . . . . stop() . . . . . Event Handlers . . . . . onstart(), onreceive(), . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . onerror(), . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . onstop() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 187 187 187 187 188 188 189 189 Chapter 6: TV Information and Control ConditionalAccess Object Overview . . . . . . . . . Properties . . . . . . . . . credit . . . . . . . . Methods . . . . . . . . . cancelPurchase() . . . changePin(), checkPin() . getInfo() . . . . . . purchase() . . . . . . Event Handlers . . . . . . . onalarm(), oncommand() 191 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 193 193 193 194 194 194 195 196 196 196 199 200 200 201 201 202 202 203 204 204 207 207 208 208 209 209 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ETv Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 199 Overview . . . . . . . . . . . Properties . . . . . . . . . . . enabled . . . . . . . . . triggerUrl . . . . . . . . unmatchedUrlsAccepted . . . Methods . . . . . . . . . . . addToUrlFilter(), resetUrlFilter() setChannelFilter() . . . . . Event Handlers . . . . . . . . . ontrigger() . . . . . . . . MusicText Object Overview . . . . Methods . . . . start(), stop() Event Handlers . . onreceive() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table of Contents xi ProgramStream Objects . . . . . . . . . . . . . . . . . . . . . . . 211 Overview . . . . . . . . . . . . . . . . . . . . . Methods and Handlers . . . . . . . . . . . . . Playing Speeds . . . . . . . . . . . . . . . . Time Strings . . . . . . . . . . . . . . . . . Properties . . . . . . . . . . . . . . . . . . . . . curSpeed . . . . . . . . . . . . . . . . . . curTime, totalTime . . . . . . . . . . . . . . . fastForwardSpeed, rewindSpeed . . . . . . . . . . id . . . . . . . . . . . . . . . . . . . . . keyFrames . . . . . . . . . . . . . . . . . . mute . . . . . . . . . . . . . . . . . . . . title . . . . . . . . . . . . . . . . . . . . Methods . . . . . . . . . . . . . . . . . . . . . fastForward(), rewind() . . . . . . . . . . . . . pause() . . . . . . . . . . . . . . . . . . . play() . . . . . . . . . . . . . . . . . . . . stop() . . . . . . . . . . . . . . . . . . . . Event Handlers . . . . . . . . . . . . . . . . . . . ondone() . . . . . . . . . . . . . . . . . . onerror() . . . . . . . . . . . . . . . . . . onplay(), onfastforward(), onrewind(), onpause(), onstop() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 211 211 212 212 212 212 213 213 214 214 214 215 215 215 216 217 218 219 219 219 220 221 221 221 222 223 223 223 224 228 229 229 230 231 231 232 233 234 234 235 236 TvChannel Objects . . . . . . . . . . Overview . . . . . . . . . . . . . . . . Tunable and Presentable Channels . . . . Signal Type . . . . . . . . . . . . . Defined and Undefined Properties . . . . Properties . . . . . . . . . . . . . . . . accessControlled . . . . . . . . . . availableComponents, selectedComponents blackedOut, blocked . . . . . . . . . category, description . . . . . . . . . curProgram, nextProgram . . . . . . . frequency . . . . . . . . . . . . . hidden . . . . . . . . . . . . . . id . . . . . . . . . . . . . . . . name, fullName, shortName . . . . . . network . . . . . . . . . . . . . . relatedChannel . . . . . . . . . . . serviceType . . . . . . . . . . . . signal . . . . . . . . . . . . . . . split, splitTimes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xii Content Developer’s Reference tunable, presentable, tunables, presentables . . . . . . . . . . . . . . . 236 uniqueId, serviceId, transportStreamId . . . . . . . . . . . . . . . . . 237 url . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 238 TvInfo Object . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 Overview . . . . . . . . . Program Information . . Setting the Data Source . Examining the Data . . . Properties . . . . . . . . . indexes . . . . . . . pfEnabled, nvodEnabled . schemaUrl . . . . . . Methods . . . . . . . . . addIndex(), deleteIndex() search() . . . . . . . setDataSource() . . . . Overview . . . Properties . . . name . . Methods . . . getNext(), search() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 239 239 240 240 241 241 241 242 243 243 245 245 251 252 252 253 253 253 255 256 257 257 257 257 258 258 259 259 260 260 260 261 262 262 263 TvInfoIndex Objects . . . . . . . . . . . . . . . . . . . . . . . . . 251 . . . . . . . . . . . . . . . . getPrev() . . . . . . . . . . . . . . . . TvProgram Objects . . . . . . . . . . . . . . . . . . . . . . . . . 255 Overview . . . . . . . . . . . . Searching . . . . . . . . . Defined and Undefined Properties Possible Values . . . . . . . Constructor . . . . . . . . . . . TvProgram() . . . . . . . . Properties . . . . . . . . . . . . accessControlled . . . . . . ageRating, qualityRating . . . . audio . . . . . . . . . . . blackedOut . . . . . . . . captions . . . . . . . . . . channels . . . . . . . . . deliveryMode . . . . . . . . description . . . . . . . . . duration . . . . . . . . . . nvodId, nvodReference . . . . Table of Contents xiii raw . . . . startTime . . title, shortTitle topics . . . . year . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 265 266 266 267 269 269 269 271 271 271 272 273 273 274 274 275 275 276 276 278 279 279 280 281 283 283 284 284 284 285 285 287 287 288 288 288 TvTuner Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 Overview . . . . . . . . . Types of TvTuner Objects . Role of the TvTuner . . . Properties . . . . . . . . . access . . . . . . . channels . . . . . . curChannel . . . . . eTv . . . . . . . . format . . . . . . . frozen . . . . . . . info . . . . . . . . mute . . . . . . . . name . . . . . . . . Methods . . . . . . . . . captureStill() . . . . . findChannel() . . . . . Event Handlers . . . . . . . onbeforechannelchange(), onchannelsupdate() . . onprogramchange() . . Overview . . . . . . Properties . . . . . . length . . . . . musicText . . . primary, secondary Methods . . . . . . TvProgram() . . Overview . . . . . . The VOD Service . Usage . . . . . Constructor . . . . . VodSession() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . onafterchannelchange() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . TvTuners Array . . . . . . . . . . . . . . . . . . . . . . . . . . . 283 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . VodSession Objects . . . . . . . . . . . . . . . . . . . . . . . . . . 287 xiv Content Developer’s Reference Properties . . . . . . . . . . . channelId . . . . . . . . configInfo . . . . . . . . controlAddr . . . . . . . id . . . . . . . . . . . stream . . . . . . . . . Methods . . . . . . . . . . . createStream(), destroyStream() open(), close() . . . . . . Event Handlers . . . . . . . . . onerror() . . . . . . . . onopen(), onstreamcreate() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 289 289 289 290 290 291 291 291 292 293 293 294 Chapter 7: System Capabilities The Focus Stack . . . . . . . . Opening and Closing Windows Showing and Hiding Windows Autofocus Exception . . . . The Focus within a Window . . Input Handling . . . . . . . . Window-Specific Handlers . . Defining the Handlers . . . . Input and the Service Manager 295 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 295 296 296 297 297 298 298 300 300 301 301 302 302 302 302 305 305 305 305 306 307 308 308 308 309 310 310 . . . . . . . . . . . . . . . . . . . . . . . . . . . Indicator Objects Overview . Properties . name type value . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Input Object . . . . . . Overview . . . . . . . . . Properties . . . . . . . . . curKey, curChar . . . . deviceType, deviceNumber timestamp . . . . . . Methods . . . . . . . . . insertKeys() . . . . . pushFocus(), popFocus() setExclusiveKeys() . . . Event Handlers . . . . . . . onkeyin(), onkeyout() . . Table of Contents xv System Object . . . . Overview . . . . . . . . Properties . . . . . . . . uniqueId . . . . . Methods . . . . . . . . control() . . . . . resetExecutionCount() Event Handlers . . . . . . onerror() . . . . . onexternalevent() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 313 313 313 313 313 313 315 316 316 318 Chapter 8: Users and Services Object Overview . . . . . . . . . . . . . . The User-Management Model . . . . . . . . . Current User . . . . . . . . . . . . . Default User . . . . . . . . . . . . . User Identification . . . . . . . . . . . Administrative Privileges . . . . . . . . . Overriding the Current User . . . . . . . . Roaming . . . . . . . . . . . . . . User Interface . . . . . . . . . . . . . . . User and Service Properties . . . . . . . . . . System-Defined and Provider-Defined Properties Disallowed Characters . . . . . . . . . . Naming Convention . . . . . . . . . . Passwords . . . . . . . . . . . . . . Cookies vs. User and Service Properties . . . Managing a Service . . . . . . . . . . . . . Setting and Getting Service Properties . . . . Regulating User Access to a Service . . . . . Restricting Access to Service Objects . . . . Access Restrictions . . . . . . . . . . . . . Read/Write Restrictions . . . . . . . . . Page Restrictions . . . . . . . . . . . . User Restrictions . . . . . . . . . . . . 321 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 321 322 322 323 323 323 323 324 324 324 325 325 325 326 326 326 327 328 328 328 329 329 330 Authentication Object . . . . . . . . . . . . . . . . . . . . . . . . 333 Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 333 Reauthentication . . . . . . . . . . . . . . . . . . . . . . . . . . 333 Reconfiguration . . . . . . . . . . . . . . . . . . . . . . . . . . 334 xvi Content Developer’s Reference Properties . . . hint . . status . . Methods . . . reset() . setKey() . Event Handlers . onkeyset() onreset() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 334 334 334 335 335 336 337 337 337 339 339 340 340 341 342 342 342 342 343 344 345 346 347 348 349 350 351 353 354 355 356 357 357 359 359 359 360 361 362 363 Service Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . 339 Overview . . . . . . . . . . . . . . . . . . . . The Role of a Service Object . . . . . . . . . . Standard Services . . . . . . . . . . . . . . Restrictions on Access . . . . . . . . . . . . . Access to User Properties . . . . . . . . . . . . Default Values . . . . . . . . . . . . . . . . Synchronization . . . . . . . . . . . . . . . Properties . . . . . . . . . . . . . . . . . . . . sysBootUrl . . . . . . . . . . . . . . . . . sysChannel . . . . . . . . . . . . . . . . . sysDescription . . . . . . . . . . . . . . . sysDisplayLanguage, sysLocalizationUrl . . . . . . sysDisplayName . . . . . . . . . . . . . . . sysHeaderValue, sysHeaderUrl . . . . . . . . . . sysId, sysInternalName, sysVersion . . . . . . . . sysInfoUrl . . . . . . . . . . . . . . . . . sysLogoUrl, sysSmallLogoUrl . . . . . . . . . . sysProviderConsent, sysAdminConsent, sysUserConsent sysRegistrationUrl, sysCancellationUrl, sysRegistered . sysRoot . . . . . . . . . . . . . . . . . . sysStatus, sysLastStatusChange . . . . . . . . . sysTrustedUrl . . . . . . . . . . . . . . . . sysType . . . . . . . . . . . . . . . . . . sysTypeRequired . . . . . . . . . . . . . . . Overview . . . . . . . . Properties . . . . . . . . sysAdminEnabled . . sysDefault . . . . . sysFirstScreen . . . . sysLanguagePreferences sysMasterAppId . . . User Objects . . . . . . . . . . . . . . . . . . . . . . . . . . . . 359 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Table of Contents xvii sysName, sysRoamingName sysServices . . . . . . . sysSetupDone . . . . . sysUniqueId . . . . . . sysWebAccess . . . . . . Methods . . . . . . . . . . changePassword() . . . . checkPassword() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 364 365 365 366 366 367 367 368 369 369 369 370 370 370 371 372 373 375 375 376 377 UserManager Object . . . . . . . . . . . . . . . . . . . . . . . . . 369 Overview . . . . . . . . . . . Properties . . . . . . . . . . . authentication . . . . . . users . . . . . . . . . . Methods . . . . . . . . . . . addUser(), deleteUser() . . . evalWithPrivileges() . . . . switchToUser() . . . . . . syncUserData(), writeUserData() Event Handlers . . . . . . . . . onadd(), ondelete() . . . . onswitch() . . . . . . . . onsync(), onwrite() . . . . . Chapter 9: Content Data Types Text Formats . . . . . . . . . text/plain . . . . . . . text/html . . . . . . . Audio Formats . . . . . . . . audio/aiff, audio/x-aiff . . audio/basic . . . . . . audio/wav, audio/x-wav . . Image and Video Formats . . . . image/gif . . . . . . . image/jpeg . . . . . . . image/png . . . . . . . Other Formats . . . . . . . . application/x-javascript . . application/x-shockwave-flash 379 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 379 379 379 380 380 380 381 381 381 382 382 382 382 382 . . . . . . . . . . . . . . . . . . . . . . . . . . . . xviii Content Developer’s Reference Chapter 10: Protocols Protocols for TV and Broadcast tv: . . . . . . . . mcast: . . . . . . Standard Protocols . . . . http: . . . . . . . https: . . . . . . . javascript: . . . . . Unsupported Protocols . . . 383 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 383 383 387 387 387 388 388 388 Appendix A: HTML Catalog Tags and Attributes . . . . Top-Level Tags . . . Head-Level Tags . . . Body-Structuring Tags . Table Tags . . . . . List Tags . . . . . . Form Tags . . . . . Text-Formatting Tags . Other Inline Tags . . . Notes . . . . . . . . . 391 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 391 392 394 395 396 399 400 402 403 405 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Appendix B: JavaScript Catalog Core Language . . . . . Operators . . . . Statements . . . . Event Handlers . . Regular Expressions JavaScript Entities . Client-Side API . . . . . Notes . . . . . . . . 407 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 407 408 409 411 411 411 412 450 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Appendix C: Key Codes 455 Character Keys . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 455 Modifiers . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 The Enter Key . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 Table of Contents xix Exceptions for the Emulator . Control-Enter . . . . . . Other Keys . . . . . . . . . Keys 0x0300 through 0x0311 Keys 0x0400 through 0x0415 Keys 0x0500 through 0x050F Platform-Defined Keys . . . Key Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 456 457 457 458 459 461 462 463 Appendix D: Playing Sounds Appendix E: Playing Flash Movies Attributes of the Tag . base . . . . . . . . bgcolor . . . . . . . highlightable . . . . . loop . . . . . . . . name . . . . . . . . play . . . . . . . . pluginspage . . . . . quality . . . . . . . salign . . . . . . . . scale . . . . . . . . src . . . . . . . . . ui . . . . . . . . . width, height . . . . . Using JavaScript . . . . . . Getting the Embed Object Timing Considerations . . Targeted Methods . . . Properties of the Embed Object . name . . . . . . . . src . . . . . . . . . Methods of the Embed Object . FlashVersion() . . . . . FrameLoaded() . . . . GetVariable(), SetVariable() GotoFrame() . . . . . LoadMovie() . . . . . Pan() . . . . . . . . 465 467 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 467 468 468 468 468 469 469 469 470 470 470 471 471 471 472 472 472 473 473 473 474 474 474 474 474 475 475 476 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xx Content Developer’s Reference PercentLoaded() . . . . . . . . . . . . . . . . . . . Play(), StopPlay(), IsPlaying(), TPlay(), TStopPlay() . . . . . . Rewind() . . . . . . . . . . . . . . . . . . . . . . TCallFrame(), TCallLabel() . . . . . . . . . . . . . . . TGotoFrame(), TGotoLabel() . . . . . . . . . . . . . . TotalFrames(), CurrentFrame(), TCurrentFrame(), TCurrentLabel() TSetProperty(), TGetProperty(), TGetPropertyAsNumber() . . . Zoom(), SetZoomRect() . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 476 476 476 477 477 478 478 480 Index 481 Table of Contents xxi xxii Content Developer’s Reference Introduction CHAPTERM 1 This reference manual documents the extensions to HTML and client-side JavaScript that Liberate TV Navigator™ supports. The extensions range from simple HTML adjustments, like letting a table cell have a transparent background, to system-level capabilities, such as user management and input handling. Taken together, Liberate’s additions to HTML and JavaScript enable TV Navigator to bring television to the Web and the Web to the TV screen. For an introduction to TV Navigator and an explanation of how to combine television with Web content, consult the Content Developer’s Guide. This Content Developer’s Reference is specific to the Standard (or “S”) version of TV Navigator for cable and satellite systems. Whenever “TV Navigator” is mentioned, it means TV Navigator Standard. On occasion, where it’s necessary to explicitly distinguish the Standard version of TV Navigator from the Compact and Analog versions, it will be referred to as “TV Navigator–S” or, in some charts and tables, as “TVN–S.” This edition of the Reference documents the 1.2.6.1 update to version 1.2 of TV Navigator–S and the first release of version 1.3. API elements that are in version 1.3 but not in version 1.2.6.1 are marked with a 1.3 flag. The Master Application On the client side, TV Navigator consists of two pieces: • An application engine that resides on the set-top box and provides TV Navigator with its core capabilities. It can display TV, control the TV set, fetch and interpret Web content, and do all the other things expected of an Internet browser and platform. • A master application that provides a user interface to the system and a framework for other applications. The master application is written in HTML and JavaScript and resides on Web pages. Chapter 1: Introduction 1 The Master Application The application engine doesn’t have a user interface. It provides windows for Web content, but they’re simply blank rectangles until a page is loaded. It loads the first page—the initial page of the master application—in a hidden window that never closes. After that, it’s up to the master application to place a window on-screen and structure the interaction with the user. The Service Manager and Standard Services The master application is extensible. Its core component is the Service Manager, which organizes a set of applications, mini-applications, and other modules known as services. The Service Manager provides the framework within which the services operate. For example, it gives services a place in the channels list if they need it, creates pop-up windows for them if they request it, sets them up when they become available to a new user, and notifies them when the current user changes. Among other things, the Service Manager implements all the system-level event handlers, such as the handlers that receive progress reports on network activity and respond to user input. However, its implementation of these handlers simply coordinates the responses of the various services. For example, when the user presses a key that should bring up a particular service, the Service Manager makes sure that the service is asked to respond. The master application bundles the Service Manager with a core group of standard services. These services handle essential tasks in the user interface—such as changing the channel, displaying the status bar, providing access to the Web, and keeping track of favorite channels and Web sites. The Service Manager does none of the actual user-interface work itself; it’s simply a framework for the service modules. Each module can be customized or replaced independently. Although it comes with just the standard services at its disposal, the Service Manager can work with any services that you develop. The framework is extensible. For more information, see Chapter 8, “Users and Services”—especially the section on the Service object—and the Service Developer’s Guide. Exported API The first page that TV Navigator loads at start-up belongs to the Service Manager. The Service Manager stays loaded (in an off-screen window) as long as TV Navigator is running, so it has a permanent JavaScript context. Within that context, it defines a set of JavaScript variables and functions that services can use to integrate themselves into the Service Manager’s framework. Individual services can also define their own variables and functions within the same context 2 Content Developer’s Reference HTML and JavaScript to make them available to other services. In other words, the master application exports its own JavaScript API (application programming interface). Like all of the master application, this API is defined on Web pages. It’s valid only within the context of the Service Manager. The API that the master application exports is documented in the Service Developer’s Guide, not here. This manual describes the Liberate extensions to client-side JavaScript—the API that the TV Navigator application engine implements—but none of the API implemented in JavaScript itself. HTML and JavaScript This reference manual assumes a beginning knowledge of HTML and the JavaScript language. There are a wide variety of publications that you can consult for information on HTML and JavaScript. A good online source is the Netscape DevEdge Library at: http://developer.netscape.com/docs/manuals/index.html This manual doesn’t duplicate the information you’ll find at the Netscape site or in the books you can pick up at a bookstore. Instead, it concentrates on two things: • It notes where the Liberate implementation of HTML and JavaScript differs from the documented standard. • It explains in full the extensions to HTML and JavaScript for Interactive TV. These extensions both facilitate the display of Web content on television screens and enable you to build applications for the set-top box. In some cases, they provide JavaScript with system-level capabilities that are reserved for the Service Manager and closely associated core services. At the end of the manual, two appendixes catalog all the HTML and JavaScript that TV Navigator supports, including both standard elements and the extensions. Compatibility At present, TV Navigator implements an extended version of HTML 3.2. Although content created using HTML 4.0 is increasing, a vast majority of Web content continues to be HTML 3.2–compliant. Appendix A, “HTML Catalog,” presents all the HTML tags and attributes that TV Navigator currently supports. The JavaScript that TV Navigator implements is an extension of version 1.1, the same version that Netscape Navigator 3.0 supports. When consulting a manual or the Netscape site, check to Chapter 1: Introduction 3 HTML and JavaScript be sure that the feature you’re looking at is defined for that version. Appendix B, “JavaScript Catalog,” lists all the JavaScript that TV Navigator currently supports. Differences from Standard JavaScript The Liberate implementation of JavaScript closely matches the Netscape implementation. The language fundamentals are the same, as are all the inherent classes, like Date, Math, and String. Client-side objects—such as Document, Window, Link, Image, and History—work much as they do for the Netscape browsers. Nevertheless, there are differences. First and foremost, some important additions have been made to the language, additions which this manual documents in detail. Moreover, some parts of the standard language have not been implemented or have, of necessity, been implemented a bit differently for TV-centric systems. The principal omissions and modifications are described in the following sections. Omissions At present, TV Navigator doesn’t implement or support: • Most methods of the Document object, including Document.write(). TV Navigator runs on an especially thin client. To help keep it thin, the server preprocesses documents and encodes them before sending them on to the client. At present, this deprives the client of the ability to modify a document arbitrarily. Modifications can be made only in restricted realms—to table cells and images, for example. • Applets or the part of JavaScript that communicates with Java. You therefore cannot use the Packages object or any of the standard JavaScript objects that begin with the word “Java”—JavaObject, JavaClass, JavaMethod, JavaArray, and so on. • Plug-ins, in the sense of independent modules that can be dynamically loaded to handle particular types of data. However, TV Navigator has some built-in modules that do what independent plug-ins do on other systems. • JavaScript entities—JavaScript code bracketed by &{ and }; and used to set HTML attribute values. (However, TV Navigator does support character entities like > and µ.) • The multicharacter selection of text—including methods that select text programmatically, like Text.select(), and the onselect() handlers. Because users navigate on-screen by moving a focus rectangle, not a cursor, text selection is impractical. 4 Content Developer’s Reference HTML and JavaScript Modifications Some of the ways that JavaScript is implemented for a set-top box differ from ways it’s typically implemented for a computer. These differences include the following: • Shared objects. To save memory on a thin client, TV Navigator has JavaScript contexts share some objects. It works like this: Every document with JavaScript code has its own context to execute that code. On a computer-oriented browser, each context has its own set of objects, even when those objects are duplicates of each other. The String object, for example, could be modified in one context without affecting the String object in another context. However, on TV Navigator, all objects that don’t hold document-specific information are shared between contexts. This includes: — The base objects for fundamental JavaScript types (like Number, String, and Object). Although each context holds the specific strings found in the document, the String object is shared among all documents. — The Navigator object—and all objects that the Navigator object contains, such as MimeType, TvTuner, and Indicator objects. (Liberate’s additions to the Navigator object, including TvTuner and Indicator objects, are described in this reference manual.) — The prototype objects that hold common properties and methods for a class of objects that otherwise vary. For example, each context has its own Window object, but the Window prototype, which defines methods like open() and close() that are common to all Window objects, is shared. — Objects defined by extenders (modules that extend the TV Navigator application engine and are built using the Liberate TV Extender™ kit)—for example, the MusicText object. Shared objects are subject to a special security restriction. See “Access to Shared Objects” on page 9. Note: Although objects are currently shared, they will not be shared in all releases, in every deployment, or on all set-top boxes. It’s an implementation detail that helps keep the footprint small on boxes without a great deal of memory. Therefore, shared objects should not be used as a way to share information among pages or applications. Chapter 1: Introduction 5 JavaScript Security • Memory. Set-top boxes generally don’t have as much random-access memory as computers do. Therefore, TV Navigator’s JavaScript interpreter may run up against memory constraints not encountered on a typical computer. • Errors. For the sake of robustness, TV Navigator’s JavaScript interpreter stops executing a script, a handler, a javascript: URL, or the code triggered by a timeout when it encounters certain errors. Any syntax error causes the interpreter to abort, as do run-time errors when continued execution risks referring to the object that caused the error or to an object that the error damaged. For example, if a script calls a nonexistent function, it’s likely that none of the code following the function will be executed. This practice keeps TV Navigator in a sensible state when it encounters deviant scripts, but may cause some JavaScript to be nonfunctional. • Maximum size of a number. TV Navigator stores integers as 31-bit signed entities. Therefore, the maximum value of an integer is 230 – 1, a large number but not as great as you might have experienced in other environments that use 32-bit entities. This maximum also applies to the length of arrays (though you’d probably run out of memory long before the reaching the maximum array length). It does not apply to floating-point numbers. • Access control. TV Navigator uses lists of trusted URLs—rather than signed scripts or the data-tainting security model—to regulate access to particular JavaScript objects, properties, and methods in the API. See “JavaScript Security,” next, for more on TV Navigator’s substitutes for signed scripts. Appendix B, “JavaScript Catalog,” has more information on how TV Navigator’s implementation of particular JavaScript objects, methods, and properties differs from the Netscape implementation. JavaScript Security Client-side JavaScript follows a set of policies that prevent it from revealing private information about the user and otherwise wreaking havoc on the client machine. For example, it won’t let a document in one window or frame learn anything about a document in another window or frame, unless both documents come from the same server and were downloaded using the same protocol. This is sometimes called the same-origin principle. Similarly, the only cookies that JavaScript will reveal are those that belong to the current user. And there are precise rules governing which pages can view which cookies. (They’re discussed under “Cookie Objects” on page 65.) TV Navigator’s implementation of JavaScript follows these standard policies. 6 Content Developer’s Reference JavaScript Security Access to the API Some JavaScript restrictions limit access to sensitive parts of the standard API. For example, an ordinary script cannot close a window the user opened, examine the history list, name a file to be uploaded, or move a window off-screen. These restrictions are imposed on particular objects, properties, and methods—such as the properties of the History object. Netscape Navigator regulates access to sensitive API through signed scripts. A script requests access privileges, and the browser confers or denies them based on a digital “signature” associated with the script. Like Netscape Navigator, TV Navigator honors the standard restrictions on protected JavaScript elements. However, it uses lists of trusted Web sites, rather than signed scripts, to do it. In addition, TV Navigator protects many of the JavaScript extensions documented in this manual. These extensions provide some fairly powerful facilities for building TV-centric applications, managing resources and users, and controlling the set-top box. They could easily be abused, whether intentionally or inadvertently. For example, it would be possible for a script to turn video output to the TV screen off and leave it off, or make all Web content transparent to television, or respond maliciously to input from the remote control. For this reason, TV Navigator limits access to particular objects, functions, and variables in the extended API. The limitations apply at either of two levels, which this manual labels controlled and exclusive. Controlled API elements grant access only to trusted Web sites—sites with URLs that the service provider has entered on an access control list. Exclusive API elements are more narrowly focused; they grant access only to the Service Manager and closely allied services in the master application. Pages that have access to “exclusive” API elements are automatically trusted for everything, so can also access all “controlled” API elements. Controlled API: Access Control Lists TV Navigator uses access control lists (ACLs)—lists of trusted Web sites—to regulate access to “controlled” API elements. The lists identify Web sites by their URLs. If the URL of a page executing JavaScript matches a URL on the list, it is granted access to the API the list protects. If not, it is blocked. In principle, there can be many access control lists, each one regulating access to a different set of API elements. In practice, there are currently just three lists: • A principal ACL that covers most restricted API elements. • A minor ACL that allows access to a more limited set of API elements than the principal list. Currently, membership on this list is required to do just two things: to close a window (the Window.close() method) and to modify a shared object (for example, by setting one of its Chapter 1: Introduction 7 JavaScript Security properties). See “Modifications” earlier in this introduction for a discussion of shared objects and “Access to Shared Objects,” later, for more on how they’re protected. • A privacy ACL that regulates access to private information about the user, particularly information about which Web sites the user has visited. Currently, membership on this list is required to access critical properties and methods of HistoryEntry objects. It also permits pages to overcome the same-origin restriction and access the properties of a Window object from which they would otherwise be barred. There’s no connection between the three lists. To be granted access to all three sets of API, a Web page must match a URL on all three ACLs. However, the wizard that adds URLs to the lists will automatically place a URL on the minor list if it’s added to the principal list with both reading and writing privileges (see “Trusted for Reading or Writing,” later). Calculating a Match URLs on an access control list have the following form: protocol://host[:port][/path] The square brackets are meant to indicate that the port and path are optional; the protocol identifier and host name are required. (The host and port taken together are also referred to as the domain.) For a Web page to be granted access to a protected API element, each part of its URL must match the corresponding part of a URL on the list—and match exactly. If the URL on the list lacks a port specification, all ports match. If the URL on the list lacks a path, all paths match. For example, if the listed URL is http://servo.acme.com, these URLs would match: http://servo.acme.com/tvapps/games/index.html http://servo.acme.com:2345/logs/ However, these would not: https://servo.acme.com/tvapps/games/index.html (different protocol) http://www.servo.acme.com/tvapps/games/index.html (different host) If the listed URL is http://servo.acme.com:2345/index.html, only an identical URL would match, since the port and path are specified. There’s no theoretical limit on the number of entries in an ACL, but practical considerations generally keep the lists relatively short. 8 Content Developer’s Reference JavaScript Security Setting Up the Lists The service provider determines which URLs are on which lists. Entries are added or removed from the lists using Liberate Command™ configuration wizards. Consult the System Administration Guide and System Integration Guide for information on the wizards and maintaining the lists. Access to Shared Objects Shared objects present a special security problem. Theoretically, it would be possible for a malicious page to set a shared value that produced unexpected behavior or damaged other pages. A page could even install a trojan horse that would remain after it had been unloaded. Therefore, setting any property or array element of a shared object is protected by the minor ACL. This protection is universal; it applies to all shared objects without exception. In some cases, properties of shared objects are given more specific protection, typically by the principal ACL. This leads to a situation where both the minor ACL and the principal ACL control access to a property. In this case, the two lists act independently of each other: A URL must match entries on both lists to be granted access. Shared objects were discussed earlier, in the “Modifications” section. Trusted for Reading or Writing A variable can be restricted only for reading, only for writing, or for both reading and writing. Typically, the restrictions apply to both reading and writing. However, it’s not uncommon for a variable to allow anyone to read it while an access control list regulates who can write it. The principal ACL is actually bifurcated into two sublists, one for reading and one for writing. If this list controls a variable for both reading and writing, a page must match a URL on its reading sublist to be able to get the variable’s value and a URL on the writing sublist to be able to set its value. It’s quite possible that a page that reads the variable may not be able to write it, or vice versa; it depends on which URLs are on which sublists. The privacy and minor ACLs are not similarly divided. In each case, the same list regulates both reading and writing. Functions can also be protected by an access control list. To call a function that’s protected by the principal list, a page may have to match an entry on the reading sublist, the writing sublist, or both sublists. It depends on the function. Generally, if the function simply supplies some Chapter 1: Introduction 9 Defining Event Handlers information, pages that are trusted for reading can call it. If the function alters an internal state or does something more complicated, usually only pages that are trusted for writing can call it. Note: Access-control permissions don’t override the basic readability or writability of a variable; a Web site that’s trusted for writing cannot write a read-only variable. Exclusive API: the Service Manager’s Domain At the “exclusive” level, access is reserved for pages that the service provider trusts completely and sanctions to do anything. TV Navigator confines exclusive access to pages coming from the server that hosts the Service Manager, the first application that’s loaded when the set-top box is turned on and the application in charge of the overall user interface for the client. Access is granted to any page that has precisely the same domain as the Service Manager, and denied to all others. Protocols and paths are ignored, but the domain must be an exact match. For example, if the first page that TV Navigator loads has this URL, http://resapp.insider.co.uk/index.html any page that shares the resapp.insider.co.uk domain is admitted. All others are excluded—even pages from derived domains (such as sub.resapp.insider.co.uk). If a domain name server (DNS) maps another URL, say http://resapp/index.html, to the resapp.insider.co.uk domain, it too will be excluded; the original URL doesn’t match the Service Manager’s domain. Generally, a core set of services is installed on the same server as the Service Manager. For example, all the standard services that come with TV Navigator share the Service Manager’s server. Therefore, in practice, “exclusive” rights are bestowed on all the services that make up the master application, not just the Service Manager. “Exclusive” access is not partitioned between reading and writing sublists. Pages that enjoy “exclusive” rights enjoy them for both reading and writing. Any Web page that has access to “exclusive” API also has access to “controlled” API—for both reading and writing. In other words, pages with “exclusive” rights are free to do whatever they wish. Defining Event Handlers Typically, the body of an event-handler function is defined in HTML. But handlers can also be defined in JavaScript. In some cases, they must be defined in JavaScript because they belong to objects (like NetRequest and UserManager) that don’t have HTML counterparts. 10 Content Developer’s Reference Defining Event Handlers In HTML, event handlers are defined as strings of JavaScript code. However, in JavaScript, they should be defined as functions. To clarify the difference, let’s start with a typical definition of a handler in HTML: This definition produces the following handler for the Window object: function onvisible() { if ( window.visible == true ) checkStatus(); } In JavaScript, you would define a similar function, function myOnVisibleFunction() { if ( window.visible == true ) checkStatus(); } and assign it to the handler: window.onvisible = myOnVisibleFunction; Some handlers take arguments. When you define the handler as a string in HTML, those arguments are accessible as well-known names within the scope of the handler. For example, the following definition for the Table object’s onfocus() handler refers to the row and column of a table cell: This definition would produce the following JavaScript function: function onfocus(row, column) { updateRow(row); updateColumn(column); } If you define the handler directly in JavaScript, you must implement a function with the same set of arguments and assign it to the handler property, as shown in the next example. Chapter 1: Introduction 11 Organization of this Manual function doFocus(row, column) { updateRow(row); updateColumn(column); } document.myTable.onfocus = doFocus; When defining a handler as a function in this way, you control the argument names. The following code may be less informative than the previous example, but it works just as well: function doFocus(cabbage, brusselsSprouts) { updateRow(cabbage); updateColumn(brusselsSprouts); } document.myTable.onfocus = doFocus; However, when you define a handler as a string, you control only the body of the function. The names of the arguments are fixed in the underlying code and you must conform to those names (row and column for the Table.onfocus() handler). Organization of this Manual This reference manual is divided into topic-based chapters—for example, one on dynamic tables and another on the network. Some chapters, like those on system capabilities and user management, describe an API that is designed primarily for the Service Manager and the core set of essential services that make up the master application. Others are less restricted. Within each chapter, the API is organized alphabetically—for example, the Textarea object precedes the Window object, even though the Window object is arguably more important. The chapters and appendixes are as follows: Chapter 1: Introduction The chapter that you’re now reading. Chapter 2: TV Display The HTML adaptations that enable Web pages to incorporate television and “fit” the TV screen. This chapter also documents the Display and Speaker objects that regulate all output from the set-top box to the TV set, including both television and Web content. 12 Content Developer’s Reference Organization of this Manual Chapter 3: Extending the Standard API Modifications to standard HTML tags and JavaScript objects—such as the History, Document, Navigator, Textarea, and Window objects. The Navigator object is the entry point for most of the Liberate additions to client-side JavaScript. Chapter 4: Dynamic Tables The HTML and JavaScript extensions that make tables dynamic. Users can navigate through a dynamic table and select desired cells. The table responds to the user through handlers that can modify the content and appearance of the cells. Chapter 5: The Network The JavaScript objects that provide a direct handle on the connection to the Internet and the cache of downloaded data. Applications can initiate requests (HTTP requests, for example) that are not tied to the user interface, so downloaded data isn’t automatically displayed to the user. They can also set up sessions for chat or for receiving broadcast data. Chapter 6: TV Information and Control The JavaScript extensions that provide control over the incoming video signal and information about the programs the signal carries. There are objects corresponding to TV tuners (input sources), channels, and programs. In addition, there’s a TvInfo object for the sub that provides information about TV programs, a VodSession object for video on demand, and a ConditionalAccess object for the conditional-access system that lets users purchase premium channels and pay-per-view programs online. Chapter 7: System Capabilities Additions that expose system capabilities to JavaScript—for example, the ability to read and set indicator lights on the set-top box, the ability to see and respond to input from a remote control device or keyboard, and the ability to respond to control messages from the platform or cable system. Chapter 8: Users and Services The JavaScript interface for managing users and the data associated with users, including the objects that represent deployed applications and other services that might be available to the user. Chapter 9: Content Data Types A listing of all the MIME media types that TV Navigator handles—such as “image/jpg” and “audio/wav”—plus notes on some of the types. Chapter 10: Protocols A reference to all the public protocols that can be used in URLs understood by TV Navigator, including tv: and mcast:. Chapter 1: Introduction 13 Notation Appendix A: HTML Catalog A catalog of all the HTML tags and attributes that TV Navigator supports, including both standard elements and the extensions for Interactive TV. Appendix B: JavaScript Catalog A catalog of all the JavaScript that TV Navigator supports. The catalog lists all of standard JavaScript through version 1.2 and indicates which elements are supported or not supported. It also lists the Liberate extensions. Appendix C: Key Codes The key codes for the JavaScript Input object. Appendix D: Playing Sounds Notes on how content designed for TV Navigator can play sounds. Most of the Liberate extensions to JavaScript are organized into objects represented as readonly properties of the Navigator object. To get an overview, begin with “Navigator Object Additions” on page 85 and the chapter introductions. Notation This manual divides API descriptions into the following sections: SYNOPSIS: A shorthand description of the API element—showing the range of attribute values for HTML and expected data types, read/write permissions, and security restrictions for JavaScript. A full description of the HTML tag or attribute, or of the JavaScript property, method, or event handler. Notes on any variations in how the different releases of TV Navigator implement the API element under consideration. A short description of any access restrictions the API element is subject to—for example, which access control lists regulate access. Notes on when the function or variable was introduced, modified, or deprecated. The baseline for these notes is TV Navigator–S version 1.1. Only changes subsequent to release 1.1 are noted. DESCRIPTION: VARIATIONS: ACCESS: HISTORY: 14 Content Developer’s Reference Notation AVAILABILITY: Notes on the availability of the API element, in cases where it has not been fully implemented. References to other relevant sections of the documentation. SEE ALSO: The SYNOPSIS and DESCRIPTION sections are always present. The others appear only where relevant. The AVAILABILITY sections will disappear as the API becomes fully implemented. JavaScript Data Types In this manual, JavaScript API is shown using the five canonical JavaScript data types, boolean number string object function plus void to indicate the absence of an argument or meaningful return value. For example, a function might be listed as follows: number doSomething(string name) This function will treat the argument it’s passed as a string and return a number. However, since JavaScript is an “untyped” language, these type designations don’t constrain the kinds of data you can pass to the function or what you can do with its return value. They are meant only to indicate how the function will regard the argument you pass it and what sorts of values it returns. Read/Write Permission JavaScript variables are marked “read-only,” “write-only,” or “read/write” to indicate whether they can be, respectively, examined but not modified, modified but not examined, or both examined and modified. In addition, “controlled-” and “exclusive-”are prepended to “read” and “write” if these operations are restricted to pages originating from a trusted site or are reserved exclusively for the Service Manager and the services that share its domain. Chapter 1: Introduction 15 Notation Here are a few examples: read/write string controlled-read-only object read/controlled-write number exclusive-read/exclusive-write string A string that can be read or written by anyone An object that cannot be written and can be read only by trusted pages. A number that can be read by anyone, but written only by trusted pages. A string that can be read and written only by pages from the domain of the Service Manager Functions are also marked “controlled” if they’re successfully invoked only from trusted sites and “exclusive” if they’re reserved for pages from the Service Manager’s domain. For example: exclusive boolean switchToUser(object user, string password) controlled object findChannel(string property) The ACCESS section explains which of the three access control lists—primary, minor, or privacy—regulates access to variables and functions marked “controlled.” Functions and Event Handlers In general, the read/write distinction isn’t very meaningful for JavaScript functions (except when it comes to deciding which pages have permission to call a “controlled” function, as described under “Trusted for Reading or Writing” earlier in this chapter). You generally wouldn’t “write” a function that’s in the API—modify what it does or what the function name means. If you do, all bets are off. The documented API will no longer be valid and the results won’t be guaranteed. However, event handlers—functions that are called to notify you that something has happened—are an exception. You can define event handlers, but generally shouldn’t call them since they’re typically called in a context that your code cannot duplicate. They are therefore the opposite of ordinary functions in the API, which you call but don’t define. For this reason, this documentation uses the term handler to mark functions like onload() and onkeyout() that serve as event handlers—or, more accurately, to mark the properties that hold event-handler functions. Following JavaScript tradition, the names of event handlers all begin with “on” and are entirely lowercase. 16 Content Developer’s Reference Notation Object and Array Types This document follows the standard convention of using a capitalized name to represent a type of JavaScript object—for example, “Navigator” for the kind of object represented by [window.]navigator—even if there is only one such object and the type name never shows up in JavaScript code. To distinguish between ordinary objects and those that can be indexed, the term array is used to describe an object whose properties can be accessed using the [ ] operator with numerical indexes. In some cases, the elements of an array can also be accessed by name. For example, all three lines of the following code might retrieve the same item: var first = vegetables[7]; var second = vegetables["squash"]; var third = vegetables.squash; This behavior is usually reserved for arrays that hold named objects. The name can be used to retrieve the object from the array and, if it doesn’t contain any characters not allowed in identifiers, also acts as a property of the object. Client-side JavaScript employs this type of array in a number of prominent places—such as the Document.images, Navigator.plugins, Window.frames, and Document.forms arrays. Currently, the Liberate extensions use it in the following places: Window.navigator The Liberate additions to the Navigator object Document.cookies An array of named Cookie objects Navigator.indicators An array of named Indicator objects Navigator.tvTuners An array of named TvTuner objects UserManager.users An array of named User objects TvInfo.indexes An array of named TvInfoIndex objects Chapter 1: Introduction 17 Notation Font Conventions This manual uses the following conventions for marking special categories of text: Category Literal strings Type Style plain text in quotation marks Examples “640” “darkcyan” “audio/wav” “#00FFFF” findChannel() true bgColor Document MimeType ProgramStream TvChannel setName(string name, boolean flag) max-age=seconds send(object netEvent, string options) var netter = new NetRequest();
for ( i=0; i < length; i++ ) Keywords and API elements bold and sans-serif (but plain text and sansserif in tables) plain text and capitalized Object classes Arguments to JavaScript functions and other variables Code examples italic and sans-serif fixed-width font File and path names, italic URLs, and protocol names waterfalls.jpg /food/dairy/cheese/italian.html tv: http://www.somesite.com/dir mcast://provider/carousel 18 Content Developer’s Reference TV Display CHAPTERM 2 Displaying Web pages on a TV screen opens some opportunities for content providers and requires some adjustments. The opportunities mostly lie in combining Web content with television. The adjustments arise from the limitations of TV sets as display devices and the circumstances under which people watch TV (these issues are discussed in Chapter 4 of the Content Developer’s Guide). This chapter looks at how TV Navigator implements HTML and JavaScript to deal with both the opportunities and the adjustments. Three groups of HTML adaptations are discussed: • Additions that allow Web pages to include television in the background. • Additions that facilitate cursorless navigation (since users don’t have a mouse, but press arrow keys to move a focus rectangle from item to item). • Reinterpretations of standard tags so that TV Navigator can achieve an optimal on-screen display—larger fonts and automatic image scaling, for example. Some JavaScript objects have been amended for similar reasons. For example, the Link object has been given focus() and blur() methods so that pages can manage where the focus is located—for example, place the initial focus on a link. Two objects provide a measure of control over output from the set-top box to the TV set. The Display object provides information about the display device—for example, the video format and size of the safe area—and lets you control some aspects of the video display. In much the same way, a Speaker object controls audio output. Chapter 2: TV Display 19 TV Display 20 Content Developer’s Reference HTML for TV Display Interactive TV requires some enhancements to HTML. A few additions are required simply to let television and Web content coexist on the same page. Others are needed to make pages lay out better on a TV screen. Still others take into account the fact that the user doesn’t have a mouse at hand (and perhaps not a keyboard), but is using a hand-held remote to interact with the software. The sections that follow discuss each of these enhancements, plus places where TV Navigator treats standard HTML tags and attributes somewhat differently than other browsers. Television in the Background Mixing Web content with television requires additional HTML control over how the two are integrated on the same page. The general strategy is to put the TV image in back of Web content and, through the selective use of transparency, let some of it show through. The TV image is placed on a page with the tv: URL, as discussed in the Content Developer’s Guide and in Chapter 10, “Protocols” of this manual. Frameset Background SYNOPSIS: You can put television in the background of any window or frame by assigning the tv: URL to the background attribute of the tag for the document the window or frame displays: DESCRIPTION: So that the same syntax can be used for a window that has been subdivided into frames (or a frame subdivided into other frames), the tag has been extended to take a background attribute of its own. It works exactly like the background attribute for tags, except that television is the only type of image that can be assigned to a frameset background: Chapter 2: TV Display 21 HTML for TV Display Then, if the tag for any document in a frame specifies a transparent background color, as discussed in the following section, the television picture will show through in that frame. SEE ALSO : “tv:” on page 383 Transparent and Opaque Backgrounds SYNOPSIS: