Dipanjan Dutta
Dipanjan Dutta

Reputation: 85

Video upload works in iOS 4 but not in ios 5

I have an app with which I want to choose photo or video from photo galley and upload them to server. This works fine for ios 4. The code is as follows:

-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{

image_selected = FALSE;
video_selected = FALSE;  
imagePicker.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeImage,(NSString *)kUTTypeMovie, nil];

NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
    image_selected = TRUE;
    imageFrame = [info objectForKey:UIImagePickerControllerOriginalImage];
    NSLog(@"image1 has %@", imageFrame);
    [image setImage:imageFrame];
}else if ([mediaType isEqualToString:(NSString *)kUTTypeMovie]) {
    video_selected = TRUE;
    videoURL = [info objectForKey:UIImagePickerControllerMediaURL];
    NSLog(@"video has %@", videoURL);
    MPMoviePlayerController *mp = [[MPMoviePlayerController alloc]initWithContentURL:videoURL];
    videoFrame = [[mp thumbnailImageAtTime:0.0 timeOption:MPMovieTimeOptionNearestKeyFrame]retain];
    [image setImage:videoFrame];
    [mp release];
}
  [[picker parentViewController] dismissModalViewControllerAnimated:YES];
}

However this does not work in ios 5 (simulator or device). The application freezes as and when the choose button in photo library is selected.

Any help in this regard is much needed.

Upvotes: 0

Views: 123

Answers (1)

self
self

Reputation: 1215

[picker dismissModalViewControllerAnimated:YES];

Upvotes: 1

Related Questions