Difference between revisions of "Developing widgets for chumby"

From Chumby Wiki
Jump to: navigation, search
(Summary)
Line 8: Line 8:
 
* It does not support LocalConnection or XMLSocket.
 
* It does not support LocalConnection or XMLSocket.
 
* It does not support the Flash Communication Server
 
* It does not support the Flash Communication Server
* There are no device fonts
+
* There are no device fonts - all fonts must be embedded in the movie
 +
* Playback of external audio files (MP3, etc) are not yet supported.
  
 
Also important for developers to note is that the device's current input system is a touchscreen, meaning that mouseMove events will only occur while mouseDown (equivalent on current computers of only being able to move the mouse while holding a mouse button), which may/will have some effect on how your programs operate.  
 
Also important for developers to note is that the device's current input system is a touchscreen, meaning that mouseMove events will only occur while mouseDown (equivalent on current computers of only being able to move the mouse while holding a mouse button), which may/will have some effect on how your programs operate.  
Line 16: Line 17:
 
Developers should avoid "play" or "repeat" buttons, and whenever possible opt for as little complex interactions with Chumby as possible; it is recommended that widgets need no human interaction. Text entry should also be avoided whenever possible, as the Chumby's text input system is crude at the moment, and most methods of touch screen text input are covered by patents and thusly won't be included in Chumby. (Most on-screen keyboards need more space than Chumby has, or are designed to operate with a stylus, which is not recommended for use with Chumby).  
 
Developers should avoid "play" or "repeat" buttons, and whenever possible opt for as little complex interactions with Chumby as possible; it is recommended that widgets need no human interaction. Text entry should also be avoided whenever possible, as the Chumby's text input system is crude at the moment, and most methods of touch screen text input are covered by patents and thusly won't be included in Chumby. (Most on-screen keyboards need more space than Chumby has, or are designed to operate with a stylus, which is not recommended for use with Chumby).  
  
Widgets are given a block of XML containing name/value pairs that are configured by the user on the website to set parameters for the widget. For instance, a stock widget would get a list of stock symbols in that XML.
+
=Widget Environment=
 +
Widgets are given a set of parameters about the environment of the chumby: For example:
  
At the moment, the widget has a security sandbox similar to a movie running in a standalone player on a PC, however, one should build widgets assuming that the movie is running in a regular Flash plugin, running from a website - an external source of content should have an appropriate crossdomain.xml file to expose content to the widget. One should also build widgets so they can be loadMovie()'d into another "virtual chumby" movie at some level other than _root - this means you should try to avoid adding random properties to _root or the built-in objects.
+
this['_chumby_movie_url']='http://www.chumby.com/xml/movies/12345678-1234-1234-1234-123456781234'
 +
this['_chumby_chumby_id']='87654321-4321-4321-4321-432187654321'
 +
this['_chumby_chumby_name']='TestChumby'
 +
this['_chumby_profile_id']='ABCDEF12-ABCD-ABCD-ABCD-ABCDEF12345678'
 +
this['_chumby_profile_name']='Default'
 +
this['_chumby_user_id']='FEDCBA9876-FEDC-FEDC-FEDC-FEDCBA98765432'
 +
this['_chumby_user_name']='johndoe'
 +
this['_chumby_widget_instance_href']='http://www.chumby.com/xml/widgetinstances/12121212-1212-1212-1212-121212121212'
 +
this['_chumby_widget_instance_id']='12121212-1212-1212-1212-121212121212'
 +
this['_chumby_base_url']='http://www.chumby.com'
 +
 
 +
A widget that has a configuration dialog may create additional values - for instance, a horoscope widget might create:
 +
this['sign'] = 'Scorpio'
 +
 
 +
=Security=
 +
The widget has a security sandbox similar to a movie running in a browser plugin - an external source of content should have an appropriate '''crossdomain.xml''' file to expose content to the widget. For more information, please see the following Flash Player Technotes and Articles:
 +
* [http://www.adobe.com/cfusion/knowledgebase/index.cfm?id=tn_14213 External data not accessible outside a Macromedia Flash movie's domain]
 +
* [http://www.adobe.com/devnet/flash/articles/fplayer_security.html Security Changes in Macromedia Flash Player 7]
 +
 
 +
One should also build widgets so they can be loadMovie()'d into another "virtual chumby" movie at some level other than _root - this means you should try to avoid adding random properties to _root or the built-in objects.
  
 
In general, widgets should be under 100K in size in order to reduce download time and use the minimum of storage in the device itself.
 
In general, widgets should be under 100K in size in order to reduce download time and use the minimum of storage in the device itself.

Revision as of 17:54, 20 October 2006

Summary

Widgets for the Chumby are developed for Adobe Flash Lite 2, possibly with Flash Lite 2.1 being used in the future. Flash Lite 2 has a feature-set like that of Flash 7, meaning no Flash video (as the device alone isn't fast enough to play back video at a usable rate anyhow, though future implementations may allow for the use of the Alpha Chumby's processor's hardware accelerator for video).

As of right now,

  • PNG and GIF image format aren't included. This could change in the future.
  • Progressive JPEG support isn't included.
  • It does not support video (Sorenson or On2) or Nelly Moser audio
  • It does not support LocalConnection or XMLSocket.
  • It does not support the Flash Communication Server
  • There are no device fonts - all fonts must be embedded in the movie
  • Playback of external audio files (MP3, etc) are not yet supported.

Also important for developers to note is that the device's current input system is a touchscreen, meaning that mouseMove events will only occur while mouseDown (equivalent on current computers of only being able to move the mouse while holding a mouse button), which may/will have some effect on how your programs operate.

For efficiency's sake, Flash Lite downsamples images and embedded fonts, so avoid resizing images and small serif fonts, as detail will be lost.

Developers should avoid "play" or "repeat" buttons, and whenever possible opt for as little complex interactions with Chumby as possible; it is recommended that widgets need no human interaction. Text entry should also be avoided whenever possible, as the Chumby's text input system is crude at the moment, and most methods of touch screen text input are covered by patents and thusly won't be included in Chumby. (Most on-screen keyboards need more space than Chumby has, or are designed to operate with a stylus, which is not recommended for use with Chumby).

Widget Environment

Widgets are given a set of parameters about the environment of the chumby: For example:

this['_chumby_movie_url']='http://www.chumby.com/xml/movies/12345678-1234-1234-1234-123456781234'
this['_chumby_chumby_id']='87654321-4321-4321-4321-432187654321'
this['_chumby_chumby_name']='TestChumby'
this['_chumby_profile_id']='ABCDEF12-ABCD-ABCD-ABCD-ABCDEF12345678'
this['_chumby_profile_name']='Default'
this['_chumby_user_id']='FEDCBA9876-FEDC-FEDC-FEDC-FEDCBA98765432'
this['_chumby_user_name']='johndoe'
this['_chumby_widget_instance_href']='http://www.chumby.com/xml/widgetinstances/12121212-1212-1212-1212-121212121212'
this['_chumby_widget_instance_id']='12121212-1212-1212-1212-121212121212'
this['_chumby_base_url']='http://www.chumby.com'

A widget that has a configuration dialog may create additional values - for instance, a horoscope widget might create:

this['sign'] = 'Scorpio'

Security

The widget has a security sandbox similar to a movie running in a browser plugin - an external source of content should have an appropriate crossdomain.xml file to expose content to the widget. For more information, please see the following Flash Player Technotes and Articles:

One should also build widgets so they can be loadMovie()'d into another "virtual chumby" movie at some level other than _root - this means you should try to avoid adding random properties to _root or the built-in objects.

In general, widgets should be under 100K in size in order to reduce download time and use the minimum of storage in the device itself.

Testing a widget locally

  • Get a USB dongle, formatted as VFAT, and put your Flash movie on the top level.
  • Create a file on the dongle called "debugchumby" with the contents
#!/bin/sh
/usr/bin/chumbyflashplayer.x -i <name of flash file>.swf
  • Plug the dongle into the USB port on the back of your chumby
  • Power it up - after the opening animation, your widget should run