Ejemplo n.º 1
0
        private void TryStart()
        {
            if (textureView != null && surfaceTexture != null)
            {
                // If necessary, stops the previously used camera object.
                this.Cleanup();

                camera = Hardware.Camera.Open();

                // set resolution, frame rate, preview format, etc.
                var parameters = camera.GetParameters();
                parameters.SetPictureSize(640, 480);
                camera.SetParameters(parameters);

                textureView.LayoutParameters = new FrameLayout.LayoutParams(width, height);

                try
                {
                    camera.SetPreviewTexture(surfaceTexture);
                    camera.StartPreview();
                }
                catch (IOException ex)
                {
                    var msg = ex.Message;
                    CurrentState = ScenarioState.Idle;
                }
            }
        }
Ejemplo n.º 2
0
        public void OnPictureTaken(byte[] data, Hardware.Camera camera)
        {
            // Sets the task result.
            var ms = new MemoryStream(data);

            pictureResult.SetResult(ms);

            camera.StartPreview();
        }