Flash Lite and iRiver Clix development
Wednesday, December 27th, 2006
Continuing on my earlier post on Flash Lite and developing for iRiver devices, I thought it would be helpful to share some details from my experience with the Clix over the past several months. I’ve been working for a client on a commercial app, which for the typical legal reasons I can’t elaborate much on, but as the initial platform for the app is the iRiver Clix, I can share the technical obstacles I came up against while trying to get Flash Lite 2.0 to work on this device.
First, it’s worth mentioning that this application was multimedia heavy, in that the media involved included mp3 audio, flash video (flv), bitmap images, all driven by an external xml file that defined the structure and behavior of that media within the application. There have been a couple articles written on developing Flash Lite apps for the u10, which I’ve found to be more focused on a more self-contained “game” style of application, with a single swf running the show. If your focus is along those lines, definitely check these out.
Unfortunately, as I embarked on getting a proof of concept going on the Clix, I quickly found that the Flash Lite 2.0 “support” on this device was severely handicapped. I wouldn’t know just how handicapped until I’d pounded away at it for a while. For this post I’ll mostly hit on the unsupported features of the Clix FL 2.0 implementation, as I ran across them.
XML Support
A wonderful thing of Flash Lite 2.0 versus 1.1 is its support for the XML class. The Clix supports this class, however is does NOT support loading in XML data from an external file. In fact, and this will save you a lot of effort, the Clix essentially does not support loading of ANY external files with the exception of external swf and jpg/png files. And yes, while I’m on the subject, that means no loadVariables via external text files either. So, to use the XML class within your Clix application you will need to form the xml within your main code body. I simply brought it in via an include file that assigned the xml to a string, then formed the XML class object ala XML.parseXML(xmlString).
Video Support
There is no support of the Video Object in the Clix implementation of Flash Lite. Besides this, there is no support for playing flv video of any kind, loaded externally, embedded within your main swf application, embedded within an swf loaded externally, etc. This is somewhat surprising seeing as how the Clix is foremost an audio/video player, more so than its Symbian counterparts who have video playing quite happily via Flash Lite 2.1 these days.
Because of the client’s interest in trying to make video work, I briefly fell back on trying to do “keyframe” video based on a series of bitmap images, with a streaming audio track to keep sync, but the poor frame rate possible with this technique eventually proved unacceptable. The poor frame rate is due, by the way, both to the demands it puts on the processor to chug on all those images, and the memory limit of the Clix. Anything more than 1MB will definitely have you playing russian roulette with whether your media will play or fail on the Clix. The memory available is easily obtained via one of the fscommand2 calls: FSCommand2 (“GetFreePlayerMemory”). So while I was able to produce a few all-keyframe videos, the file size grew quickly above 1MB and the available memory of the Clix.
If your application absolutely called for video, it would be possible to produce pseudo-video clips as swfs, using still images, pan and zoom techniques, and streaming audio, that probably would yield acceptable results. But obviously the content would dictate how effective that solution would be.
MP3 Audio
It should be expected by now if you’ve been reading along what will be the case with trying to load up and play external mp3 audio files on the Clix. It won’t work is the short answer. The solution again is to simply wrap the audio in swf files and load them in as external swfs instead of mp3′s. As far as I can tell, the Sound Object is not supported on the Clix either, so forget controlling your audio with attachSound, setVolume, or the rest of that class’s methods.
Images
Happily, loading in of external jpgs and pngs seems to be supported, either through the old loadMovie or with the MovieClipLoader class. So, it’s not all doom and gloom.
Persistent Data
I saved the most interesting Clix conundrum for last. First, neither the u10 nor the Clix supports Shared Objects. That was to be expected for the u10, as it’s a FL 1.1 device. The iRiver folks were nice enough to make up for it on the u10 by adding a fscommand2 that went something like this, for setting persistent data:
status = fscommand2("SetPersistentData", "myData=" add myData);
and for retrieving that data:
status = fscommand2("GetPersistentData", "myData");
It actually works quite well on the u10. So much so that it didn’t even cross my mind that it might NOT work on the Clix.
But I should back up for a second, because you may be asking, who cares? The Clix is a FL 2.0 device, so Shared Objects are supported. Right? Unfortunately, the answer is again, no. No Shared Object support. When I found this out I wasn’t too alarmed, as I knew that I could fall back on the less robust but still workable SetPersistentData technique above.
Falling back on that technique sadly meant simply falling back on my a**. The SetPersistentData fscommand was no longer supported apparently, returning the -1 whenever called. I came up with a short-lived workaround that meant loading up an external swf published for FL1.1 (into level0) that successfully set the persistent data, while running within the Clix FL 2.0 player. However, as soon as that external file was unloaded and replaced with my main FL 2.0-authored swf, it would lose any link to that persistent data. So my workaround fell flat. I started to delve into odd combinations of FL1.1 and FL2.0 content to come up with a workaround, for the workaround, for the workaround…but gave up as deadlines loomed.
Summary
Despite all of these headaches, I’m still a fan of Flash on the iRiver u10, Clix, and other devices just because of the excellent design of the interface, quality of the audio/video (not Flash Lite of course) and the speed of the Flash apps that have been authored within the constraints of the device’s capabilities. In fact, if there had been a CDK available which defined these limitations, I would have much less to complain about.
The advantage of authoring Flash applications for the Clix is the availability of using classes, functions, and all the goodies not available to FL 1.1, while also getting things like MovieClipLoader, ButtonListener and such that make life a little easier as well. It is telling, however, that all the Flash Lite apps that ship on the Clix seem to be merely ported over from the u10, and in fact are probably the exact same swf’s.
I hope this post saves other iRiver Flashers some headaches, and some time. If I’ve made mistakes or left out anything glaring above, please comment with corrections or additions.