4,328
社区成员
发帖
与我相关
我的任务
分享
public function playVideo(path:String):void
{
_nc = new NetConnection();
_nc.connect(null);
_ns = new NetStream(_nc);
_ns.checkPolicyFile = true;
_video = new Video();
addChild(_video);
_video.attachNetStream(_ns);
_ns.play(null);
_ns.appendBytesAction(NetStreamAppendBytesAction.RESET_BEGIN);
var file:File = new File(path);
var fileStream:FileStream = new FileStream();
fileStream.open(file, FileMode.READ);
var bytes:ByteArray = new ByteArray();
fileStream.readBytes(bytes);
_ns.appendBytes(bytes);
}
public function getImage(video:Video):BitmapData
{
var bit:BitmapData = new BitmapData(_video.width, _video.height);
bit.draw(_video); //This will cause the error
return bit;
}