[Flex]Flex和Red5制作视频直播播放器
[Flex]Flex和Red5制作视频直播播放器,视频直播,Red5视频直播
客户端使用Flex实现摄像头获取视频并发布代码如下:
- <?xml version="1.0" encoding="utf-8"?>
- <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" applicationComplete="init()">
- <mx:Script>
- <!--[CDATA[
- import flash.net.NetConnection;
- import flash.net.NetStream;
- import flash.events.NetStatusEvent;
- import mx.controls.Alert;
- private var nc:NetConnection;
- private var ns:NetStream;
- private var cam:Camera;
- private function init():void{
- nc = new NetConnection();
- nc.addEventListener(NetStatusEvent.NET_STATUS,connectServerHander);
- nc.client = this;
- nc.connect("rtmp://58.116.56.68:1935/Flex01");
- }
- private function connectServerHander(evt:NetStatusEvent):void{
- trace(evt.info.code);
- cam = Camera.getCamera();
- if(cam != null){
- cam.setMode(313,194,30);
- cam.setQuality(0,70);
- ns = new NetStream(nc);
- ns.attachCamera(cam);
- ns.publish("red5");
- var vi:Video = new Video();
- vi.width = 313;
- vi.height = 194;
- vi.attachCamera(cam);
- videoDisplay.addChild(vi);
- }else{
- Alert.show("no Camera");
- }
- }
- public function onBWDone():void{
- }
- ]]-->
- </mx:Script>
- <mx:VideoDisplay x="162" y="77" width="313" height="194" id="videoDisplay"/>
- </mx:Application>
热门文章推荐
- [HLS]做自己的m3u8点播系统使用HTTP Live Streaming(HLS技术)
- [FMS]FMS流媒体服务器配置与使用相关的介绍
- [AS3]什么是M3U8,与HTML5的区别是什么
- AS2.0 让flash自适应全屏,并且不自动缩放
- [AS3]as3.0的sound类常用技巧整理
- [AS3]as3与ByteArray详解、ByteArray介绍、ByteArray用法
- 关于RTMP,RTMPT,RTMPS,RTMPE,RTMPTE协议的介绍
- [JS]分享浏览器弹出窗口不被拦截JS示例
请稍候...