为什么我的音乐第一次无法播放?
我有这样的代码:
[self.musicPlayer stop];
[self.musicPlayer setQueueWithQuery:persistentQuery];
[self.musicPlayer play];
但由于某种原因,你第一次只能听到一首歌的第一个瞬间。然后第二次,你听到这首歌。使用以下命令进行某种补丁修复
[self.musicPlayer stop];
[self.musicPlayer setQueueWithQuery:persistentQuery];
[self.musicPlayer play];
[self.musicPlayer stop];
[self.musicPlayer play];
是行不通的——这只会让它每次都播放第一个瞬间。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我遇到了类似的问题,第一次调用 play 方法时 MusicPlayer 对象不会播放。我发现我必须在应用程序生命周期的早期设置 musicPlayer 对象,即在需要它之前设置它。
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.