I have this code:
[self.musicPlayer stop];
[self.musicPlayer setQueueWithQuery:persistentQuery];
[self.musicPlayer play];
But for some reason, you only hear the first split second of a song the first time. Then the second time, you hear the song. Doing a sort of patch-fix with:
[self.musicPlayer stop];
[self.musicPlayer setQueueWithQuery:persistentQuery];
[self.musicPlayer play];
[self.musicPlayer stop];
[self.musicPlayer play];
doesn't work - this only makes it开发者_开发技巧 play the first split second every time.
I had a similar problem in that a MusicPlayer object would not play when the play method was first called. I found I had to setup the musicPlayer object earlier in the app life cycle i.e. set it up before you require it.
精彩评论