Esempio n. 1
0
 public void OnSurfaceTextureSizeChanged(Android.Graphics.SurfaceTexture surface, int width, int height)
 {
     Page.ConfigureTransform(width, height);
     Page.previousPhoto.LayoutParameters.Height = height;
     Page.previousPhoto.RequestLayout();
     Page.StartPreview();
 }
Esempio n. 2
0
        public bool OnSurfaceTextureDestroyed(Android.Graphics.SurfaceTexture surface)
        {
            _camera.StopPreview();
            _camera.Release();

            return(true);
        }
Esempio n. 3
0
        public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surface, int width, int height)
        {
            if (Camera.NumberOfCameras == 0)
            {
                Toast.MakeText(this, Resource.String.no_camera, ToastLength.Long).Show();
                return;
            }
            _camera = Camera.Open();
            if (_camera == null)
            {
                _camera = Camera.Open(0);
            }

            var previewSize = _camera.GetParameters().PreviewSize;

            _textureView.LayoutParameters =
                new FrameLayout.LayoutParams(previewSize.Width, previewSize.Height, GravityFlags.Center);

            try {
                _camera.SetPreviewTexture(surface);
                _camera.StartPreview();
            } catch (Java.IO.IOException ex) {
                Console.WriteLine(ex.Message);
            }

            // this is the sort of thing TextureView enables
            _textureView.Rotation = 45.0f;
            _textureView.Alpha    = 0.5f;
        }
Esempio n. 4
0
        //camera preview
        public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surface, int w, int h)
        {
            _camera = Camera.Open();
            switch (WindowManager.DefaultDisplay.Rotation)
            {
            case SurfaceOrientation.Rotation0:
                _camera.SetDisplayOrientation(90);
                break;

            case SurfaceOrientation.Rotation90:
                _camera.SetDisplayOrientation(0);
                break;

            case SurfaceOrientation.Rotation270:
                _camera.SetDisplayOrientation(180);
                break;
            }
            _textureView.LayoutParameters = new FrameLayout.LayoutParams(w, h);
            try
            {
                _camera.SetPreviewTexture(surface);
                _camera.StartPreview();
            }
            catch (Java.IO.IOException ex)
            {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 5
0
        public bool OnSurfaceTextureDestroyed(Android.Graphics.SurfaceTexture surface)
        {
            Toast.MakeText(this, "About to break texture", ToastLength.Short).Show();
            _camera.StopPreview();
            _camera.Release();

            return(true);
        }
 public bool OnSurfaceTextureDestroyed(Android.Graphics.SurfaceTexture surface)
 {
     // IMPORTANT TO CLOSE CAMERA.
     // OLDER CAMERA HARWARE CAN CRASH IF WE DONT CLOSE HERE
     owner.CloseCamera();
     owner.CloseCameraVideo();
     return(true);
 }
 public MediaCoreConsumer(Android.Graphics.SurfaceTexture surface,
                          Packets.AudioFormat audioFormat, Packets.VideoFormat videoFormat)
 {
     _video = new VideoHandler(surface, videoFormat);
     _audio = new AudioHandler(audioFormat);
     //TODO: Setup dynamically
     _video.SetupVideo((int)videoFormat.Width, (int)videoFormat.Height, null, null);
     _audio.SetupAudio((int)audioFormat.SampleRate, (int)audioFormat.Channels, null);
 }
Esempio n. 8
0
        public bool OnSurfaceTextureDestroyed(Android.Graphics.SurfaceTexture surface)
        {
            if (Page.mCameraDevice != null)
            {
                Page.mCameraDevice.Close();
                Page.mCameraDevice = null;
            }

            return(true);
        }
Esempio n. 9
0
        public void OnSurfaceChanged(Android.Graphics.SurfaceTexture holder, int format, int w, int h)
        {
            // Now that the size is known, set up the camera parameters and begin
            // the preview.
            //Camera.Parameters parameters = mCamera.getParameters();
            //parameters.setPreviewSize(mPreviewSize.width, mPreviewSize.height);
            //requestLayout();
            //mCamera.setParameters(parameters);

            //// Important: Call startPreview() to start updating the preview surface.
            //// Preview must be started before you can take a picture.
            //mCamera.startPreview();
        }
Esempio n. 10
0
        public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surface, int w, int h)
        {
            _camera = Camera.Open();

            _textureView.LayoutParameters = new FrameLayout.LayoutParams(w, h);

            try {
                _camera.SetPreviewTexture(surface);
                _camera.StartPreview();
            } catch (Java.IO.IOException ex) {
                Console.WriteLine(ex.Message);
            }
        }
Esempio n. 11
0
        public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surface, int w, int h)
        {
            _surface = surface;
            _w       = w;
            _h       = h;

            if (!_isCameraStarted)
            {
                return;
            }

            OpenCamera(_selectedCamera);
            SetTexture();
        }
Esempio n. 12
0
        public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surface, int width, int height)
        {
            //throw new NotImplementedException();
            _camera = Camera.Open();

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

            try
            {
                _camera.SetPreviewTexture(surface);
                _camera.StartPreview();
            }
            catch (Java.IO.IOException ioe)
            {
                Console.WriteLine(ioe.Message);
            }
        }
Esempio n. 13
0
        public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surface, int width, int height)
        {
            _camera = Camera.Open();
            ConfigureCamera();

            Preview preview = new Preview();

            preview.OnFrame += OnPreviewFrame;
            _camera.SetPreviewCallback(preview);

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

            try {
                _camera.SetPreviewTexture(surface);
                _camera.StartPreview();
            } catch (Exception e) {
                Console.WriteLine(e.Message);
            }
        }
        public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surface, int width, int height)
        {
            _camera = Camera.Open();

            var previewSize = _camera.GetParameters().PreviewSize;

            _textureView.LayoutParameters =
                new FrameLayout.LayoutParams(previewSize.Width, previewSize.Height, GravityFlags.Center);

            try {
                _camera.SetPreviewTexture(surface);
                _camera.StartPreview();
            } catch (Java.IO.IOException ex) {
                Console.WriteLine(ex.Message);
            }

            // this is the sort of thing TextureView enables
            _textureView.Rotation = 45.0f;
            _textureView.Alpha    = 0.5f;
        }
Esempio n. 15
0
 public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surface, int w, int h)
 {
     _camera = Android.Hardware.Camera.Open();
     _textureView.LayoutParameters = new FrameLayout.LayoutParams(w, h);
     _camera.SetPreviewTexture(surface);
     _camera.StartPreview();
     try
     {
         Toast.MakeText(this, "About to take picture", ToastLength.Short).Show();
         _camera.TakePicture(null, null, this);
         Toast.MakeText(this, "Finished pic", ToastLength.Short).Show();
         _camera = Android.Hardware.Camera.Open();
         _textureView.LayoutParameters = new FrameLayout.LayoutParams(w, h);
         _camera.SetPreviewTexture(surface);
         _camera.StartPreview();
         Toast.MakeText(this, "This shit again!", ToastLength.Short).Show();
     }
     catch (Exception e)
     {
         Toast.MakeText(this, e.ToString(), ToastLength.Long).Show();
     }
 }
 public void OnSurfaceTextureUpdated(Android.Graphics.SurfaceTexture surface)
 {
 }
 public void OnSurfaceTextureSizeChanged(Android.Graphics.SurfaceTexture surface, int width, int height)
 {
     Owner.ConfigureTransform(width, height);
 }
 public bool OnSurfaceTextureDestroyed(Android.Graphics.SurfaceTexture surface)
 {
     return(true);
 }
 public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surface, int width, int height)
 {
     Owner.OpenCamera(width, height);
 }
Esempio n. 20
0
 public void OnSurfaceTextureSizeChanged(Android.Graphics.SurfaceTexture surface, int width, int height)
 {
 }
Esempio n. 21
0
 public void OnSurfaceTextureUpdated(Android.Graphics.SurfaceTexture surface)
 {
     throw new NotImplementedException();
 }
 // This activates first
 public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surface, int width, int height)
 {
     // Call the open camera - gets the active camera
     owner.OpenCamera(width, height);
 }
Esempio n. 23
0
        public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surfaceTexture, int width, int height)
        {
            var st = new Surface(surfaceTexture);

            Video.Decoder.surface = st;
        }
Esempio n. 24
0
 public void OnSurfaceTextureSizeChanged(Android.Graphics.SurfaceTexture surface, int width, int height)
 {
     throw new NotImplementedException();
 }
Esempio n. 25
0
 public void OnSurfaceTextureUpdated(Android.Graphics.SurfaceTexture surface)
 {
     // Fires whenever the surface change (moving the camera etc.)
 }
Esempio n. 26
0
 public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surfaceTexture, int width, int height)
 {
     //var st = new Surface(surfaceTexture);
     //view.surface = st;
 }
Esempio n. 27
0
 public void OnSurfaceTextureSizeChanged(Android.Graphics.SurfaceTexture surface, int width, int height)
 {
     // camera takes care of this
 }
 public void OnSurfaceTextureAvailable(Android.Graphics.SurfaceTexture surface, int width, int height)
 {
     owner.SurfaceWidth  = width;
     owner.SurfaceHeight = height;
     owner.OpenCamera(width, height);
 }
Esempio n. 29
0
 public bool OnSurfaceTextureDestroyed(Android.Graphics.SurfaceTexture surface)
 {
     CloseCamera();
     return(true);
 }