multi/audio in chat

Legacy support with Phidget21
alexx61
Fresh meat
Posts: 1
Joined: Fri Sep 05, 2014 8:27 am
Contact:

multi/audio in chat

Postby alexx61 » Fri Sep 05, 2014 8:31 am

hello,

I have a chat in flash and activate the microphone and start talking, I automatically blocks the audio of other users who are talking, I would like to eliminate this action, making the multi chat / audio: everyone speaks everyone listens.

I do not know if you just need to change and what change in this as I do?
I state that I have the source code of the software license.

Who can help me?
Thank you in advance


import com.gchats.visichat.factory;
class com.gchats.visichat.microphone {
private static var instanceObj = null;
private var _adapter;
public var _mic:Microphone = null;
public var isOn:Boolean = false;
public var _handsfree:Boolean = false;
public var _active:Boolean = false;
private var _activated:Boolean = false;
private var _started:Boolean = false;
private var allowed:Boolean = false;
public var voice_name:String = "";
private var voiceStream:NetStream;
function microphone() {
}
private function init() {

_adapter = factory.getClass("adapter");

voiceStream["owner"] = this;
_mic = Microphone.get();
var rate:Number = Number(factory.getClass("config").getValue("sound_quality"));
if (rate == 8 || rate == 11 || rate == 22 || rate == 44) {
_mic.setRate(rate);
} else {
_mic.setRate(11);
}
_mic.setUseEchoSuppression(true);
_mic["owner"] = this;
_mic.onActivity = function(active) {
this["owner"]._active = active;
if (this["owner"]._handsfree) {
if (active) {
this["owner"].start();
this["owner"].onTalk(true);
} else {
this["owner"].stop();
this["owner"].onTalk(false);
}
}
};
_mic.onStatus = function(evt) {
if (evt.level == "status" && evt.code == "Microphone.Unmuted") {
this["owner"].allowed = true;
this["owner"].onActivate(true);
}
if (evt.level == "status" && evt.code == "Microphone.Muted") {
//_global["rejected"] = true;
this["owner"].onActivate(false);
}
};
}
public function setName(vName:String) {
voice_name = vName;
}
function setHandsFree(value:Boolean) {
_handsfree = value;
var clipName:String = "tmpPrvVoice___"+voice_name;
if (value) {
if (_root[clipName] == undefined) {
_root.createEmptyMovieClip(clipName,factory.getClass("visichat").getNextRootDepth());
}
_root[clipName].attachAudio(_mic);
var v:Sound = new Sound(_root[clipName]);
v.setVolume(0);
} else {
_root[clipName].attachAudio(null);
_root[clipName].removeMovieClip();
this.stop();
}
}
public function getMic() {
init();
if (_global["rejected"]) {
System.showSettings(0);
} else {
if (allowed) {
onActivate(true);
} else {
if (!allowed && !_global["mic_attached"]) {
_root.attachAudio(_mic);
_root.attachAudio(null);
_global["mic_attached"] = true;
} else {
onActivate(true);
}
}
}
}
public function getMicObj():Microphone {
return _mic;
}
public function start() {
voiceStream.attachAudio(_mic);
_started = true;
}
public function stop() {
voiceStream.attachAudio(null);
_started = false;
}
// Invokes when microphone is being activated or diactivated
private function onActivate(active:Boolean) {
if (active) {
voiceStream = new NetStream(_adapter.nc);
voiceStream.publish(voice_name,"live");
} else {
voiceStream.close();
}
onChange(active);
_activated = active;
}
/*
* Close stream and destroy microphone object
*/
public function close() {
voiceStream.attachAudio(null);
voiceStream.close();
}
//Events
function onChange(isOn:Boolean) {
}
function onTalk(talk:Boolean) {
}

public static function getInstance():microphone {
if (instanceObj == null) {
instanceObj = new microphone();
}
return instanceObj;
}
}

Return to “ActionScript 3.0 - Flash CS3 / Flex / AIR”

Who is online

Users browsing this forum: No registered users and 2 guests