开发者

Why does my music not play first time?

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜