red5-server icon indicating copy to clipboard operation
red5-server copied to clipboard

voice chat as3

Open AxelDeathBR opened this issue 1 year ago • 0 comments
trafficstars

Issue

Short description

Brief description of what happened

Environment

[] Operating system and version: [] Java version: [] Red5 version:

Expected behavior

Put as much detail here as possible

Actual behavior

Put as much detail here as possible

Steps to reproduce

CODE import flash.net.NetConnection; import flash.net.NetStream; import flash.events.*; import flash.media.Microphone; import flash.media.Sound;

// Variáveis globais var Mic: Microphone; var nc: NetConnection = new NetConnection(); var istream: NetStream; var ostream: NetStream;

// Permitir configurações de segurança Security.showSettings("2");

// Configurar o microfone if (Microphone.names.length > 0) { Mic = Microphone.getMicrophone(); Mic.setUseEchoSuppression(true); Mic.setLoopBack(false); Mic.addEventListener(ActivityEvent.ACTIVITY, activityHandler); Mic.addEventListener(StatusEvent.STATUS, statusHandler); } else { trace("Nenhum microfone encontrado."); }

btnTalk.addEventListener(MouseEvent.MOUSE_DOWN, talkDown); btnTalk.addEventListener(MouseEvent.MOUSE_UP, talkUp); nc.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler); nc.connect("rtmp://localhost:1935/oflaDemo");

function talkDown(e: MouseEvent): void { trace("Iniciando transmissão..."); ostream.publish("charchar"); // Publicar o stream }

function talkUp(e: MouseEvent): void { trace("Parando transmissão..."); ostream.close(); // Fechar o stream }

function netStatusHandler(event: NetStatusEvent): void { trace(event.info.code); switch (event.info.code) { case "NetConnection.Connect.Success": // Criar NetStreams quando a conexão for bem-sucedida ostream = new NetStream(nc); istream = new NetStream(nc); istream.play("charchar"); // Iniciar reprodução do stream ostream.attachAudio(Mic); // Conectar o microfone ao NetStream break; case "NetConnection.Connect.Rejected": trace("Conexão rejeitada."); break; case "NetConnection.Connect.Failed": trace("Falha na conexão."); break; default: trace("Código: " + event.info.code); } }

function activityHandler(event: ActivityEvent): void { trace("Atividade do microfone: " + event); }

function statusHandler(event: StatusEvent): void { trace("Status do microfone: " + event); }

LOG: NetConnection.Connect.Success Status do microfone: [StatusEvent type="status" bubbles=false cancelable=false eventPhase=2 code="Microphone.Unmuted" level="status"] Atividade do microfone: [ActivityEvent type="activity" bubbles=false cancelable=false eventPhase=2 activating=true] Atividade do microfone: [ActivityEvent type="activity" bubbles=false cancelable=false eventPhase=2 activating=false] Atividade do microfone: [ActivityEvent type="activity" bubbles=false cancelable=false eventPhase=2 activating=true] Iniciando transmissão... Parando transmissão...

SHOULDN'T netStatusHandler BE SENDING SOMETHING?

Logs

Place logs on pastebin or elsewhere and put links here

AxelDeathBR avatar Oct 04 '24 19:10 AxelDeathBR