[FMS]FMS实现视频聊天的代码示例(含发布端和接收端)
[FMS]FMS实现视频聊天的代码示例(含发布端和接收端) FMS视频,fms发布端,fms接收端
发布端(Publish.mxml)
- <?xml version="1.0" encoding="utf-8"?>
- <s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
- xmlns:s="library://ns.adobe.com/flex/spark"
- xmlns:mx="library://ns.adobe.com/flex/mx" initialize="init()">
- <s:layout>
- <s:BasicLayout/>
- </s:layout>
- <fx:Declarations>
- <!-- 将非可视元素(例如服务、值对象)放在此处 -->
- </fx:Declarations>
- <fx:Script>
- <![CDATA[
- import mx.core.UIComponent;
- private var nc:NetConnection;
- private var mic:Microphone;
- private var cam:Camera;
- private function init():void
- {
- //加载自己的摄像头
- mic = Microphone.getMicrophone();
- cam = Camera.getCamera();
- var video:Video = new Video();
- video.attachCamera(cam);
- var uiBox:UIComponent = new UIComponent();
- uiBox.addChild(video);
- this.addElement(uiBox);
- nc = new NetConnection();
- nc.addEventListener(NetStatusEvent.NET_STATUS,onNetStatus);
- nc.connect("rtmp://192.168.1.16/virtualShow");
- nc.client = this;
- }
- private function onNetStatus(evt:NetStatusEvent):void
- {
- trace(evt.info.code);
- if(evt.info.code=="NetConnection.Connect.Success")
- {
- var ns:NetStream = new NetStream(nc);
- ns.addEventListener(NetStatusEvent.NET_STATUS,onNetStatus);
- ns.attachAudio(mic);
- ns.attachCamera(cam);
- ns.client = this;
- ns.publish("hxw","live");
- }
- }
- public function onBWDone():void
- {
- }
- ]]>
- </fx:Script>
- </s:Application>
热门文章推荐
- [FMS]Adobe FMS产品(Adobe Flash Media Server)使用介绍(组图)
- [FMS]Flash Media Server之教程附示例代码
- [RTMP]国产RTMP/HLS直播服务器simple-rtmp-server
- [WOWZA]用wowza流媒体服务器发布和播放直播流(RTMP)
- [RTMP]又一款rtmp类的服务器openrtmfp流媒体服务器
- [RTMP]adobe之FMS视频直播解决方案流程介绍(组图)
- [RTMP协议]实时消息传输协议 (RTMP) 常识性介绍
- [FMS]Adobe的Flash Media Server服务器(FMS服务器)安装
请稍候...