Find the duration of a mp4 - iPhone SDK
How can I f开发者_如何学运维ind the duration of a mp4 file to hours and minutes. I have tried loading the URL in a MPMoviePlayerViewController and use the duration property which I then convert the nstimeinterval to a string but it always results in 0. Is there any method to do this?
Thanks,
Kevin
You may have to wait for the MPMovieDurationAvailableNotification to be fired before you check the duration. From Apple's MPMoviePlayerController Class Reference,
This notification is posted when the duration of a movie object is determined. The object of the notification is the MPMoviePlayerController object itself. There is no userInfo dictionary. The duration value is reflected in the duration property of the movie player controller.
精彩评论