Problems with currentPlaybackTime and MPMusicPlayerController and iOS 7.1

一曲冷凌霜 提交于 2019-12-10 09:47:29

问题


Having problems setting currentPlaybackTime with MPMusicPlayerController in iOS 7.1. I used to be able to simply do the following:

MPMusicPlayerController *iPodController =
[MPMusicPlayerController applicationMusicPlayer]; 
iPodController.currentPlaybackTime = 30.0;
[iPodController play];

And the music player would seek to 30 seconds in and play.

As of iOS 7.1 this is not the case.

If I do the following:

[iPodController play];
iPodController.currentPlaybackTime = 30.0;

Then it "may" jump 30 secs in or not. Very inconsistent.

This used to work for all previous iOS versions. Is there a way to fix this?


回答1:


I find that I can't set currentPlaybackTime before playing a given song.

Using your first snippet:

iPodController.currentPlaybackTime = 30.0;
[iPodController play];

setting the currentPlaybackTime property does nothing and I can't seek to the desired playback time. But making the calls the other way around have worked consistently for me with iOS 7.1 so far:

[iPodController play];
iPodController.currentPlaybackTime = 30.0;


来源:https://stackoverflow.com/questions/22540282/problems-with-currentplaybacktime-and-mpmusicplayercontroller-and-ios-7-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!