I am converting the .MOV video i get from UIImagePickerController to the .mp4 format using AVAssetExportSession. Once the conversion is completed I send the data to a server. Everything works fine, except the status bar become red and pulsing after the transmission is completed. If I put the app in background and open it again, then the status bar returns to its normal status again.
This is what I think is the piece of code that causes this behavior:
//I took a video
__block NSString *messageType;
__block NSData *messageData;
__block NSString *messageText;
[...]
NSURL *url = [info objectForKey:UIImagePickerControllerMediaURL];
AVURLAsset *avAsset = [AVURLAsset URLAssetWithURL:url options:nil];
NSArray *compatiblePresets = [AVAssetExportSession exportPresetsCompatibleWithAsset:avAsset];
NSString *videoPath = nil;
if ([compatiblePresets containsObject:AVAssetExportPresetLowQuality])
{
AVAssetExportSession *exportSession = [[AVAssetExportSession alloc]initWithAsset:avAsset presetName:AVAssetExportPresetPassthrough];
videoPath = [[NSTemporaryDirectory() stringByAppendingPathComponent:videoDirectory]stringByAppendingPathComponent:tempVideoFileName];
exportSession.outputURL = [NSURL fileURLWithPath:videoPath];
NSLog(@"videopath of your mp4 file = %@",videoPath); // PATH OF YOUR .mp4 FILE
exportSession.outputFileType = AVFileTypeMPEG4;
[exportSession exportAsynchronouslyWithCompletionHandler:^{
switch ([exportSession status]) {
case AVAssetExportSessionStatusFailed:{
NSLog(@"Export failed: %@", [[exportSession error] localizedDescription]);
[picker dismissViewControllerAnimated:YES completion:^{
[SVProgressHUD showErrorWithStatus:[[exportSession error] localizedDescription]];
}];
}
break;
case AVAssetExportSessionStatusCancelled:
NSLog(@"Export canceled");
break;
case AVAssetExportSessionStatusCompleted:{
messageData = [NSData dataWithContentsOfURL:[NSURL fileURLWithPath:videoPath]];
messageText = videoPath;
messageType = kMessageTypeVideo;
// This method sends asynchronously the data to the server
[self sendMediaType:messageType MessageData:messageData MessageText:messageText];
[picker dismissViewControllerAnimated:YES completion:NULL];
}
break;
default:
break;
}
}];
}
Is there a way to avoid the appearance of the red status bar or at least the way I should use to make it disappear?