Flash 连接到red5服务器时出现NetConnection.Connect.Rejected错误
我是flex新手。我创建了动态web项目。运行它。可以在上找到它。现在我想创建到该应用程序的连接,但我得到了NetConnection.Connect.Rejected。这是我的代码:Flash 连接到red5服务器时出现NetConnection.Connect.Rejected错误,flash,apache-flex,streaming,flash-builder,Flash,Apache Flex,Streaming,Flash Builder,我是flex新手。我创建了动态web项目。运行它。可以在上找到它。现在我想创建到该应用程序的连接,但我得到了NetConnection.Connect.Rejected。这是我的代码: import mx.core.UIComponent; import mx.events.FlexEvent; private var connection:NetConnection; private var inStream:NetStream;
import mx.core.UIComponent;
import mx.events.FlexEvent;
private var connection:NetConnection;
private var inStream:NetStream;
private var outStream:NetStream;
private var camera:Camera;
private var microphone:Microphone;
private var inVideo:Video;
private var outVideo:Video;
private var inVideoWrapper:UIComponent;
private var outVideoWrapper:UIComponent;
protected function application1_creationCompleteHandler(event:FlexEvent):void
{
connection = new NetConnection();
connection.connect("rtmp://localhost/myApp");
connection.addEventListener(NetStatusEvent.NET_STATUS, onConnected);
}
private function onConnected(event:NetStatusEvent):void
{
if(event.info.code == "NetConnection.Connect.Success")
{
setupVideo();
}
}
private function setupVideo():void
{
camera = Camera.getCamera();
microphone = Microphone.getMicrophone();
outStream = new NetStream(connection);
outStream.attachCamera(camera);
outStream.attachAudio(microphone);
outStream.publish("Radislav");
outVideo = new Video();
outVideo.attachCamera(camera);
inStream = new NetStream(connection);
inStream.play("Radislav");
inVideo = new Video();
inVideo.attachNetStream(inStream);
outVideoWrapper = new UIComponent;
outVideoWrapper.addChild(outVideo);
addElement(outVideoWrapper);
inVideoWrapper = new UIComponent;
inVideoWrapper.addChild(inVideo);
addElement(inVideoWrapper);
inVideoWrapper.move(400,0);
}
长话短说-您需要
connection.connect()调用中的第二个参数。但是您需要阅读服务器日志(red5/jvm)以了解更多详细信息。如果您没有看到日志,这里将解释如何让服务器写入日志:是的,我理解。我昨天找到了解决办法。这和你说的一模一样。谢谢