- Home /
Unity sounds not playing after AVAudioSession is disabled
I'm currently working on a iOS plugin. I'm trying to change the category of the app's AVAudioSession in order to implement audio ducking (i.e. Music app volume goes down while my sound effects are playing), which requires the AVAudioSession to be set as inactive and then as active again.
Well, after I set the session as inactive by using [[AVAudioSession sharedInstance] setActive:NO error:nil]
, Unity sounds simply won't work anymore, even after the session is set as active again. Native sounds still work, as I tested an AVAudioPlayer and it works perfectly.
Any idea on what's wrong?
Answer by daniel_liu · Aug 05, 2015 at 12:57 AM
UnitySetAudioSessionActive(true);
Solve this issue.
Perfect! Thanks a lot for the help. I really appreciate it!
By the way, in case someone else is working on something similar: ins$$anonymous$$d of setting the AVAudioSession off by using the code I posted in the question, you should use UnitySetAudioSessionActive(false);
You're a lifesaver, this also fixes the issue when using $$anonymous$$P$$anonymous$$usicPlayerController in conjuction with configuring the AVAudioSession which will kill all AVAudioSessionAudio
Your answer
Follow this Question
Related Questions
Native Alert on iOS (plugin) 1 Answer
Native GUI-Style on IOS 2 Answers
How to get local currency u3dxt 1 Answer
Access photos, videos & music from iOS and Android library? 0 Answers