问题
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