2

I am making a jailbroken iOS tweak and have a question. How can I stop all device audio while running from the background. Example: The user is playing Spotify and then clicks the power button on the device(turning off the screen and putting it to sleep) meanwhile Spotify is still playing music. At this point how can I stop stop all audio on the device(whether it's Spotify, default music app, Pandora, or whatever)? I have look into AVAudioSession and AVAudioPlayer but have not found a consistent reliable method to do this. I am testing this on a jailbroken iPhone5 running iOS7.0.4.

I am open to using AVAudioSession or AVAudioPlayer if it works consistently. I am also open to using something from a private framework to accomplish this. Thanks!

Thanks!

Praxder
  • 2,315
  • 4
  • 32
  • 51
  • The control center is capable of pausing any audio right? Maybe digging around SpringBoard code regarding that might help you out. – David Zech Apr 03 '14 at 23:58
  • Thanks, I found it! For future reference for anyone with the same question you can stop audio by using this line of code:`[[%c(SBMediaController) sharedInstance] stop];` – Praxder Apr 04 '14 at 16:34
  • Actually I lied, use this:`SBMediaController *mainMediaController = [%c(SBMediaController) sharedInstance]; [mainMediaController pause];` – Praxder Apr 04 '14 at 17:12

1 Answers1

2

I figured it out, use this:

SBMediaController *mainMediaController = [%c(SBMediaController) sharedInstance]; 
[mainMediaController pause];
Praxder
  • 2,315
  • 4
  • 32
  • 51