0
我正在尝试使用下面的代码来播放mp3文件。它似乎运行良好,但没有声音来自电话。音量到了,找到了文件(如果我将所请求的文件更改为不存在的名称,则出现错误),并且不会显示错误(即使在“playerError”中也是如此)。我看到的唯一问题可能就是玩家在玩完之前释放,但我不确定如何解决这个问题。任何有关问题可能出现的建议以及如何解决?非常感谢!iOS - mp3文件没有播放,没有错误?
...
if([responseString isEqual: @"Stop"]){
[self playStop];
}
...
- (void) playStop{
NSString *soundFilePath =
[[NSBundle mainBundle] pathForResource: @"stop"
ofType: @"mp3"];
NSURL *fileURL = [[NSURL alloc] initFileURLWithPath: soundFilePath];
NSError *playerError;
AVAudioPlayer *newPlayer =
[[AVAudioPlayer alloc] initWithContentsOfURL: fileURL
error: &playerError];
[newPlayer play];
}
所以你认为这可能是我提出的问题呢? – golmschenk
是的,我很确定这就是发生在你身上的事情。 –