este site eu ja vi...
da uma olhada no codigo que eu fiz.. um dealhe o arquivo main.asc ja esta
no servidor dentro da pasta orotalk no "FLASH MEDIA SERVER 3.5"
este codigo esta dando um erro...
ArgumentError: Error #2126: O objeto NetConnection deve ser conectado.
at flash.net::NetStream/construct()
at flash.net::NetStream()
at gravador/startRecording()[C:\Documents and Settings\jornalweb\My
Documents\Adobe Gumbo MAX Preview\gravador\src\gravador.as:52]
at gravador/___gravador_Button1_click()[C:\Documents and
Settings\jornalweb\My Documents\Adobe Gumbo MAX
Preview\gravador\src\gravador.mxml:4]
*a linha 52 possui este codigo: "stream = new NetStream( nc );"*
import flash.events.*;
import flash.media.Microphone;
import flash.media.SoundChannel;
import flash.net.NetConnection;
import flash.net.NetStream;
import mx.controls.Alert;
import flash.events.*;
import flash.utils.*;
import mx.core.UIComponent;
import mx.collections.ArrayCollection;
//import mx.core.UIComponent;
//import mx.collections.ArrayCollection;
public var mychannel : SoundChannel;
public var message_output:String ="TextInput";
// public var url_input:String = "\20081028202607_20_1[Beira-mar].mp3";
// private var rtmpLocation:String = "rtmp://localhost:1935/orotalk";
public var rtmpLocation:String = "rtmp://localhost/orotalk";
public var nc:NetConnection; // = new NetConnection();
public var stream:NetStream; // = new NetStream(nc);
// instanciando o microfone
public var mic:Microphone = Microphone.getMicrophone();
private function startRecording():void {
//Security.showSettings(SecurityPanel.MICROPHONE); // mostra a caixa de
dialogo para configuração do microfone.
if ( mic != null ) {
Alert.show( 'OK, achei o microfone' );
mic.setLoopBack(true);
mic.setUseEchoSuppression(true);
mic.addEventListener(ActivityEvent.ACTIVITY, activityHandler);
mic.addEventListener(StatusEvent.STATUS, statusHandler);
// **************************************************************
//Alert.show('Instancia a conexão');
nc = new NetConnection(); *// esta é a linha 52*
nc.addEventListener(NetStatusEvent.NET_STATUS, netStatus);
//nc.client = new NetConnection;
//Alert.show('Conecta');
nc.connect( rtmpLocation );
//Alert.show('Instancia o stream');
stream = new NetStream( nc );
stream.attachAudio(mic);
//Alert.show('Vou publicar');
stream.publish("rodrigo","record");
Alert.show( "Iniciei a gravação" );
// **************************************************************
} else {
Alert.show("iiiii, não achei o microfone, como vou capturar o
áudio?");
}
}
private function stopRecord():void {
if ( mic != null ) {
Alert.show("Desculpe, vou ter que interromper o áudio");
mic.setLoopBack(false);
if ( nc == null ) {
Alert.show("Não estrava gravando" );
nc.close();
}
} else {
Alert.show( "Esqueceu? eu não havia encontrado o microfone, como vou
parar algo que eu não iniciei." );
}
}
private function activityHandler(event:ActivityEvent):void {
trace("activityHandler: " + event);
}
private function statusHandler(event:StatusEvent):void {
trace("statusHandler: "+event);
}
private function netStatus(event:NetStatusEvent):void{
// Write out information about connection events:
var info:Object = event.info;
for(var p:String in info) {
Alert.show( p + " : " + info[p] );
}
}
/********************************************************************************
vai aqui agora o codigo do arquivo "main.asc" que esta dentro da pasta
orotalk no servidor.
Client.prototype.getServerTime = function(msg){
var now = new Date();
return now.toString();
}
application.onAppStart = function() {
trace("Begin sharing text");
// Get the server shared object 'users_so'
application.users_so = SharedObject.get("ChatUsers");
// Initialize the history of the text share
application.history = "";
// Initialize the unique user ID
application.nextId = 0;
}
application.onConnect = function(newClient, userName) {
// Make this new client's name the user's name
newClient.name = userName;
// Create a unique ID for this user while incrementing the
// application.nextID.
newClient.id = "u" + application.nextId++;
// Update the 'users_so' shared object with the user's name
application.users_so.setProperty(newClient.name, userName);
// Accept the client's connection
application.acceptConnection(newClient);
// Call the client function 'setHistory,' and pass
// the initial history
newClient.call("setHistory", null, application.history);
// The client will call this function to get the server
// to accept the message, add the user's name to it, and
// send it back out to all connected clients.
newClient.msgFromClient = function(msg) {
msg = userName + ": " + msg + "\n";
application.history += msg;
application.users_so.send("msgFromSrvr", msg);
}
}
application.onDisconnect = function(client) {
trace("disconnect: " + client.name);
application.users_so.setProperty(client.name, null);
}
2008/12/2 Andre & Geane Caetano <[EMAIL PROTECTED]>
> Cara eu achei esse link
>
> http://www.mxstudio.com.br/dreamweaver/gravando_streaming_com_flash_communication_server_flash_media_server/
>
>
>
>
>
> >
>
--
Gilberto Moreira
Celular31 86042310
Skype: gmoreirasouza
MSN: [EMAIL PROTECTED]
--~--~---------~--~----~------------~-------~--~----~
Você recebeu esta mensagem porque está inscrito na lista "flexdev"
Para enviar uma mensagem, envie um e-mail para [email protected]
Para sair da lista, envie um email em branco para [EMAIL PROTECTED]
Mais opções estão disponíveis em http://groups.google.com/group/flexdev
-~----------~----~----~----~------~----~------~--~---