简体   繁体   中英

A way to check chosen video file from UIImagePickerController before compression?

I need to check if the chosen video file had not been chosen before

Actually the scenario looks like:

  1. User taps a video from the library (UIImagePickerController)
  2. Preview screen shows
  3. User taps Choose button
  4. Compressing Video progress bar appears.
  5. imagePickerController:didFinishPickingMediaWithInfo delegate is being called.
  6. Here I can check if the chosen video file had not been chosen before.

The problem is the time of compression (if the chose file is large) can take several minutes.

So the questions is:

Is there a way to check the chosen video file from UIImagePickerController before the compression starts?

Add Framework- CoreMedia.Framework

import "MobileCoreServices/UTCoreTypes.h"

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSString *type = [info objectForKey:UIImagePickerControllerMediaType];

if ([type isEqualToString:(NSString *)kUTTypeVideo] ||
    [type isEqualToString:(NSString *)kUTTypeMovie]) {


}
}

It will show only videos in the Album.

This is not possible as far as I can tell with UIImagePickerController. You may want to look into the ALAssetsLibrary.framework for another way to achieve the result you're looking for.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM