本文实例为大家分享了iOS获取本地音频文件的具体代码,供大家参考,具体内容如下DfV免费资源网
获取本地音频文件地址:DfV免费资源网
NSString *songsDirectory=MUSIC_FILE_ALL;//沙盒地址
NSBundle *songBundle=[NSBundle bundleWithPath:songsDirectory];
NSString *bundlePath=[songBundle resourcePath];
NSArray *arrMp3=[NSBundle pathsForResourcesOfType:@"mp3" inDirectory:bundlePath];
for (NSString *filePath in arrMp3) {
[self.wMp3URL addObject:filePath];
}
解析音频文件属性:DfV免费资源网
-(void)mDefineUpControl{
NSString *filePath = [self.wMp3URL objectAtIndex: 0 ];//随便取一个,说明
//文件管理,取得文件属性
NSFileManager *fm = [NSFileManager defaultManager];
NSDictionary *dictAtt = [fm attributesOfItemAtPath:filePath error:nil];
//取得音频数据
NSURL *fileURL=[NSURL fileURLWithPath:filePath];
AVURLAsset *mp3Asset=