November 30, 2007

Flex: More on WebOrb

Filed under: Flex — Steve @ 4:17 PM

Writing about web page http://www.themidnightcoders.com/weborb/

More on WebOrb: I emailed MidnightCoders and got an encouraging response. I was particularly interested to find out that the Flex for Java release will soon include support for RTMP. Combined with AMF3 and Spring support, this makes it a strong alternative not just to LiveCycle but also to Red5 and Wowza Media Server – the critical factor may be cost.

November 29, 2007

Flex: Video Source Switcher

Filed under: Flex — Steve @ 12:55 PM

I’ve just written a basic MXML component that will switch between video sources in Flex, for a streaming application. Using the Camera class it’s possible to grab a list of connected/recognised devices and use this to switch the input source. Note that switching sources like this isn’t really recommended by Adobe, but it works anyway ;-)

For this example I’m creating a basic VBox with a List component and a Video instance. The component will show a list of sources and selecting a source will trigger the switch. Initially the component will use the default source (whatever is currently selected in the player Settings dialogue) to create a new Video instance, within a UIComponent container. The List component is populated via an array that looks up the sources using Camera.names.

<?xml version="1.0" encoding="utf-8"?>
<mx:VBox xmlns:mx="http://www.adobe.com/2006/mxml" width="300" height="400" creationComplete="setDefaultSource()">
<mx:Script>
<![CDATA[
import flash.media.Camera;
import flash.media.Video;
import mx.events.ListEvent;
import mx.core.UIComponent;
[Bindable]
private var sourceList:Array = Camera.names;
private var videoContainer:UIComponent = new UIComponent();
private var video:Video;
private var source:Camera;
private function setDefaultSource():void
{
video = new Video(160, 120);
source = Camera.getCamera();
video.attachCamera(source);
videoContainer.addChild(video);
addChild(videoContainer);
}
private function switchSource(event:ListEvent):void
{
videoContainer.addChild(video);
source = Camera.getCamera(String(sourceListComponent.selectedIndex));
video.attachCamera(source);
}
]]>
</mx:Script>
<mx:List dataProvider="{sourceList}" id="sourceListComponent" itemClick="switchSource(event)" width="100%"></mx:List>
</mx:VBox>

Couple of things to point out – firstly, when switching devices it’s important to recreate the Video instance using addChild() and then reattach the source to that – trying to switch the input without doing this will result in a crash.

Next, notice this line in the switchSource() handler:

Camera.getCamera(String(sourceListComponent.selectedIndex));

According to the Adobe documentation, selecting a source is done by name:

public static function getCamera(name:String = null):Camera

But for some reason this won’t work. Neither will passing in the index as a number as in Flash CS3. I was only able to fix this thanks to Andrew Trice’s multi-camera example – the index has to be passed as a String, i.e. “1”, so I’m just recasting the selectedIndex of the List to a String which seems to work fine.

Now all you need to is add a Microphone object and attach this and the Video source to a NetStream object to create a switched stream. There’s no need to recreate the NetStream when switching, just recreate the Video instance as shown. Combine this component with a screen capture driver like VHScreenCapture and you have a really simple way to switch between one or more webcams and/or your desktop.

November 27, 2007

Zoho and Google Gears: offline editing

Filed under: Uncategorized — Steve @ 1:56 PM

Writing about web page http://www.readwriteweb.com/archives/zoho_on_gears.php

Zoho, the online word-processor, now implements Google Gears to provide offline editing of documents within the browser.

If you’ve got Google Gears on your computer, you can download selected Zoho documents to your hard drive with just a click. The pages for those documents will then be accessible inside your browser, even with when you are not connected to the internet. Someday soon, the company says, the other Zoho apps will also be available offline as well.

Cool – although I’m still not totally convinced that there’s a great need for ‘occasionally-connected clients’ I used Zoho to write up my final year project and there was the odd time when I couldn’t access a hotspot. Now I’m using Buzzword a lot more (I prefer the interface), but an AIR version of Buzzword would be an interesting alternative.

Flex: LiveCycle Alternatives

Filed under: Flash,Flex — Steve @ 1:42 PM

Thanks to The Flex Show podcast last week, I was interested to hear about WebOrb, an alternative to Adobe’s LiveCycle. LiveCycle is the enterprise platform for what used to be Flex Data Services, allowing Flex applications to integrate closely with J2EE. LiveCycle ES adds a lot of powerful tools and suites to the core FDS packages and Adobe makes a free ‘Express’ server edition available, but this is limited to a single-processor. The full version costs thousands (if you can get a price – we’ve struggled to get one from Adobe UK) and I’ve seen many posts on forums from developers who find the cost of a multi-processor licence too prohibitive.

Granite and OpenAMF have been available for a while, both are free under an LGPL licence. Granite is currently at version 0.4. but it already promises some great features, including support for AMF3, EJB3, Spring and POJOs. OpenAMF is a development of AMFPHP, an older project and while it doesn’t seem to have some of the features of Granite it does support remoting and does the basics.

WebOrb is similar to Granite, except that the product family currently supports integration with a range of platforms, including .NET, Ruby On Rails, PHP and J2EE. The Java Standard Edition is available for free and provides support for AMF0, Java Beans EJBs and POJOs. There’s also a Yahoo Group for developers using WebOrb, Flex & AJAX.

November 1, 2007

Flash CS3: Swings and Roundabouts

Filed under: Flash,Flex — Steve @ 2:27 PM

Jamie from Big Spaceship made a comment on the BS blog recently that I can relate to having done quite a bit of CS3 scripting work this week, in preparation for a course I’m presenting on it soon.

Adobe Flash is unique in that the content you create with it is intrinsically artistic and programmatic. Even if you are working by yourself, design and development must work in harmony in order for a piece to reach its full potential. With ActionScript 3.0, Flash has become a far more powerful tool – and in some ways, far more intimidating.

Jamie is right on the button. I’ve spent time this week learning the new way of doing things and while I’ve enjoyed the realisation that, at long last, AS3 is a powerful and elegant way to get stuff done, the flip side is increased complexity and extra effort, which may be a problem for some people using CS3 who were maybe just about getting to grips with AS2 and/or have no idea about ‘proper’ OO programming (my audience). I’m trying to present material that avoids too much information about classes and objects while trying to give them the means to create basic interactivity and it’s actually quite tricky. My point I think is that for design-oriented users or newcomers to Flash, CS3 can be harder to get going with than past versions, and in this case what they lose on the swings may not necessarily be regained on the roundabouts, at least for a while.