I just tried the below code, and it works fine to reduce the echo on head phones. But the problem of echo remains as it is in case of speakers.
public var intCountMilliSec:int = 0;
public var intLastActivityLevel:int = 0;
public var intLastLowestActivityLevel:int = 100;//07-Dec-09
private function CancelEcho(e:TimerEvent):void
{
intCountMilliSec = intCountMilliSec + 50;
if (Red5OutgoingMic.activityLevel > intLastActivityLevel)
{
intLastActivityLevel = Red5OutgoingMic.activityLevel;
}
if (Red5OutgoingMic.activityLevel < intLastLowestActivityLevel)
{
intLastLowestActivityLevel = Red5OutgoingMic.activityLevel;
}
if (intCountMilliSec >= 1500)
{
if (intLastActivityLevel > 20)
{
Red5OutgoingMic.gain *= 0.8;
}
if (intLastLowestActivityLevel < 20)
{
if (Red5OutgoingMic.gain <= 30)
{
Red5OutgoingMic.gain = Red5OutgoingMic.gain/0.8;
}
}
intCountMilliSec = 0;
intLastActivityLevel = 0;
intLastLowestActivityLevel = 0;
}
}
Any immediate help is appreciated.