I took a look at Apple's AddMusic
sample code, but that's not quite what I want. I'm trying to find a way to start/stop music playing in the iPod app, not controlling what's contained in my app's sandbox.
Something like this...
____________
| |
| |< || >| | skip back, play/pause, skip forward
| |
| XXXXXXXX | album art
| XXXXXXXX |
| XXXXXXXX |
| XXXXXXXX |
| |
|____________|
Of course the app is more complex than this, but for now, I want to focus on assuming direct control.
Bonus points to anyone who gets the reference without cheating.
— Artwork loading error moved to a new question.
— Text-to-Speech implementation moved to a new question.
— Progress bar fills to 100% as soon as the song starts. This code works:
// your must register for notifications to use them
- (void)handleNowPlayingItemChanged:(id)notification {
…
// this is what I forgot to do
NSNumber *duration = [item valueForProperty:MPMediaItemPropertyPlaybackDuration];
float totalTime = [duration floatValue];
progressSlider.maximumValue = totalTime;
…
}
// called on a one-second repeating timer
- (void)updateSlider {
progressSlider.value = musicPlayer.currentPlaybackTime;
[progressSlider setValue:musicPlayer.currentPlaybackTime animated:YES];
}