(IOS)获取视频的时长

+ (NSInteger)getVideoTimeByUrlString:(NSString*)urlString {

    NSURL*videoUrl = [NSURLURLWithString:urlString];

    AVURLAsset *avUrl = [AVURLAsset assetWithURL:videoUrl];

    CMTimetime = [avUrl duration];

    intseconds = ceil(time.value/time.timescale);

    returnseconds;

}

你可能感兴趣的:((IOS)获取视频的时长)