问题描述
我试图用flex写一个rtmp客户端。问题是,我不知道从哪里开始。有人可以请回答我如何去做这件事,或指向我的网站呢?谢谢。我甚至不知道要使用什么类,等等。您不必编写自己的RTMP客户端,因为Flash已经实现了一个叫做。
要创建一个基本连接,您可以执行以下操作:
var nc:NetConnection = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS,onNetStatus);
nc.connect('rtmp://127.0.0.1/application');
函数onNetStatus(e:NetStatusEvent):void
{
switch(e.info.code)
{
case'NetConnection.Connect.Success ':
//与RTMP服务器的连接已经建立
break;
case'...':
...
}
}
您看到的代码NetConnection.Connect.Success是服务器返回的代码之一,请查看。您应该先阅读文档,然后再回来一个更精确的问题。
I'm trying to write an rtmp client with flex. The problem is that I have no idea where to start. Could someone please answer how I would go about doing this, or point me to a site that does? Thanks. I don't even know what classes to use and such.
You don't have to write your own RTMP client because Flash already implements a RTMP client called NetConnection
.
To create a basic connection you could do the following:
var nc:NetConnection = new NetConnection();
nc.addEventListener(NetStatusEvent.NET_STATUS, onNetStatus);
nc.connect('rtmp://127.0.0.1/application');
function onNetStatus(e:NetStatusEvent):void
{
switch (e.info.code)
{
case 'NetConnection.Connect.Success':
// Connection with the RTMP server has been established
break;
case '...':
...
}
}
The code 'NetConnection.Connect.Success' you see is one of the codes the server returns, have a look over here for an overview of all the codes.
You should probably read up on the documentation first and then come back with a more precise question.
这篇关于Flex RTMP客户端的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!