2010-05-10 70 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. 
     );