2

I am working on a IOS app that I want to have the functionality to pause and unpause music that is currently playing through the ipod, just like the ipod's play/pause button. Is there anyway to do that through IOS? The only answers I have found for this is for dealing with songs and sounds played locally through the app.

Any help would be fantastic. Thanks so much!

Matthieu Brucher
  • 21,634
  • 7
  • 38
  • 62
user879702
  • 211
  • 1
  • 2
  • 5

1 Answers1

7
[[MPMusicPlayerController systemMusicPlayer] play];
[[MPMusicPlayerController systemMusicPlayer] pause];
SimplyKiwi
  • 12,376
  • 22
  • 105
  • 191
Ole Begemann
  • 135,006
  • 31
  • 278
  • 256
  • 1
    These methods aren't obvious in the MPMusicPlayerController docs because they're defined in the MPMediaPlayback protocol this class conforms to. – David Gish Oct 17 '12 at 22:24
  • 1
    as of iOS8 use `systemMusicPlayer` instead of `iPodMusicPlayer` – ToddB Oct 29 '14 at 19:37