- Home /
Pause game music when video ad running
I want to pause my background music when my device running video ads. For this stuff, I have written this code.
void OnApplicationPause (bool pause)
{
Debug.Log("pause : " + pause);
if(pause)
SoundManager.Instance.PauseGameMusic();
else
SoundManager.Instance.PlayGameMusic();
}
But in my iphone, this code is not working at all. Basically my goal is to pause game music at the time of video playback.
Please give me some suggestion for this.
there is another callback, something with focus, check it out
on iPhone, OnApplicationFocus event is also not going to call at all. I checked with debug statement.
Answer by siddharth3322 · Jan 25, 2016 at 01:07 PM
Actually I can able to solve this problem through my way only. Some sort of thinking, I have strike in mind then decided and implemented following thing.
Just when ad is about to display on screen before that call I put a statement for pausing game music. When ad is closed by player at that time close event is fired but listener, in this place I have added statement to playing music again.
Here I pasted this give idea to other members who face similar problem like mine. But this is true I didn't able to get call of OnApplicationPause method in iPhone device.
Answer by WingBro · Jan 22, 2016 at 04:39 PM
Try AudioListener.pause
But when to do AudioListener.pause()
how can I know now I have to pause my background music.
Your answer
Follow this Question
Related Questions
How do i add/import sound effects and/or music into my game? 5 Answers
Free soundtrack making tool 2 Answers
Can I use any song in my game ??? 2 Answers
Cant import music and sound 0 Answers
Siri stops music 1 Answer