[英]How to disable video compression - UIImagePickerController, Xamarin.IOS, C#
Program: I am currently using an UIImagePickerController that lets the user select a video on their device. 程序:我当前正在使用UIImagePickerController,它允许用户在其设备上选择视频。 It then retrieves the URL for the video and stores it.
然后,它检索视频的URL并将其存储。
Problem: When a user selects a video, it compresses the video. 问题:用户选择视频时,它会压缩视频。 How can I disable the compressing part?
如何禁用压缩部分? Because I am only interested in the url, and if the video is large it takes a long time.
因为我只对URL感兴趣,如果视频很大,则需要花费很长时间。
I found this answer - https://stackoverflow.com/a/48643954/9764182 我找到了这个答案-https: //stackoverflow.com/a/48643954/9764182
However, for me the "VideoExportPreset" property takes a string. 但是,对我来说,“ VideoExportPreset”属性采用字符串。
Code: I don't think my code will be helpful, I do have a function that is subscribed to the finished picking event of the picker. 代码:我认为我的代码不会有帮助,我确实有一个函数可以订阅选择器的完成选择事件。 However, the compression happens before that event is fired.
但是,压缩是在触发该事件之前发生的。
MediaPicker = new UIImagePickerController();
MediaPicker.SourceType = UIImagePickerControllerSourceType.PhotoLibrary;
MediaPicker.MediaTypes = UIImagePickerController.AvailableMediaTypes(UIImagePickerControllerSourceType.PhotoLibrary);
MediaPicker.ImageExportPreset = UIImagePickerControllerImageUrlExportPreset.Current;
MediaPicker.VideoQuality = UIImagePickerControllerQualityType.High;
MediaPicker.FinishedPickingMedia += Handle_FinishedPickingMedia;
MediaPicker.Canceled += Handle_Canceled;
AVAssetExportSessionPreset
provides a convenience enum that you can use to get the NSString
from and then you can convert it to a C# string
. AVAssetExportSessionPreset
提供了一个方便的枚举,可用于从中获取NSString
,然后将其转换为C# string
。
var MediaPicker = new UIImagePickerController
{
~~~~
VideoExportPreset = AVAssetExportSessionPreset.Passthrough.GetConstant().ToString(),
~~~~
};
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.