How do you get an iphone MPMoviePlayer video's

2019-03-31 04:53发布

I just want to figure out how to get a video's total time in seconds. Is there video metadata that loads or something?

3条回答
你好瞎i
2楼-- · 2019-03-31 05:15

MPMoviePlayerController has a property duration (iOS 3.2+):

The duration of the movie, measured in seconds. (read-only)

@property (nonatomic, readonly) NSTimeInterval duration

If the duration of the movie is not known, the value in this property is 0.0. If the duration is subsequently determined, this property is updated and a MPMovieDurationAvailableNotification notification is posted.

查看更多
The star\"
3楼-- · 2019-03-31 05:23

Why dont you simply use the (NSTimeInterval)duration property to get the videos length??

查看更多
神经病院院长
4楼-- · 2019-03-31 05:36

Get the length of the video in bytes using NSdata. After that calculate how many bytes for playing one second of video. And you can calculate the length of the video:)

查看更多
登录 后发表回答