private void ExtractVideoPickedFromGallery(Intent data)
        {
            try {
                Android.Net.Uri selectedUri = data.Data;

                string mimeType = "video";

                PickedMediaFromGallery result = new PickedMediaFromGallery();

                if (mimeType.StartsWith("video"))
                {
                    string filePath = MediaUtils.GetFileFullPathAlternativeVideo(data.Data, this);

                    Java.IO.File videoFile = new Java.IO.File(filePath);

                    Java.IO.FileInputStream videoFileInputStream = new Java.IO.FileInputStream(videoFile);
                    byte[] videoFileBytes = new byte[videoFile.Length()];
                    videoFileInputStream.Read(videoFileBytes);
                    videoFileInputStream.Close();
                    videoFileInputStream.Dispose();

                    System.IO.Stream thumbnailStream = DependencyService.Get <IPickMediaDependencyService>().GetThumbnail(filePath);
                    byte[]           thumbnailBytes;

                    thumbnailStream.Position = 0;

                    using (System.IO.BinaryReader reader = new System.IO.BinaryReader(thumbnailStream)) {
                        thumbnailBytes = reader.ReadBytes((int)thumbnailStream.Length);
                    }

                    result = new PickedMediaFromGallery()
                    {
                        Completion          = true,
                        DataBase64          = Android.Util.Base64.EncodeToString(videoFileBytes, Android.Util.Base64Flags.Default),
                        DataThumbnailBase64 = Convert.ToBase64String(thumbnailBytes),
                        FilePath            = filePath,
                        MimeType            = ProfileMediaService.VIDEO_MEDIA_TYPE
                    };
                }
                else
                {
                    Debugger.Break();
                    throw new InvalidOperationException();
                }

                PickVideoTaskCompletion.SetResult(result);
            }
            catch (Exception exc) {
                Debugger.Break();

                PickVideoTaskCompletion.SetResult(new PickedMediaFromGallery()
                {
                    Exception = exc, ErrorMessage = _EXTRACTION_MEDIA_MEDIA_PICK_ERROR
                });
            }
        }
        public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Permission[] grantResults)
        {
            base.OnRequestPermissionsResult(requestCode, permissions, grantResults);

            if (requestCode == _PICK_VIDEO_ASK_READ_EXTERNAL_STORAGE_PERMISSION_REQUEST_CODE)
            {
                if ((grantResults.Count() > 0) && (grantResults[0] == Permission.Granted))
                {
                    SendIntentToPickVideo();
                }
                else
                {
                    PickVideoTaskCompletion.SetResult(new PickedMediaFromGallery()
                    {
                        ErrorMessage = _NO_PERMISSIONS_MEDIA_ERROR
                    });
                }
            }
            else if (requestCode == _PICK_VIDEO_ASK_READ_EXTERNAL_STORAGE_PERMISSION_REQUEST_CODE)
            {
                if ((grantResults.Count() > 0) && (grantResults[0] == Permission.Granted))
                {
                    SendIntentToPickMedia();
                }
                else
                {
                    PickMediaTaskCompletion.SetResult(new PickedMediaFromGallery()
                    {
                        ErrorMessage = _NO_PERMISSIONS_MEDIA_ERROR
                    });
                }
            }
            else if (requestCode == _TAKE_VIDEO_OR_IMAGE_PERMISSION_REQUEST_CODE)
            {
                if (grantResults.Any() && grantResults.All(permission => permission == Permission.Granted))
                {
                    SendIntentToTakeVideoOrImage();
                }
                else
                {
                    CompleteActionTakeVideoOrImage(new PickedMediaFromGallery()
                    {
                        ErrorMessage = _NO_PERMISSIONS_MEDIA_ERROR
                    });
                }
            }
        }
        protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
        {
            base.OnActivityResult(requestCode, resultCode, data);

            if (requestCode == _PICK_VIDEO_FROM_GALLERY_SELECT_GALLERY)
            {
                if (resultCode == Result.Ok)
                {
                    ExtractVideoPickedFromGallery(data);
                }
                else if (resultCode == Result.Canceled)
                {
                    PickVideoTaskCompletion.SetResult(new PickedMediaFromGallery()
                    {
                        Completion = true
                    });
                }
            }
            else if (requestCode == _PICK_VIDEO_FROM_GALLERYSELECT_GALLERY_KITKAT)
            {
                if (resultCode == Result.Ok)
                {
                    ExtractVideoPickedFromGallery(data);
                }
                else if (resultCode == Result.Canceled)
                {
                    PickVideoTaskCompletion.SetResult(new PickedMediaFromGallery()
                    {
                        Completion = true
                    });
                }
            }
            else if (requestCode == _PICK_MEDIA_FROM_GALLERY_SELECT_GALLERY)
            {
                if (resultCode == Result.Ok)
                {
                    ExtractMediaPickedFromGallery(data);
                }
                else if (resultCode == Result.Canceled)
                {
                    PickMediaTaskCompletion.SetResult(new PickedMediaFromGallery()
                    {
                        Completion = true
                    });
                }
            }
            else if (requestCode == _PICK_MEDIA_FROM_GALLERY_SELECT_GALLERY_KITKAT)
            {
                if (resultCode == Result.Ok)
                {
                    ExtractMediaPickedFromGallery(data);
                }
                else if (resultCode == Result.Canceled)
                {
                    PickMediaTaskCompletion.SetResult(new PickedMediaFromGallery()
                    {
                        Completion = true
                    });
                }
            }
            else if (requestCode == _TAKE_IMAGE_OR_VIDEO_REQUEST_CODE)
            {
                if (resultCode == Result.Ok)
                {
                    if (data == null)
                    {
                        ExtractImageTakedFromCamera(data);
                    }
                    else
                    {
                        ExtractVideoTakedFromCamera(data);
                    }
                }
                else
                {
                    CompleteActionTakeVideoOrImage(new PickedMediaFromGallery()
                    {
                        Completion = true
                    });
                }
            }
        }