forum

Home / DeveloperSection / Forums / How to set session AVAssetExportSession in ios?

How to set session AVAssetExportSession in ios?

marcel ethan 2233 17-Oct-2014
NSArray *pres = [AVAssetExportSession exportPresetsCompatibleWithAsset:asset];
        if([pres containsObject:AVAssetExportPreset640x480]) {
            AVAssetExportSession *session = [[AVAssetExportSession alloc]initWithAsset:asset presetName:AVAssetExportPreset640x480];
            FileManagerUtilities *fUtil = [[FileManagerUtilities alloc]init];
            session.outputURL = [NSURL fileURLWithPath:[fUtil searchPathDirectory:NSDocumentDirectory byAppendingDirectoryPath:nil andFileName:@"tempVideo.mov"]];
            session.outputFileType = AVFileTypeQuickTimeMovie;
            session.fileLengthLimit = 10.0;
            [session exportAsynchronouslyWithCompletionHandler:^{
                switch ([session status]) {
                    case AVAssetExportSessionStatusFailed:
                        NSLog(@"Export failed: %@", [[session error] localizedDescription]);
                        break;
                    case AVAssetExportSessionStatusCancelled:
                        NSLog(@"Export canceled");
                        break;
                    default:
                        break;
                }
            }];
        }
I am trying to set session.fileLengthLimit to 10mb but don't know what mistake I am doing. Unable to limit the size to 10mb, how to set fileLengthLimit to 10mb.

Updated on 18-Oct-2014

Can you answer this question?


Answer

1 Answers

Liked By