[AS3]as3中NetConnection、NetStream应用实例
怎么使用onMetaData和onCuePoint事件来处理视频的元数据和嵌入提示点。代码如下:
怎么使用onMetaData和onCuePoint事件来处理视频的元数据和嵌入提示点。代码如下:
- import mx.events.FlexEvent;
- import mx.utils.ObjectUtil;
- private var nc:NetConnection;
- private var ns:NetStream;
- private var video:Video;
- private var meta:Object;
- protected function init():void
- {
- // TODO Auto-generated method stub
- var nsClient:Object = new Object();
- nsClient.onMetaData = ns_onMetaData;
- nsClient.onCuePoint = ns_onCuePoint;
- nc = new NetConnection();
- nc.connect(null);
- ns = new NetStream(nc);
- ns.play("http://192.168.0.50:81/TestRSL/avatar.flv");
- ns.client = nsClient;
- video = new Video();
- video.attachNetStream(ns);
- uic.addChild(video);
- }
- private function ns_onMetaData(item:Object):void
- {
- trace("meta");
- meta = item;
- video.width = item.width;
- video.height = item.height;
- uic.width = video.width;
- uic.height = video.height;
- panel.title = "frame rate:" + item.framerate;
- panel.visible = true;
- trace(ObjectUtil.toString(item));
- }
- private function ns_onCuePoint(item:Object):void
- {
- trace("cue");
- }
热门文章推荐
- [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示例
请稍候...