[AS3]as3中视频播放器截图功能实现源代码实现
[AS3]as3中视频播放器截图功能实现源代码实现
[AS3]as3中视频播放器截图功能实现源代码实现
- package
- import Main.*;
- import flash.display.*;
- import flash.events.*;
- import flash.media.*;
- import flash.net.*;
- import flash.utils.*;
- public class Main extends Sprite
- {
- private var _filePath:String = "/cuplayer/cuplayer.com.flv";
- private var _ns:NetStream;
- private var _bmp:Bitmap;
- private var _metaDataObj:Object;
- private var _nc:NetConnection;
- private var _video:Video;
- public function Main() : void
- {
- this._metaDataObj = {};
- if (stage)
- {
- this.init();
- }
- else
- {
- addEventListener(Event.ADDED_TO_STAGE, this.init);
- }
- return;
- }
- private function getMetaData(param1:Object) : void
- {
- var _loc_2:Object = null;
- trace("=CuPlayer.com1===================");
- for (_loc_2 in param1)
- {
- trace(_loc_2, param1[_loc_2]);
- }
- trace("=CuPlayer.com2====================");
- return;
- }// end function
- private function init(event:Event = null) : void
- {
- removeEventListener(Event.ADDED_TO_STAGE, this.init);
- this._nc = new NetConnection();
- this._nc.connect(null);
- this._ns = new NetStream(this._nc);
- thisthis._ns.client = this._metaDataObj;
- thisthis._metaDataObj.onMetaData = this.getMetaData;
- this._ns.addEventListener(NetStatusEvent.NET_STATUS, this.onNsConnected);
- var _loc_2:* = Camera.getCamera();
- this._video = new Video(_loc_2.width, _loc_2.height);
- this._video.smoothing = true;
- this._video.attachNetStream(this._ns);
- this._ns.play(this._filePath);
- addChild(this._video);
- return;
- }
- private function pause() : void
- {
- this._ns.close();
- addChild(this._bmp);
- thisthis._bmp.x = this._video.width + 5;
- removeEventListener(Event.ENTER_FRAME, this.captureBmp);
- return;
- }
- private function onNsConnected(event:NetStatusEvent) : void
- {
- trace(event.info.code);
- switch(event.info.code)
- {
- case "NetStream.Play.Start":
- {
- trace("准备播放");
- setTimeout(this.pause, 1000);
- addEventListener(Event.ENTER_FRAME, this.captureBmp);
- break;
- }
- case "NetStream.Play.StreamNotFound":
- {
- trace("找不到文件");
- break;
- }
- case "NetStream.Play.Stop":
- {
- trace("播放已停止");
- break;
- }
- default:
- {
- break;
- }
- }
- return;
- }
- private function captureBmp(event:Event) : void
- {
- var _loc_2:* = new BitmapData(this._video.width, this._video.height);
- _loc_2.draw(this._video);
- this._bmp = new Bitmap(_loc_2);
- trace("a");
- return;
- }
- }
热门文章推荐
- 纯HLS(m3u8)跨平台技术(HLSPlayer,m3u8Player跨平台多终端)
- DiscuzX3.2酷播视频插件(dz论坛自定义视频插件带广告
- [微信视频]实现网站中的视频在微信平台上正常播放(超多组图)
- [rtsp]海康威视监控摄像头实现web端无插件监控实拍效果
- 很酷,酷播wordpress视频插件(支持PC/安卓/苹果跨平台播放)
- [组图]微信视频技术:支持微信视频直播和视频点播
- [AS3]as3.0的rtmp流媒体播放器写法源代码示例
- 一步一步教你制作FLV网页视频播放器
请稍候...