[AS3]AS3处理摄像头视频截图的代码示例
[AS3]AS3处理摄像头视频截图的代码示例,AS3处理摄像头,as3摄像,as3截图
[AS3]AS3处理摄像头视频截图的代码示例
- function savepicto21(e:MouseEvent):void//保存图片
- {
- //var bitmapdata:BitmapData = new BitmapData(video.width, video.height);
- //bitmapdata.draw(video);
- var jpgEncoder:JPGEncoder = new JPGEncoder(80);
- //图片质量
- var jpgStream:ByteArray = jpgEncoder.encode(bitmapdata);
- var header:URLRequestHeader = new URLRequestHeader ("Content-type",
"application/octet-stream");- var jpgURLRequest = new URLRequest ("ben.php?name=camera.jpg");
//极酷播放器提示:此web url请自行修改- jpgURLRequest.requestHeaders.push(header);
- jpgURLRequest.method = URLRequestMethod.POST;
- jpgURLRequest.data = jpgStream;
- navigateToURL(jpgURLRequest,"_blank");
- }
- function clickHandler(e:MouseEvent):void//极酷播放器提示保存图片
- {
- var bitmapdata:BitmapData = new BitmapData(video.width, video.height);
- bitmapdata.draw(video);
- var jpgEncoder:JPGEncoder = new JPGEncoder(80);
- //极酷播放器提示:图片质量
- var jpgStream:ByteArray = jpgEncoder.encode(bitmapdata);
- var header:URLRequestHeader = new URLRequestHeader ("Content-type",
"application/octet-stream");- var jpgURLRequest = new URLRequest ("http://www.cuplayer.com/news/
ben.php?name=camera.jpg"); //此web url请自行修改- jpgURLRequest.requestHeaders.push(header);
- jpgURLRequest.method = URLRequestMethod.POST;
- jpgURLRequest.data = jpgStream;
- navigateToURL(jpgURLRequest,"_blank");
- }
- function clickHandler2(e:MouseEvent):void//保存图片
- {
- bitmapdata.draw(video);
- var bm:Bitmap=new Bitmap(bitmapdata);
- sh.addChild(bm);
- }
- var video:Video=new Video(400,300);
- var bitmapdata:BitmapData = new BitmapData(video.width, video.height);
- addChild(video);
- if(Camera.getCamera()==null){bent.text="摄像头不存在或其它程序占用该设备";}
- video.attachCamera(Camera.getCamera());
- /*var btn:Sprite = new Sprite;
- btn.graphics.beginFill(0,1);
- btn.graphics.drawRoundRect(0,0,100,25,10);
- btn.x = 110;
- btn.y = 250;
- btn.buttonMode = true;
- btn.addEventListener(MouseEvent.CLICK, clickHandler);
- addChild(btn);*/
- ben_but.addEventListener(MouseEvent.CLICK, clickHandler2);
- save.addEventListener(MouseEvent.CLICK, savepicto21);
热门文章推荐
- [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示例
请稍候...