Following code used to save videos to photo Album.
else if ([mediaType isEqualToString:(NSString *)kUTTypeMovie])
{
NSString *sourcePath = [[info objectForKey:@"UIImagePickerControllerMediaURL"]relativePath];
UISaveVideoAtPathToSavedPhotosAlbum(sourcePath,nil,nil,nil);
}
If it is video i want to play it if it is image i want to display it.
Help Me.
In your
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
method, you can get the url of the video and play it:Of course, you'll have to import the
MediaPlayer.framework
EDIT: A majority of Cocoa projects now use
arc
, so the above code would require you retain theMPMoviePlayerController
instance yourself (as mentioned in this answer).with the code check if is image or video :
To Play the video check the URL.
EDIT: