Wygląda na to, że nie można uniknąć kompresji za pomocą UIImagePickerController. Zobacz tę odpowiedź:
https://stackoverflow.com/a/5893066/406152
Próbowałem została, używając imagePicker.videoQuality = UIImagePickerControllerQualityTypeHigh;
ale nadal robi kompresji. Ugh.
EDYTOWANIE:
Można jednak samodzielnie toczyć. Umożliwi to dostęp do surowych plików wideo:
iOS 8
PHFetchResult *assetsFetchResult = [PHAsset fetchAssetsWithMediaType:PHAssetMediaTypeVideo options:nil];
for (PHAsset *asset in assetsFetchResult) {
PHVideoRequestOptions *videoRequestOptions = [[PHVideoRequestOptions alloc] init];
videoRequestOptions.version = PHVideoRequestOptionsVersionOriginal;
[[PHImageManager defaultManager] requestAVAssetForVideo:asset options:videoRequestOptions resultHandler:^(AVAsset *asset, AVAudioMix *audioMix, NSDictionary *info) {
// the AVAsset object represents the original video file
}];
}
Spójrz na dokumentacji PhotoKit o dostępie do zbiorów (chwile) i inne opcje.
Tutaj jest app próbki od firmy Apple PhotoKit, które mogą być modyfikowane za zdjęcia do kompletacji: https://developer.apple.com/library/ios/samplecode/UsingPhotosFramework/Introduction/Intro.html
Tutaj jest biblioteką zdjęć kompletacji na GitHub, który wykorzystuje PhotoKit który wygląda obiecująco, ponieważ daje PHAsset
obiektów dla wszystkich wybranych zdjęć/wideo: https://github.com/guillermomuntaner/GMImagePicker
iOS 7 i poniżej
ALAssetsLibrary *library = [[ALAssetsLibrary alloc] init];
[library enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
if (group) {
// If you want, you can filter just pictures or videos
// I just need videos so I do this:
[group setAssetsFilter:[ALAssetsFilter allVideos]];
[group enumerateAssetsUsingBlock:^(ALAsset *asset, NSUInteger index, BOOL *stop){
if (asset){
// You can now add this ALAsset in your own video picker.
// Note that you can only access the ALAsset as long as
// you maintain a reference to the ALAssetsLibrary
// Or if you want to process the video, you can create an AVAsset:
NSURL *url = asset.defaultRepresentation.url;
AVAsset *videoAsset = [AVAsset assetWithURL:url];
}
}];
}
} failureBlock:^(NSError *error) {
NSLog(@"error enumerating AssetLibrary groups %@\n", error);
}];