Question

How can I find 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

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top