Avatar

Level 10
Hi,



As I said earlier also, I can't see AudioSubscriber in your
code. AudioSubscriber is the class that listens to the audio
streams and plays it. Until you add AudioSubscriber, you won't hear
any sound.



Moreover, you can't hear your own sound. You need to open two
instances of your app and then the second user can hear the sound
of first user when the first user is playing the sound.



Thanks

Hironmay Basu



You use this code

<mx:VBox width="40%" height="100%" right="0">

<mx:Button label="Déconnexion" click="logout()" />



<!-- scroll bar pourle volume -->

<mx:VBox paddingLeft="15" width="10%">

<mx:Label text="Gain" fontWeight="bold" />

<mx:HSlider id="gainSlider" minimum="0" maximum="100"
width="90%" value="{audio.gain}" labels="[0,50,100]"
change="onGainChange(event)" />

</mx:VBox>





<mx:VBox paddingLeft="15" fontWeight="bold"
width="70%">

<mx:Label text="UseEchoSuppression"/>

<mx:RadioButtonGroup id="echoGroup"
itemClick="onItemClick(event)" />

<mx:RadioButton label="Yes"
selected="{audio.useEchoSuppression}" groupName="echoGroup" />

<mx:RadioButton label="No"
selected="{!audio.useEchoSuppression}" groupName="echoGroup"/>

</mx:VBox>

<!--<mx:VBox paddingLeft="15" fontWeight="bold"
width="70%">

<mx:Label text="Microphone Volume"/>

<mx:ProgressBar id="activityProgress" minimum="0"
maximum="100" mode="manual" label="" />

</mx:VBox> -->



<rtc:AudioPublisher id="audio" height="0" />

<rtc:AudioSubscriber/>





<mx:HBox width="100%" horizontalAlign="center">

<mx:Button id="btn" label="Start My Audio"
click="onAudioClick(event)" toggle="true" />

</mx:HBox>







<mx:Button label="AudioButt"

toggle="true" id="audioButt" color="#000000"

click="(audioButt.selected) ? audio.publish() :
audio.stop()"/>



































/**

* When a click starts the audio, it publishes the audio
through AudioPublisher.

* Another click stops the audio.

*/

private function onAudioClick(p_evt:MouseEvent):void

{

if ( p_evt.currentTarget.label == "Start My Audio" ) {

audio.publish();

p_evt.currentTarget.label = "Stop My Audio" ;

}else if (p_evt.currentTarget.label == "Stop My Audio" ){

audio.stop();

p_evt.currentTarget.label = "Start My Audio" ;

}

}



/**

* Changes the gain by changing the gain slider value.

*/

private function onGainChange(event:Event):void

{

audio.gain = gainSlider.value ;

}

/**

* * Controls echo suppression through the use of radio
buttons.

*/

private function onItemClick(p_evt:ItemClickEvent):void

{

if ( p_evt.currentTarget.selectedValue == "Yes" ) {

audio.useEchoSuppression = true ;

}else if ( p_evt.currentTarget.selectedValue == "No" ) {

audio.useEchoSuppression = false ;

}

}