문제

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!

도움이 되었습니까?

해결책

I figured it out, use this:

SBMediaController *mainMediaController = [%c(SBMediaController) sharedInstance]; 
[mainMediaController pause];
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top