Пример #1
0
        /// <summary>
        /// </summary>
        /// <param name="options"></param>
        /// <returns></returns>
        public Intent GetTakeVideoUI(StoreVideoOptions options)
        {
            if (!this.IsCameraAvailable)
            {
                throw new NotSupportedException();
            }

            return(this.CreateMediaIntent(this.GetRequestId(), "video/*", MediaStore.ActionVideoCapture, options, tasked: false));
        }
Пример #2
0
        /// <summary>
        ///     Take a video with specified options
        /// </summary>
        /// <param name="options">Video Media Options</param>
        /// <returns>Media file of new video or null if canceled</returns>
        public Task <MediaFile> TakeVideoAsync(StoreVideoOptions options)
        {
            if (!this.IsCameraAvailable)
            {
                throw new NotSupportedException();
            }

            return(this.TakeMediaAsync("video/*", MediaStore.ActionVideoCapture, options));
        }
        /// <inheritdoc />
        public async Task <MediaFile> TakeVideoAsync(StoreVideoOptions options)
        {
            var capture = new CameraCaptureUI();
            //capture.VideoSettings.MaxResolution = options.Quality.GetResolutionFromQuality();
            //capture.VideoSettings.MaxDurationInSeconds = (float)options.DesiredLength.TotalSeconds;
            //capture.VideoSettings.Format = CameraCaptureUIVideoFormat.Mp4;

            var result = await capture.CaptureFileAsync(this.DeviceId);

            if (result == null)
            {
                return(null);
            }

            return(new MediaFile(result.Path, () => result.OpenStreamForReadAsync().Result));
        }
Пример #4
0
        private static MediaPickerController SetupController(MediaPickerDelegate mpDelegate, UIImagePickerControllerSourceType sourceType, string mediaType, CameraFacingDirection cameraFacingDirection, StoreMediaOptions options)
        {
            var picker = new MediaPickerController(mpDelegate);

            picker.MediaTypes = new[] { mediaType };
            picker.SourceType = sourceType;

            if (sourceType == UIImagePickerControllerSourceType.Camera)
            {
                picker.CameraDevice  = GetUICameraDevice(cameraFacingDirection);
                picker.AllowsEditing = options.AllowCropping;

                if (options.OverlayViewProvider != null)
                {
                    var overlay = options.OverlayViewProvider;
                    if (overlay is UIView)
                    {
                        picker.CameraOverlayView = overlay as UIView;
                    }
                }
                if (mediaType == Constants.TypeImage)
                {
                    picker.CameraCaptureMode = UIImagePickerControllerCameraCaptureMode.Photo;
                }
                else if (mediaType == Constants.TypeMovie)
                {
                    StoreVideoOptions voptions = (StoreVideoOptions)options;

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

            return(picker);
        }
Пример #5
0
 /// <summary>
 ///     Take a video with specified options
 /// </summary>
 /// <param name="options">Video Media Options</param>
 /// <returns>Media file of new video or null if canceled</returns>
 public Task <MediaFile> TakeVideoAsync(StoreVideoOptions options)
 {
     throw new NotSupportedException();
 }