【发布时间】:2011-09-25 12:11:54
【问题描述】:
谁能回答如何使用AudioServicesCreateSystemSoundID() 播放mp3 文件?我试过了,但没用。
我用下面的代码sn-p播放mp3
NSURL *soundURL = [[NSBundle mainBundle] URLForResource:fileName withExtension:extension];
soundFileURLRef = (CFURLRef) [soundURL retain];
// Create a system sound object representing the sound file.
AudioServicesCreateSystemSoundID ( soundFileURLRef,&soundFileObject);
【问题讨论】:
-
你能展示你尝试了什么吗?
-
NSURL *soundURL = [[NSBundle mainBundle] URLForResource:fileName withExtension:extension]; //文件名和扩展名在调用函数时给出。 soundFileURLRef = (CFURLRef) [soundURL 保留]; AudioServicesCreateSystemSoundID (soundFileURLRef,&soundFileObject);
-
请不要在 cmets 部分发布代码 sn-ps,因为它们无法正确格式化并且完全不可读。继续更新您的原始问题。
标签: ios objective-c audio mp3 playback