2011-12-22 4 views
0

私はred5とflexを使用しています。実際に私の目的は、サーバーからクライアントにマイクストリームを送信し、クライアント側で再生することです。同様に、クライアントからサーバーにマイクストリームを送信し、サーバー側で再生します。ライブストリームを保存する必要はありません。red5:どうすればマイクストリームを送信できますか?

これは可能ですか?どのように私はred5とフレックスでそれを行うことができますか?

クライアント側から

答えて

0
private var nc:NetConnection; 
private var mic:Microphone; 

private function init():void 
{ 
    nc=new NetConnection ; 
    nc.connect (your rtmppath,"anchor"); 
    mic=Microphone.getMicrophone(); 
    mic.rate=11; 
    nc.addEventListener (NetStatusEvent.NET_STATUS,checkConnect); 
} 

private function checkConnect (e:NetStatusEvent) 
{ 
    good=e.info.code == "NetConnection.Connect.Success"; 
    if (good) 
    { 
     this.attachAudio (mic); 
     this.publish (stream,"live"); 
    } 
} 

、ライブサウンドを再生するには、また、現在のNetConnectionであなたのNetStreamを接続します

private var nc:NetConnection; 
private var mic:Microphone; 
private var netstream:NetStream = new NetStream 
private function init():void 
{ 
    nc=new NetConnection ; 
    nc.connect (your rtmppath,"viewer"); 
    nc.addEventListener (NetStatusEvent.NET_STATUS,checkConnect); 
} 

private function checkConnect (e:NetStatusEvent) 
{ 
    good=e.info.code == "NetConnection.Connect.Success"; 
    if (good) 
    { 
     var vid:Video = new Video 
     this.attachNetStream(ns) 
     netStream.play(presentation); 
    } 
} 
+0

応答していただきありがとうございます。私はそれを試みたが、サーバー側のコードが明確ではない。サーバー側では、マイクロフォンバイトを取得できません。私はどのようにクライアント上のクライアントまたはサーバのマイクストリームをプログラムで再生することができますか? –

関連する問題