1、首先用音频文件路径创建一个URL
2、根据url创建 AVURLAsset
AVURLAsset *audioAsset = [AVURLAsset URLAssetWithURL:voiceURL options:nil];
3、取时长
CMTime audioDuration = audioAsset.duration;
audioTime = CMTimeGetSeconds(audioDuration);
1、首先用音频文件路径创建一个URL
2、根据url创建 AVURLAsset
AVURLAsset *audioAsset = [AVURLAsset URLAssetWithURL:voiceURL options:nil];
3、取时长
CMTime audioDuration = audioAsset.duration;
audioTime = CMTimeGetSeconds(audioDuration);