Fire event when done initializing Live Casts on room join

Post your questions and bug-reports about the audio/video streaming add-on based on Red5 Media Server.

Moderators: Lapo, Bax

hasbean
Posts: 43
Joined: 02 Sep 2009, 11:39

Fire event when done initializing Live Casts on room join

Postby hasbean » 05 Oct 2009, 22:14

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?
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 06 Oct 2009, 11:23

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.
Paolo Bax
The SmartFoxServer Team
hasbean
Posts: 43
Joined: 02 Sep 2009, 11:39

Postby hasbean » 06 Oct 2009, 11:55

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.
User avatar
Bax
Site Admin
Posts: 4609
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 07 Oct 2009, 16:04

You can modify the RedBox source code in case you need to add an event.
Paolo Bax
The SmartFoxServer Team

Return to “RedBox”

Who is online

Users browsing this forum: No registered users and 19 guests