Multicast Streaming in Flash Player 10.1 revisited

Yesterday a student from my class ask me to help him solve a problem that was getting when testing Tom Krcha’s example files of his Multicast Streaming tutorial. Here’s the fix.

Yesterday a student from my class ask me to help him solve a problem that was getting when testing Tom Krcha’s example files of his Multicast Streaming tutorial, the files he was using were the same included in Tom’s tutorial except for the Stratus Developer Key so after looking at the video tutorial included and testing the examples files You’ll get this error:

?View Code ACTIONSCRIPT3
1
2
3
4
5
Error: Error #2154: The NetStream Object is invalid.  This may be due to a failed NetConnection.
	at flash.net::NetStream/invoke()
	at flash.net::NetStream/attachCamera()
	at Broadcaster/setupStream()[C:\Users\Dave\Adobe Flash Builder 4\Broadcaster\src\Broadcaster.mxml:67]
	at Broadcaster/netStatus()[C:\Users\Dave\Adobe Flash Builder 4\Broadcaster\src\Broadcaster.mxml:50]

The error is pretty descriptive and what is saying is that was the NetStream was not getting the Camera signal or received a null value when trying to attach it.

The reason that this was happening is because in the NetStatusEvent Listener inside the switch statement we are using the event.info.code = “NetConnection.Connect.Success”; both for the Connection and the Stream

?View Code ACTIONSCRIPT3
1
2
netConnection.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
stream.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
?View Code ACTIONSCRIPT3
1
2
3
4
5
6
7
8
9
10
private function netStatus(event:NetStatusEvent):void{
	   writeText(event.info.code);
 
	   switch(event.info.code){
	            case "NetConnection.Connect.Success":
		    setupStream();
                    break;
		}
 
}

And on the setupStream() function we are trying to attach the camera and thats what throws the error cause we are using the “NetConnection.Connect.Success” to call this function.

?View Code ACTIONSCRIPT3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
private function setupStream():void
{
      var groupspec:GroupSpecifier = new GroupSpecifier("myGroup/multicastOne");
      groupspec.serverChannelEnabled = true;
      groupspec.multicastEnabled = true;
 
      stream = new NetStream(netConnection,groupspec.groupspecWithAuthorizations());
      stream.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
 
       var cam:Camera = Camera.getCamera();
 
       stream.attachCamera(cam);
       stream.publish("multicast");
 
	video.attachCamera(cam);
}

The fix is pretty straightforward all You have to do is include a case for the event.info.code: “NetStream.Connect.Success” and thats where we attach the camera to our stream.

?View Code ACTIONSCRIPT3
1
2
3
4
5
6
7
8
9
10
11
switch(event.info.code){
	case "NetConnection.Connect.Success":
	        setupStream();
	break;
	case "NetStream.Connect.Success":
	        var cam:Camera = Camera.getCamera();
	        stream.attachCamera(cam);
	        stream.publish("multicast");
	        video.attachCamera(cam);
	break;
}

And our setupStream() function will only define the GroupSpecifier and the NetStream:

?View Code ACTIONSCRIPT3
1
2
3
4
5
6
7
8
private function setupStream():void{	
	var groupspec:GroupSpecifier = new GroupSpecifier("myGroup/multicastOne");
	groupspec.serverChannelEnabled = true;
	groupspec.multicastEnabled = true;
 
	stream = new NetStream(netConnection,groupspec.groupspecWithAuthorizations());
	stream.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
}

Attaching camera / microphone after NetStream is connected, prevents you from following:

?View Code ACTIONSCRIPT3
1
Error #2154: The NetStream Object is invalid. This may be due to a failed NetConnection.

Click here to open my example, or here to download the flex project.

You should see Your Broadcaster and your Receiver getting along just fine.

Flash Platform Game Technology Center is Live

Flash game development has been around almost as long as Flash itself I remember the first thing I did with Flash was a very short animation and the second a little spaceship game I must have that .swf laying around in a backup somewhere, I’m really glad to see Adobe’s efforts in pushing the various “sections” of Flash development inside of the devnet.

The Flash Platform Technology Center aims to reach for those developers interested in Game Development using Adobe technologies( Aka: Flash, Flex, AIR  and AS3 ) it includes several beginner-advanced tutorials and links to various resources as documentation, cookbooks an other related development centers, the only thing I wonder is why this Technology Center wasn’t opened earlier being the Flash game development community as  big as it is( Hope some of the great Open Source Game related APIs get some spotlight in this place ), anyways it’s here now so get ready to start developing your first game if you haven’t already,  here are some excerpts and links from the Adobe Flash Platform Game Technology Center:

The Adobe Flash Platform is the leading platform in the world for developing games on the web. The Flash Platform Game Technology Center is a great place to start learning how to develop your very own Flash games.

FEATURED RESOURCES
Articles and tutorials

Community

Adobe Flash Platform ActionScript 3.0 Reference

Flash Platform ActionScript 3.0 Reference

This is a short post but a helpful one in case You haven’t noticed it The ActionScript 3.0 reference for the Adobe  Flash Platform it’s out of beta and works great letting You select and filter out your results by APIs, frameworks, platform and more, and its information it’s not only of ActionScript 3.0 but also for Flex, TLF,  AIR, LiveCycle, ColdFusion and more. So if you need help in finding some information and see the inner works of those API’s be sure to check it out, it’s a must have in any Developer library.

Flash News Roundup

Last week I had a trip to Mexico D.F. ,  and was very disconected from the Flash Community and the Blogs, so in an attemp to catching up with the Flash World here’s a news roundup of some of the things that I missed on the last week, in case you miss them too here’s a list :

1.- Adobe Wave

Adobe Wave

Adobe Wave it’s a new tool built in AIR that just got released as a beta in Adobe Labs, this tool let’s you stay updated on your favorite sites and it’s right at your desktop to stay update with some of the sites already working with Adobe you just click on the Get alerts with Adobe wave badges on those sites and you’ll start receiving updates from that site.

It’s seems a great way to get updated on your social network without even opening your browser nor navigating to various sites to get those updates will try it ant tell you how it went.

Some of the feature partners of Adobe are:

MySpace
Digg
AOL
Atlantic
Lastminute.com
Venture Beat
Variety
LiveStation
1000 Mikes
Evite
Qik
UstreamTv
Revision3
TheFind.com

Download here  by clicking in the Adobe Wave  Badge and try it yourself

2.- Adobe AIR 1.5.2

Adobe AIR 1.5

Adobe just released an update to AIR (Adobe Integrated Runtime ) to the version 1.5.2

You can download it here and read the release notes here.

This update includes  improved reliability, compatibility, and security. Listed below are various of this improvements:

3.- Adobe Flash Platform Blog  launched.

Flash Platform Blog

The official Adobe Flash Platform blog launched last week  if you’re a Flash Platform developer this will be a very helpful resource  you can read it here or grab the RSS feed.

If you still prefer the E-Mail Flash News Newsletter you can subscribe here.

4.- Open Source Media Framework.

Open Source Media Framework (OSMF), currently in public prerelease, enables developers to easily assemble pluggable components to create high-quality, full-featured playback experiences. The open aspect of the framework enables collaborative development for web video monetization, with lower costs and faster turnaround.

Open Source Media Framework complements and solidifies Akamai’s Open Video Player initiative,” said Tim Napoleon, chief strategist, of digital media at Akamai. “OSMF leverages code from Akamai’s Open Video Player and Adobe’s expertise and resources to assist media companies and publishers in redefining the benchmarks for online video experiences that are powered by standards based workflows.

  • OSMF is the open source part of the Strobe project that enables easy-to-build media players optimized for the Adobe Flash Platform
  • The flexible OSMF architecture enables developers to easily create unique playback experiences that can leverage plug-ins for advertising, reporting metrics and content delivery along with standard video player features such as playback controls, video navigation, buffering and Dynamic Streaming. OSMF provides standard functionality along with plug-ins from third parties so content providers have the flexibility to adapt monetization strategies to specific content and the needs of their audiences.
  • OSMF includes an API for partners to build plug-ins for value-add services. OSMF will enable more innovation around media experiences on the Web by allowing partners to easily experiment with new services for content providers, which spans content delivery, presentation and monetization.
  • OSMF source code and pluggable software components are available immediately under the Mozilla Public License and available at www.OpenSourceMediaFramework.com.

4.- Open Source Text Layout Framework

The Text Layout Framework is an extensible ActionScript library, built on the new text engine in Adobe® Flash® Player 10 and Adobe AIR 1.5, which delivers advanced, easy-to-integrate typographic and text layout features for rich, sophisticated and innovative typography on the web. The framework is designed to be used with Adobe Flex® or Adobe Flash Professional and is included in Flex 4, code named “Gumbo”. Developers can use or extend existing components, or use the framework to create their own text components.

See the feature tour and the online rich text editor demo on Adobe Labs.

5.- Adobe Flash Player 10.0.32.18 Update

This Update contains fixes for critical vulnerabilities identified in Security Bulletin APSB09-10 Flash Player update available to address security vulnerabilities. The update replaces the Debug and Release versions of Flash Player 10 browser plugins and standalone players that are included in the initial release of Flash CS4 Professional (player version 10.0.2.54). All users are encouraged to apply this update. These new players are version 10.0.32.18.

The Flash Player 10 updates are included in the ZIP file below. For instructions on how to update Flash CS4 Professional, please go to this technote.

I’m  sure I missed a lot more news but this post would be too long so until next Flash News Roundup, Thanks for reading.



.


Grupo W is Hiring

Grupo W is looking for ActionScript / Flex Developers if you’re interested don’t hesitate and send your CV here’s the Job info:

Company: Grupo W

Location: Saltillo, Coah. Mexico

Position: Flash ActionScript / Flex developer

wworks

Grupo W is looking for ActionScript / Flex Developers if you’re interested don’t hesitate and send your CV here’s the Job info:

Company: Grupo W

Location: Saltillo, Coah. Mexico

Position: Flash ActionScript / Flex developer

Information:

Mandatory technical skills:

• 3+ years experience in ActionScript 2.0 or 3.0 for Flash applications integrated with server-side web applications and CMS
• Papervision knowledge
• Experience implementing OOP concepts with ActionScript
• Experience integrating streaming media
• Building integrated data-driven applications
• Source control

Communication skills:

• Outstanding problem-solving and communication skills
• Available to work in-house during work hours – Monday – Friday
• Team player and leadership skills

Ideal additional skills:

• SWF address
• AIR
• Experience in building social networking and community systems, which include context and video tagging, streaming media and other advanced online communication features

Desired additional skills:

• Experience in PHP/MySQL
• CMS experience

To Apply:

Please send a copy of your CV with portfolio and examples of sites directly to rcalderon@grupow.com

New Facebook Adobe Developer Connection

Adobe Developer Connection Facebook

Adobe teams up with Facebook and releases new Adobe Developer Connection (Adobe Flash Platform and Facebook Platform ).
So if You where thinking on how to start developing  Flash Applications for Facebook you will find this site very useful.
It includes various how to start videos , useful information and a brand new ActionScript 3.0 Facebook API:
Get the API

Get started

Deliver rich, social experiences on the web

The Adobe Flash Platform and Facebook Platform provide the ideal solution for building rich, social experiences on the web. Flash is available on more than 98% of Internet-connected PCs, so people can immediately access the applications, content, and video that enable social interactions. The Facebook Platform is used by millions of people everyday to connect and share with the people in their lives. Together, both platforms allow you to:

* Share: Create rich interactions for users to share with friends.
* Have fun: Make games social; let users compete against their friends.
* Connect: Let users connect to your RIAs with Facebook Connect.
* Solve problems: Build RIAs that harness the power of community.
* Reach people: Reach millions of Facebook users through social distribution.

The new ActionScript 3.0 Client Library for Facebook Platform API, fully supported by Facebook and Adobe, makes it easy to build applications that combine the strengths of the Flash Platform and Facebook Platform.

Adobe Labs releases the beta of Text Layout Framework

Adobe Labs has released the beta of Text Layout Framework for Adobe® Flash® Player 10 and Adobe AIR® 1.5.   The Text Layout Framework is an extensible library, built on the new text engine in Adobe Flash Player 10, which delivers advanced, easy-to-integrate typographic and text layout features for rich, sophisticated and innovative typography on the web. The framework is designed to be used with Flash or Flex.

Together with the new text engine in Flash Player 10 and AIR 1.5, the Text Layout Framework delivers multi-lingual, print-quality typography for the web, including support for:

  • Bidirectional text, vertical text and over 30 writing systems including Arabic, Hebrew, Chinese, Japanese, Korean, Thai, Lao, the major writing systems of India, and others.
  • Selection, editing and flowing text across multiple columns and linked containers, and around inline images
  • Vertical text, Tate-Chu-Yoko (horizontal within vertical text) and justifier for East Asian typography
  • Rich typographical controls, including kerning, ligatures, typographic case, digit case, digit width and discretionary hyphens
  • Cut, copy, paste, undo and standard keyboard and mouse gestures for editing
  • Rich developer APIs to manipulate text content, layout, markup and create custom text components.
It appears that the new version of Flex “GUMBO” will already include the Layout Framework
For more info and examples visit Adobe Labs

Google Analytics Tracking for Adobe Flash

A new API for using  Google Analytics Tracking in Flash/Flex projects this API is developed in ActionScript 3.0 and can be used as a component or called in your ActionScript code, Google Analytics Tracking for Adobe Flash seems to solve a lot of troubles and the needed workarounds for making consistent user tracking in your Flash projects, keep reading for a more detailed explanation extracted from the implementation overview.

The Google Analytics Tracking for Adobe Flash component makes it easy for you to implement Google Analytics in your Flash-driven content. This component contains all of the functionality of the Google Analytics Javascript code, and is 100% compatible with the latest ga.js tracking code. The Flash Tracking component is a compiled tracking object native to ActionScript 3, making Analytics implementation intuitive in Flash, and Flex development environments.

You can develop Analytics Tracking for Flash in either Adobe Flash or Adobe Flex environments. Each environment requires a different component, which you can download from http://code.google.com/p/gaforflash/. These components are based on ActionScript 3 and can be set up in one of two ways for each environment:

In Adobe Flash

  • Add and configure a simple component in the component inspector and drag it to the stage.
  • Import the Flash Tracking libraries directly into your library and start coding.

In Adobe Flex

  • Include an MXML component that you configure from am MXML file.
  • Import the Flash Tracking libraries into your script tags/AS3 files.

How to use the Component in Adobe Flash

In order to use the Flash tracking component in your environment, you either use the visual tools inside Flash, or you set up the tracking object directly in your code. Regardless of whether you are setting up the component visually or via code, you provide the following elements:

  • the web property ID—This is also known as the UA number of your tracking code and looks like UA-xxxxx-yy, where the x’s and y’s are replaced with the numbers that correspond to your account and profile information for the object you are tracking. See Web Property for more information.
  • the tracking mode—Choose either bridge mode or AS3 mode. This mode determines how your tracking communicates with the Analytics servers and is described in detail below.
  • the debugging mode—No matter which environment or tracking mode you use, you can turn debugging on to validate and test your tracking.

Installation for Flash CS3

Before you begin to use gaforflash to add Analytics tracking within Flash CS3,
you first need to add the gaforflash SWC to Flash CS3.

To do so:
1. If you have Flash CS3 currently open, quit the application.

2. Navigate to the location where you unzipped the Google Analytics zip
and find the swc (e.g. lib/analytics_flash.swc).

3. Create a “Google” directory in one of the following locations
and copy the SWC file there:
– (Windows) C:\Program Files\Adobe\ Adobe Flash CS3\language\Configuration\Components
– (Mac OS X) Macintosh HD/Applications/Adobe Flash CS3/Configuration/Components

Flash CS3 is now set up to support Google Analytics Tracking For Adobe Flash.

Alternatively if you want to use gaforflash in code-only mode
you can do the same as the above and add the lib/analytics.swc,
you will then need to drag the “AnalyticsLibrary” component in your Library.

Installation for Flex Builder 3

Before you can compile your code, you will need to link it to the gaforflash SWC file.

To do so:
1. select Project->Properties.
A Properties dialog box will appear for your project.
Click on Flex Build Path and then select the Library Path tab:

2. Click Add SWC… within the Library Path pane.
An Add SWC dialog box will appear.
Navigate to the location where you unzipped the Google Analytics zip
and select lib/analytics.swc file and click OK.

or

Just drop the analytics.swc file into your Flex project /libs directory

Here’s the link for the Google code project

The gaforflash direct download

More info on the API

Cocomo new social app technology at Adobe Labs

There is a new Technology  available at Adobe Labs Codename “Cocomo” is a Platform as a Service that allows Flex developers to easily add real-time social capabilities into their RIA (rich Internet applications). Comprised of both Flex-based client components and a hosted services infrastructure, Cocomo allows you to build real-time, multi-user applications with Flex in less time than ever before. And because Acrobat.com hosts the service, issues like deployment, maintenance, and scalability are taken care of for you.

Add social features to your existing Flex apps or build totally new ones, such as real-time productivity/collaboration apps, multiplayer games, and audio/video chat.

Features of the Cocomo beta include the following:

  • VoIP Audio
  • Webcam Video
  • Chat
  • Multi-User Whiteboards
  • Real-Time File Sharing
  • User Management
  • Roles and Permissions
  • Robust Data Messaging

The Cocomo Adobe labs page

Sign up for Cocomo

Adobe Flex 3 and AIR 1 are here

Adobe Flex 3 and AIR 1

That’s it the new version of Adobe Flex is here and with it the new AIR 1 runtime, for details visit Mike Potter’s post. Congrats to all the people involved in this release Adobe is really pushing its open source side by making the Flex compilers source available.
Be sure to check Flex SDK page on Adobe Open Source and the product pages of Flex 3 and AIR 1.