Is there a way to access the metadata (such as width and height of the video) via iOS SDK for m4v inside the resource bundle? I would like to use this info to center the video around the screen boun开发者_如何学运维ds.
On a mac this would be easy, because you can utilise the spotlight metadata, but on iOS it's slightly more complicated. A couple of suggestions:
The easiest way to do this is just to load your movie into an MPMoviePlayerController
and check the naturalSize
property. There are a number of other properties including playableDuration
. The downside to this is you have to load the movie into an MPMoviePlayerController, which may be fine for you if you're going to play the file straight away.
The harder but more efficient way is to use the open source libmediainfo library, but it's obviously more complex to integrate than using an MPMoviePlayerController 'out of the box'.
精彩评论