直接使用MPMoviePlayerController中的属性不能获取视频长度和当前播放进度,
需要添加AVFoundation框架,
并引入头文件#import
AVURLAsset *urlAsset = [AVURLAsset URLAssetWithURL:url options:opts];
// 初始化视频媒体文件
int minute = 0, second = 0; second = urlAsset.duration.value / urlAsset.duration.timescale;
// 获取视频总时长,单位秒
NSLog(@"movie duration : %d", second);
if (second >= 60)
{
int index = second / 60;
minute = index;
second = second - index*60;
}