Developing Widgets for Chumby: Insignia TV

Overview
http://files.chumby.com/wikiimages/deviceimages/insigniactv.jpg

The Insignia Connected TV is the first TV to support the chumby app network. This TV uses a Flash player known as Stagecraft 1.2, which is similar to Flash Lite 3.1. The capabilities of this Flash player are similar to those of desktop Flash player 8, meaning it uses AVM1 (ActionScript 2). When creating applications with standard Flash tools, it's recommended to set the publish settings to Flash 8, but avoid "filters" and "blend modes", which are not supported in Flash Lite.

Screen resolution
The TV's screen resolution as seen by a Flash application is 960*540. The apps are typically displayed in one of two states:
 * In a 600*450 window, along with a small view of the current TV program in the upper right corner of the screen
 * In a 684*130 non-interactive "preview", beneath a larger view of the current TV program

In order for your application to be usable in both modes, 2 swfs should be uploaded, one of which should have a stage size of 684*130. The system will detect the swf dimensions and display the correct one based on the current mode.

Remote control input
The directional keys on the TV's remote control are received as standard (Up, Down, Left, Right, and Enter) keys by the application. In addition, the apps have access to 4 special keys labeled A-D on the remote, and a few other useful keys, listed below along with their key codes: var KEY_C:Number = 0x100001f; var KEY_D:Number = 0x1000020; var KEY_A:Number = 0x1000021; var KEY_B:Number = 0x1000022; var CHANNEL_UP:Number  = 0x1000004; var CHANNEL_DOWN:Number = 0x1000005; var THUMB_UP:Number    = 0x2000007; var THUMB_DOWN:Number  = 0x2000008;

Full-screen media-enabled applications
By default apps are not able to play audio or video, because there could be a conflicting video window already present in a corner of the screen. An app can send a request to the Control Panel (CP) to be relaunched with audio/video enabled. The request is sent via Flash's LocalConnection mechanism, and allows the application to specify parameters that it will receive as _root variables once it's relaunched. These are the relevant constants:

var LC_NAME:String = "_chumby_lc";  // connection name var LC_RELAUNCH_AV:String     = "relaunch_av";  // request to be relaunched with audio/video enabled (600*450) var LC_RELAUNCH_AV_FULL:String = "relaunch_av_full"; // request to be relaunched with a/v at full-screen (960*540) var LC_RELAUNCH_NO_AV:String  = "relaunch_no_av";   // request to be relaunched without a/v enabled (600*450)

Here is an example:

var lc = new LocalConnection; lc.send(LC_NAME, LC_RELAUNCH_AV, { param1:"something", param2:"something else" } );

Saving temporary and permanent state
Apps can also use the LocalConnection mechanism to send up to 384 characters of temporary state information to the CP. The CP will pass that string to the app using the variable _root._chumby_widget_state when starting up the app. State information gets cleared when the user switches to a different channel, so more permanent configuration variables should be stored on the server using the standard widget parameters mechanism. Here is an example of sending state information to the CP:

lc.send("_chumby_lc", "app_state", _root._chumby_widget_instance_id, stateInformationString );