AVURLAsset*audioAsset=[AVURLAssetURLAssetWithURL:audioFileURL options:nil]; CMTimeaudioDuration=audioAsset.duration; floataudioDurationSeconds=CMTimeGetSeconds(audioDuration);
AVURLAsset*audioAsset=[AVURLAssetURLAssetWithURL:audioFileURL options:nil]; CMTimeaudioDuration=audioAsset.duration; floataudioDurationSeconds=CMTimeGetSeconds(audioDuration);
本文标题:iOS 获取音频或是视频的时间
本文链接:https://www.haomeiwen.com/subject/nsszsttx.html
网友评论
- (CGFloat)durationWithVideo:(NSURL *)videoUrl{
AVURLAsset* audioAsset =[AVURLAsset URLAssetWithURL:videoUrl options:nil];
CMTime audioDuration = audioAsset.duration;
float audioDurationSeconds =CMTimeGetSeconds(audioDuration);
return audioDurationSeconds;
}
我用的没问题啊