2010-05-10 73 views
0

我在我们的应用程序中使用Avaudio播放器。播放后,我从列表中播放歌曲,当我回到列表中选择另一首歌曲,然后第一个人也在播放。AVaudio播放器问题

我想停止上一首歌曲,然后播放另一首歌曲。

请帮帮我。

+1

请回到了以前的答案和接受最好的...它的网站的工作方式,你会得到更多的帮助。 – Andiih 2010-05-10 20:06:40

回答

0

[oldplayer stop];

[newplayer start];

您可能还可以通过正确设置你的音频会议达得到这个行为:说

 
     UInt32 sessionCategory = kAudioSessionCategory_MediaPlayback; // Defines a new variable of type UInt32 and initializes it with the identifier 
                     // for the category you want to apply to the audio session. 
     AudioSessionSetProperty (
      kAudioSessionProperty_AudioCategory,      // The identifier, or key, for the audio session property you want to set. 
      sizeof(sessionCategory),         // The size, in bytes, of the property value that you are applying. 
      &sessionCategory           // The category you want to apply to the audio session. 
     );