Skip navigation
whather
Currently Being Moderated

onPeerConnect sometimes never being called

Jun 29, 2009 8:58 PM

I have a conferencing application which uses RTMFP for video/audio and has an RTMP fallback if a client is using Flash 9 or can't connect to Stratus. I'm having problems with connecting to some users, as their onPeerConnect method never gets called after playing their netStream. I'll explain how I manage my RTMFP connections:

 

So I used to only have one publishing netstream per client which listened for connections via NetStream.Connect.Success. If it found a connection, it would then connect to the connectee's netStream. This worked flawlessly locally but had problems with some clients remotely. I then decided to switch to the listener/controller method where each client publishes two netStreams: one that only listens for incoming connections and another that publishes purely audio/video (inspired by adobe's sample apps and this site: http://www.influxis.com/seantron/StratusSessions.html). Here's how it currently works:

 

  1. Before the client enters the conference, he connects to Stratus and after hitting NetConnection.Connect.Success, he creates and publishes both a Listener stream and audio/video stream.
  2. Client then enters conference. If there are any existing users in the conference, the client plays each user's Listening stream and Audio/Video stream.
  3. The existing users in the conference should have onPeerConnect called on their listening stream, and then they immediately start playing the connecting user's Audio/Video stream. This is working perfectly locally and on a lot of remote clients, but not everyone.

 

First of all, is this the recommended/correct way to handle an RTMFP many-to-many conference? Why would a user sometimes never have their onPeerConnect called when another user plays their stream?

 

A couple of notes:

  • Yes, I do set the Listening stream's client object before I call publish().
  • The net connection sets maxPeerConnections to 16 to avoid hitting the connection limit.
  • The guy who's onPeerConnect never gets called, it works fine for him locally. Also, my onPeerConnect does get called if I'm in the conference first and he connects to me. It's always the other way around (when he's in the conference first and I connect to him) where it fails.

 

I've attached logs of one of our test conferences. Client 1 is the first in the conference, and never gets onPeerConnect called even though Client 2 and Client 3 play the stream. Although, local clients 2 and 3 connect to each other fine when joining the same conference.

 

Any clues? Thanks!

 

-Wes

Attachments:
 
Replies
  • Currently Being Moderated
    Jul 8, 2009 5:56 PM   in reply to whather

    whather, how did you get a custom onPeerConnect() to work at all?!

     

    haven't played around with rtmfp for a few month now. i'm almost 100% certain the onPeerConnect()-thing worked back then.

    i've just looked up my old code and found that it worked with an Object with a dynamically added onPeerConnect()-function - even then it did NOT work via a separate client-class to handle things like this. (i know because i wrote a comment. unbelievable!)

     

    now it seems there is no way at all to have a custom onPeerConnect() called.. :/

     

    the only workaround seems to listen to the corresponding NetConnection instance' NetStream.Connect.Success and then check the peers via NetStream.peerStreams - that sucks because like that you have a tighter coupling between NetConnection and NetStream. in my use case i'd like to keep both apart. well well.

     

    adobe, go!

     

    -> guess it's the same issue here.

     

    cheers

     

    edit: of course i stumbled upon a strange workaround right after rambling on here.. *sigh*

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 27, 2010 4:25 AM   in reply to whather

    whather,

     

    Did you manage to find the solution to this? I seem to having a similar problem. Local connections work every time, remote connections fail every time.

     

    Any idea why using a "Listener" stream helps? I simply have a stream for audio, and one for video, and as soon as one client accepts a call from the other, they both try to connect to each others publishing streams.

     

    I have no idea why waiting for onPeerConnect to execute would help.

     

    Cam

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points