/// <summary> /// Setups the controller. /// </summary> /// <param name="mpDelegate">The mp delegate.</param> /// <param name="sourceType">Type of the source.</param> /// <param name="mediaType">Type of the media.</param> /// <param name="options">The options.</param> /// <returns>MediaPickerController.</returns> private static MediaPickerController SetupController( MediaPickerDelegate mpDelegate, UIImagePickerControllerSourceType sourceType, string mediaType, MediaStorageOptions options = null) { var picker = new MediaPickerController(mpDelegate) { MediaTypes = new[] { mediaType }, SourceType = sourceType}; if (sourceType == UIImagePickerControllerSourceType.Camera) { if (mediaType == TypeImage && options is CameraMediaStorageOptions) { picker.CameraDevice = GetCameraDevice(((CameraMediaStorageOptions)options).DefaultCamera); picker.CameraCaptureMode = UIImagePickerControllerCameraCaptureMode.Photo; } else if (mediaType == TypeMovie && options is VideoMediaStorageOptions) { var voptions = (VideoMediaStorageOptions)options; picker.CameraDevice = GetCameraDevice (voptions.DefaultCamera); picker.CameraCaptureMode = UIImagePickerControllerCameraCaptureMode.Video; picker.VideoQuality = GetQuailty(voptions.Quality); picker.VideoMaximumDuration = voptions.DesiredLength.TotalSeconds; } } return picker; }