- Home /
Siri stops music
Hello everybody,
I have create a game in iOS which plays music in background but when I open Siri while the game is opened and return to the application, the background music is off and I need to restart the game to reset the music.
If anybody know why this could happen I would be really grateful.
Thanks
Answer by meat5000 · Oct 16, 2015 at 10:22 AM
Detect the focus and use this callback to restart your music.
(You can probably record the position of the music file and use that value to restart at that position)
http://docs.unity3d.com/ScriptReference/MonoBehaviour.OnApplicationFocus.html
Hi,
Thanks for answering but it doesn't work, due to if I go to home screen or open notification tray, the game loses the focus, and if I return to the game the music sounds again.
Are you saying you want the music to keep going when your app has lost focus? Its very likely that Siri kills the sound to use the Audio hardware for itself. Either that or its not capable of cancelling sound from the devices speakers.
For consistency, detect when the app has lost focus and kill the sound manually. Reinvoke it when you regain focus.
Anyway, if without Siri the music works fine, simply add an extra check to the OnFocus to deter$$anonymous$$e if the music is playing. Simple.
Your answer
Follow this Question
Related Questions
iOS music player & youtube mutes sound in app 0 Answers
How to know if my speakers are mute? c# android/ios 0 Answers
2017.1 and iOS music playback 0 Answers
Mute unity app if another external app is playing music in the background on iOS 0 Answers
How to keep music playing when android screen is turned off (or locked)? 0 Answers