Getting duration of video taken by camera iphone sdk
I am trying to get the duration of a video taken with the camera using UIImagePickerController on the i开发者_Go百科phone, has anyone found a solution to this?
Thanks
Daniel
You can now do this using AVFoundation you can make your movie into an AVAsset and then check the duration property
Oh, why, hello hopelessly obsolete answer. I'm afraid you're only left here as historical evidence that yes, before iOS 4 if you wanted to do anything remotely interesting on a recorded video (besides playing it) you had to implement the processing yourself.
I don't know of any framework function to do so, so I'm afraid you'll have to parse the video container yourself (which by the way, is QuickTime/.mov) to extract this info. It's not like it's not documented. Luckily since the provider is known, you can trust all info to be truthful, which you can't assume of random videos found on the web.
精彩评论