iPhone: How to find the duration of the album video? - iphone

I am picking video from photo album programmatically. I don't have any issues on that. I am able to retrieve the video path etc from the following delegate method.
- (void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
But, i want to find out the duration of the video here. Is it possible to find out the duration of that video which i have chosen from photo album?
Please advise!
Thank you!

Related

How to reuse camera after take a photo?

I have a simple question: how to use (show) again a camera after take a photo?
I use UIImagePickeController and when the photo was taken (Use button was tapped) we go to delegate:
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
How to tell camera to appears one again?

Get video from photo album & save it to image view in app

Currently I am developing an app in which I want to get photo album saved video and then show selected
video in image view & then later on send this video to Facebook. I successfully open the photo album
but now how can i save selected video in image view of app.
I think you have used UIImagePickerController to open the photo album (mediaType will be kUTTypeMovie)
Use the below UIImagePickerController delegate to get the videoUrl and Its thumbnail
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSURL *videoURL = [info valueForKey:UIImagePickerControllerReferenceURL];
UIImage *videoThumbnail = [info valueForKey:UIImagePickerControllerOriginalImage];
You can save the videoURL and retrieve the Video later using ALAsset_Class or even you can set the url to moviePlayer. [moviePlayer setContentURL:movieURL];
You can use the videoThumbnail to deal with UiImages
Finally, do a Google search to Share video to Facebook.

URL for video selected from camera roll

I am able to launch camera roll from my app. I want to get the URL of the video when it is selected by a user, because I want to use it for asset reading/writing.
Is it possible to get the URL of the selected video from camera roll ? If yes, how ?
Thanks.
Set the UIImagePickerControllerDelegate to your class and use this code to retrieve the url.
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{
[self dismissModalViewControllerAnimated:YES];
NSURL *assetURL = [info objectForKey:UIImagePickerControllerReferenceURL];
}
This is a good resource:Accessing the Camera and Photo Library from an iOS 4 iPhone Application

iphone : can't get edited image in uiimagepickercontroller after zooming with type camera

i am pretty stuck in middle of something
i am trying one demo app for UIImagePickerController type camera, and trying to zoom-in/out with camera overlay view using transform scaling matrix.
Well i have done zoom-in/out successfully, but now i want to get captured image in UIimageView, i am getting original image in
- (void)imagePickerController:(UIImagePickerController *)picker1 didFinishPickingMediaWithInfo:(NSDictionary *)info
delegate method but cant get zoomed/scaled edited image into the UIImageView.
So here i have searched lot, but cant get rid of it, i hope you guys will help me out.
your help will be really appreciated.
There are two options:
Retrieve the edited image from the
info dictionary. Key: UIImagePickerControllerEditedImage
If that doesn't work, there is more
info in the dictionary: UIImagePickerControllerCropRect
This is in the delegate method: didFinishPickingMediaWithInfo:(NSDictionary *) info
I assume that you know how to get a image into the imageview.

copy video from iphone using the UIImagePickerController?

Hey, I know that when a user selects a Video I do get a URL for the video.... but can you direct me to a proper implementation because my App just sticks there when I click choose in the simulator and I cannot navigate away from the Video Player page....
Any good tutorial on this?
Once you select the video - execution flows to the following function:
(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
.... code here .....
//get the videoURL
NSString* videoURL= [info objectForKey:UIImagePickerControllerMediaURL];
//IMPORTANT: remember to test that the video is compatible for saving to the photos album
UISaveVideoAtPathToSavedPhotosAlbum(videoURL, self, #selector(video:didFinishSavingWithError:contextInfo:), nil);
.... code here .....
}
Take a look into 'UISaveVideoAtPathToSavedPhotosAlbum' specifically. This allows saving to the camera roll.