Page 1 of 1

Fire event when done initializing Live Casts on room join

Posted: 05 Oct 2009, 22:14
by hasbean
Hello,

I'm trying to create game rooms where people are added to the conference automatically as soon as they join. The problem I'm having is that events for onLiveCastPublished and onLiveCastUnpublished are not being fired. My assumption is because I'm running the avCastMan.getAvailableCasts() method before Redbox is done initializing live casts.

this function runs as soon as the user joins a room.

Code: Select all

		
public function joinConference():void
		{
			// Retrieve live casts already available
			for each (var liveCast:LiveCast in avCastMan.getAvailableCasts())
			{
				// Subscribe live cast
				addLiveCast(liveCast)
			}
		}
I thought a solution would be to fire an event when Redbox is done initializing live casts and is ready for the getAvailableCasts method.

Or am I missing something here?

Posted: 06 Oct 2009, 11:23
by Bax
Follow the SmartVideoConference example distributed with the RedBox. It should do what you need. After you join the game room, subscribe to existing live casts and publish the user's own one.
onLiveCastPublished and onLiveCastUnpublished are fired respectively when new users join the conference or existing users leave it.

Posted: 06 Oct 2009, 11:55
by hasbean
I did but the only difference is that the conference is joined as soon as the game room is joined, there is no "Join Conference" button.

I think I'm running into a race condition. I looked into the code of AVCastManager.as and I see that my getAvailableCasts() (which sets castListRequested to true) is run before initCastList() (which sets castListRequested to false.) I'm guessing this is why I'm not getting any of those publish/unpublish events.

Posted: 07 Oct 2009, 16:04
by Bax
You can modify the RedBox source code in case you need to add an event.