[RED5]As3下的连接Red5代码示例
[RED5]As3下的连接Red5代码示例,as3连接red5,as3与red5通信
[RED5]As3下的连接Red5代码示例
- var nc:NetConnection = new NetConnection();
- nc.client = this;
- nc.objectEncoding = flash.net.ObjectEncoding.AMF0;
- //注意这句话(不加的话 同步事件没有被触发)
- nc.connect("rtmp://vod.cuplayer.com/server");
- var so:SharedObject = SharedObject.getRemote("gamemsg", nc.uri, false);
- so.connect(nc);
- nc.addEventListener(NetStatusEvent.NET_STATUS,netStatusHandler);
- so.addEventListener(SyncEvent.SYNC,newMessageHandler);
- sendButton.addEventListener(MouseEvent.CLICK,sendMessage);
- function netStatusHandler(Evt:NetStatusEvent){
- if (Evt.info.code == "NetConnection.Connect.Success") {
- history.appendText("CuPlayer.com提示:连接成功!");
- }
- if (Evt.info.code == "NetConnection.Connect.Failed") {
- history.appendText("CuPlayer.com提示:连接失败!");
- }
- }
- function newMessageHandler(event:SyncEvent):void{
- var infoObj:Object=event.changeList;
- for (var i = 0; i<infoObj.length; i++) {
- var info = infoObj[i];
- if (info.name != undefined) {
- if(info.code=="change"){
- history.appendText(so.data.chatMessage + "/n");
- }
- }
- }
- }
- function sendMessage(event:MouseEvent):void{
- so.setProperty("chatMessage",message.text);
- so.setDirty("chatMessage");
- history.appendText(message.text + "/n");
- message.text="";
- }
热门文章推荐
- [Red5]Red5之Flash流媒体服务器的安装与使用教程完整版(组图)
- [RED5]搭建RED5直播用流媒体服务(搭直播环境)
- [RED5]Red5的直播与点播的压力测试(并发数的测试)
- [RED5]red5流媒体服务器(开源免费)的安装方法
- [RED5]用red5做视频直播(red5流媒体直播)
- [RED5]Red5在线录制音视频源代码示例
- [RED5]Red5 Client 连接 Red5Server java代码
- [RED5]red5流媒体播放平台搭建环境方法
请稍候...