Esempio n. 1
0
        private static MediaPickerController SetupController(MediaPickerDelegate mpDelegate, UIImagePickerControllerSourceType sourceType, string mediaType, MediaStorageOptions options = null)
        {
            var picker = new MediaPickerController (mpDelegate);
            picker.MediaTypes = new[] { mediaType };
            picker.SourceType = sourceType;

            if (sourceType == UIImagePickerControllerSourceType.Camera) {
                picker.CameraDevice = GetUICameraDevice ((options as CameraMediaStorageOptions) .DefaultCamera);

                if (mediaType == TypeImage)
                    picker.CameraCaptureMode = UIImagePickerControllerCameraCaptureMode.Photo;
                else if (mediaType == TypeMovie) {
                    VideoMediaStorageOptions voptions = (VideoMediaStorageOptions)options;

                    picker.CameraCaptureMode = UIImagePickerControllerCameraCaptureMode.Video;
                    picker.VideoQuality = GetQuailty (voptions.Quality);
                    picker.VideoMaximumDuration = voptions.DesiredLength.TotalSeconds;
                }
            }

            return picker;
        }