uiimagepickercontroller video duration - photo library - iphone

Am developing a app which will upload video to the server which is picked form local iphone photo library.
here i want to restrict the user not to upload more than 3min of video..Question is how to get the duration of the video which is picked from local photo library using uiimagepickercontroller.
will it contain any property for that..?
Thanks

I am not sure but did u try imagePickerController.videoMaximumDuration = urDuration;

You can get the size of your videofile.If you want to put check according to the size that is possible or you can get the duration by using mpmovieplayer class but for that you have to get the full video file .I dont think so you want to do this so its gud if you can put a check according to the size.

Related

iOS 6 in app camera

Im building an app that allows the user to record a video (in app) by pressing a button on the main screen. I don't want the user to be taken to the photo app because the video will only be able to be viewed on the app (Max of 15 seconds) and I can't quite get it. Anyone have the code to do this? A good example of what i want the camera to do is the camera in the app Cinemagram. Thanks for any help.
If you plan on saving the movie to the user's photo library, then you can use UIImagePickerController. In particular, you should read the guide that accompanies the class.
However, if you only want the video to be temporary, then you will probably want to use AVFoundation. You would then need to configure an AVCaptureSession with an AVCaptureMovieFileOutput to write the video to disk. Then, when you are ready to play the video, create an AVURLAsset with the file url that you just wrote, use that to create an AVPlayer to play the video, and add an AVPlayerLayer to your view, with said player, to display the video.
Either way, I would recommend studying the examples that Apple provides.
AVCam and
AVPlayerDemo should be more than enough to get you started (especially the AVCam example project).

Is there any standard fileopen dialog in iphone programming?

I want to create application, that will process images(mostly - photographs from mobile camera).
So i need at first to provide the way to open image file from phone memory.
how can i do that?
Sorry for such a stupid question, but i am newbie in iphone programming(yet:)).
P.S. I use xcode, cocoa
You can use UIImagePickerController to get a standard interface for selecting a photo from the user's library or camera roll. Depending on the configuration, it can also be used to capture a new image with the camera. Note however that you get a UIImage back, not a file, if you want to upload it somewhere, you will first have to create a file or NSData object from the image, using either UIImagePNGRepresentation() or UIImageJPEGRepresentation().

video trimming in uiimagepicker

I was able trim the video when i used the photo library source type. But when I use the camera source type trimmed video appears to be saved. but when i play the saved video it is not trimmed. Can any one pls help me with this?
It looks like you can't use uiimagepicker AND get the edited video. You have to use UIVideoEditorController.
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIVideoEditorController_ClassReference/Reference/Reference.html#//apple_ref/occ/cl/UIVideoEditorController

Is there a way to get paths of all the images of CAmera roll

Is there any way to create an array or something
having paths of all the images stored in camera roll.
Please enlighten me on this.
Thnx in advance
SpyPhone uses a direct path to the users photo library:
http://github.com/nst/spyphone/
It seems that any application can read it. However, this seems like falls under the area of "undocumented API" and could well be rejected in a real application.
I don't think there is. As far as the API is concerned for the UIImagePickerController you can only get a single path for a Movie that was recorded by the user (if running 3.0 on a 3GS). And even that path is a file URL to the temporary folder where the movie is stored before being written to the library.
You can't get paths for any images in the photo library or the camera roll.
When you pick an image using the UIImagePickerController the controller returns the Original Image and an "Edited Image" if the image was edited before being chosen.

Save photo to iphone camera roll with a custom name

I am trying to save a photo taken from my app to camera roll, this can be done by using UIImageWriteToSavedPhotosAlbum, however, I noticed there isn't any way to set the photo name by using this approach, am I right?
I also tried to save a image file with a name by using UIImageJPEGRepresentation, however, I can only save it to my app's document folder but not camera roll.
Is there any way to save photo to camera roll with a custom name?
Thanks advance for your kindly help.
John
no, no way to save with a custom name to the camera roll.
There is a way to kinda do that, by setting the image metadata:
if you set the IPTC metadata field "Object Name", this will be shown as the image title in iPhoto.
See details (and code) at http://ootips.org/yonat/how-to-set-the-image-name-when-saving-to-the-camera-roll/ .