[RTMP]Flash中播放视频和音频流(rtmp协议)代码示例
在Flash中播放red5的视频和音频流,代码如下: importflash.net.NetConnection; importflash.events.NetStatusEvent; importflash.media.Camera; importflash.net.NetStream; var netConnect2:NetConnection = new NetConnection(); netConnect2.addEventLis
在Flash中播放red5的视频和音频流,代码如下:
- import flash.net.NetConnection;
- import flash.events.NetStatusEvent;
- import flash.media.Camera;
- import flash.net.NetStream;
- var netConnect2:NetConnection=new NetConnection();
- netConnect2.addEventListener(NetStatusEvent.NET_STATUS,netConnectHandler2);
- netConnect2.connect("rtmp://10.1.49.137/oflaDemo","codyy");
- var receiveStream:NetStream
- function netConnectHandler2(evt:NetStatusEvent):void
- {
- trace(evt.info.code);
- switch (evt.info.code)
- {
- case "NetConnection.Connect.Success" :
- initRec();
- trace("链接成功2");
- break;
- case "NetConnection.Connect.Closed" :
- trace("链接失败2");
- break;
- }
- }
- function initRec()
- {
- var cc = new Object();
- cc.onMetaData = onmd;
- var flvName:String=loaderInfo.parameters.xian;
- trace(flvName);
- receiveStream= new NetStream(netConnect2);
- receiveStream.client = cc;
- function onmd(o : Object):void{}
- receiveStream.play(flvName);
- rece_video.attachNetStream(receiveStream);
- }
热门文章推荐
- [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服务器)安装
请稍候...