我想从互联网上获取 mp3 文件的持续时间,我使用以下代码:
NSURL *url = [NSURL fileURLWithPath:@"http://view.33591.com:586/2012/11/30/11/4207369.mp3"];
AVURLAsset *asset = [[AVURLAsset alloc] initWithURL:url
options:nil];
CMTime time = asset.duration;
float seconds = CMTimeGetSeconds(time);
NSLog(@"seconds:%f",seconds);
但它总是返回 0,如果我将 url 从包中更改为本地文件,它工作正常。那么有没有办法正确地做到这一点?