public void OnPreviewFrame(byte[] data, Android.Hardware.Camera camera)
{
var paras = camera.GetParameters();
var imageformat = paras.PreviewFormat;
if (imageformat == Android.Graphics.ImageFormatType.Nv21)
{
Android.Graphics.YuvImage img = new Android.Graphics.YuvImage(data,
imageformat, paras.PreviewSize.Width, paras.PreviewSize.Height, null);
if (time <= DateTime.Now)
{
using (System.IO.MemoryStream outStream = new System.IO.MemoryStream())
{
bool didIt = img.CompressToJpeg(new Rect(0, 0, paras.PreviewSize.Width, paras.PreviewSize.Height), 75, outStream);
outStream.Seek(0, System.IO.SeekOrigin.Begin);
// Bitmap newBM = BitmapFactory.DecodeStream(outStream);
NetProcess.SendRoomMessage(outStream.ToArray());
time = DateTime.Now.AddMilliseconds(300);
}
}
}
}