Getting duration of video taken by camera iphone s

2019-08-24 01:47发布

I am trying to get the duration of a video taken with the camera using UIImagePickerController on the iphone, has anyone found a solution to this?

Thanks

Daniel

2条回答
爷的心禁止访问
2楼-- · 2019-08-24 02:23

You can now do this using AVFoundation you can make your movie into an AVAsset and then check the duration property

查看更多
家丑人穷心不美
3楼-- · 2019-08-24 02:30

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.

查看更多
登录 后发表回答