Skip to main content
Inspiring
October 2, 2007
Question

cannot maintain voice on a live stream.. help me sleep

  • October 2, 2007
  • 2 replies
  • 296 views
I've been stuck for about 2 weeks now and would like to be able to sleep normal hours some day .... if someone could give me a hand, I'd really really really apprecate it!

I'm trying to setup a basic voice chat system using Media Server 2 and Flex2. The voice works but only for about 15 seconds then the server closes the voice stream subscriptions. I've tried to capture every error under the sun, but nothing shows.

The code uses a server call back to tell other clients to subscribe to a newly published stream. Output tracing shows it works and it IS possible to talk.. for a little while. Then it all goes dead. The management consule shows the listening streams disappearring. Reloading the app, it works again for 10 seconds to a minute.

Is there something obviously wrong in my code? I don't know if there is some sort of 'timeout' or perhaps I need to ping to keep the connection alive? Any ideas where to start looking?

private var ui:UIComponent; //global var in the class
private var out_VoiceStream:NetStream; //global var in the class
private var m_nc:NetConnection; //used globally for all connections to the server

private function publishMicStream( userName:String ):void {
out_VoiceStream = new NetStream(m_nc);
out_VoiceStream.attachAudio( mic );
out_VoiceStream.publish( "audioStream_" + userName, "live");

}


public function subscribeToVoiceStream( p_userName:String ): void {
var in_voiceStream:NetStream;
var video:Video;

in_voiceStream = new NetStream( m_nc );

video = new Video(2,2);
video.attachNetStream(in_voiceStream);
ui = new UIComponent();
in_voiceStream.play( "audioStream_" + p_userName);
in_voiceStream.receiveVideo(false);
in_voiceStream.receiveAudio(true);
ui.addChild(video);


}
    This topic has been closed for replies.

    2 replies

    jonporAuthor
    Inspiring
    October 2, 2007
    When on person is already connected (person B) and then a second person connects (person A) the Stream sends a netstatus as follows:

    FIRST: NetStream.Play.StartStarted playing audioStream_b.

    (at this point person A can hear B's mic live )

    AND THEN IMMEDIATELY: NetStream.Play.ResetPlaying and resetting audioStream_b.
    (this cuts the ability off A to hear B)

    And of course, there doesn't seem to be any good documentation on this, so I'm not sure how to interpret this.... what is the significance of reseting audioStream_b?

    I'm not sure if this is related to the problem I'm having or yet another problem...

    Anyone??
    jonporAuthor
    Inspiring
    October 2, 2007
    If this is setup correctly between two clients, how should it look in the managment server?

    I see:

    audioStream_a live publishing
    audioStream_b live publishing
    (viewing by client a )

    Netstream audiostream_a publishing (by client a)
    Netstream audioStream_b playing live (by client a )
    Netstream audioStream_b publishing (by client b)

    Does that look right? I can't find any docs that tell me how to decode what I'm looking at. Its odd to me that audiostream_b is being viewed by client a, but the reverse is that client A has to play live the netstream of B.