Search Unity

Bug IronSource / LevelPlay - iOS - Audio is muted after ad is played

Discussion in 'LevelPlay' started by melgeorgiou, Mar 22, 2023.

  1. melgeorgiou

    melgeorgiou

    Joined:
    Nov 3, 2012
    Posts:
    772
    Hi everyone,

    Making progress with IronSource/LevelPlay but stumbled across a quite serious audio issue. Currently only tested with iOS on Unity 2021.3.20f1 on an iPhone XS.

    After playing an Interstitial Ad between levels, Unity's audio becomes totally muted. I can fix this by going to the home screen and coming back to the App, but needless to say, that would not be an actual fix for a release build.

    I found another thread that recommended I uncheck "Mute other Audio Sources" in Player settings. I tried this but didn't work for me ( and I need that setting anyway ).

    Does anyone have any ideas on how to fix this?

    - Mel
     
    Last edited: Mar 22, 2023
    Brother_77 likes this.
  2. yunanhou

    yunanhou

    Unity Technologies

    Joined:
    Feb 23, 2023
    Posts:
    60
    Thanks Mel, according to your description, it appears that app's audio is not resumed after playing an Interstitial, note that there is an API called: setPauseGamem, you can use this API to pause/resume your Unity 3D game activities automatically.

    Please check the details here:

    https://developers.is.com/ironsource-mobile/unity/additional-sdk-settings/#step-3

    If there is problem when using this API or you are still observing some unexpected behavior, please raise a case to LevelPlay support team:

    https://ironsrc.formtitan.com/knowledge-center#/

    Good luck!
     
    sunil_unity240 likes this.
  3. melgeorgiou

    melgeorgiou

    Joined:
    Nov 3, 2012
    Posts:
    772
    Hi @unity_BAACF905F2404E39E2DF,

    Unfortunately, the SetPauseGame API still doesn't make a difference in my case. BTW: I'm also finding that Rewarded Ads do the same thing most of the time as well.

    I've sent another message to the LevelPlay support team. Maybe I'll try reaching out to my contact as well to see if this can be expedited.

    Thanks,

    - Mel
     
  4. melgeorgiou

    melgeorgiou

    Joined:
    Nov 3, 2012
    Posts:
    772
    Hi everyone,

    Just to keep everyone updated on this ( especially other devs ), I was able to narrow down where the issue was coming from. It appears to be an incompatibility between IronSource and Unity's iOS audio recording options in Player Settings - mainly "Mute Other Audio Sources" and "Prepare iOS for Recording".

    The following combinations of settings DO NOT work in IronSource and will result in Unity audio being muted after an ad is played:

    THESE iOS AUDIO SETTINGS CURRENTLY DO NOT WORK WITH IRON SOURCE

    ORIGINAL - DOES NOT WORK.png

    DOES NOT WORK1.png

    DOES NOT WORK2.png

    DOES NOT WORK3.png


    THESE SETTINGS DO WORK WITH IRONSOURCE:

    WORKS!.png

    ... I ran out of image uploads but you can also enable "Force iOS Speakers When Recording" on its own which appears to work too.


    THE PROBLEM:

    For many people, this setting should suffice as a fix but in my case, we have an app that allows users to record audio phrases into the game. We really need "Prepare iOS for Recording" to avoid lag and other issues so this is a problem that really does need to be addressed. Especially as Unity has been pushing IronSource to be implemented by everyone for new projects.

    I've sent a demo project to the IronSource team so I'm hoping this gets fixed soon.

    Hope this helps others!

    - Mel
     
    io-games likes this.
  5. dioras

    dioras

    Joined:
    Dec 17, 2017
    Posts:
    14
    Hey, @melgeorgiou this is a bit out of your thread, but did you manage to integrate Facebook/Meta ads in your ironsource mediation? I'm all good with other networks, but Facebook gives me "no fill" error and it's very annoying lol
     
  6. melgeorgiou

    melgeorgiou

    Joined:
    Nov 3, 2012
    Posts:
    772
    Hi @dioras,

    I haven't gotten that far as I'm still waiting on a fix for the audio problem I mentioned earlier in the thread. The IronSource team is aware of the bug (and apparently others have also reported it) but unfortunately, there is no sign of a fix in sight which has left me a little stranded in my own projects for the moment.

    Probably best to reach out to IronSource and report it. Hopefully they can fix it.

    - Mel
     
  7. dioras

    dioras

    Joined:
    Dec 17, 2017
    Posts:
    14
    Thanks for the quick response! I was in talks with ironsource supports as well and tried to figure it out, but no luck. What I suggest first to firmly confirm the Audience Network account since I think some of the problems may lay there. I'll update if there will be any progress .
     
    melgeorgiou likes this.
  8. melgeorgiou

    melgeorgiou

    Joined:
    Nov 3, 2012
    Posts:
    772
    Just an update to this thread after more than a month. Even with the latest update, the issue has still not been fixed. In addition, I've also found more issues related to LevelPlay and using the microphone.

    Even if you use the settings I posted above that fixes the audio in a default project, if you use the microphone in your game at any time this will cause the next LevelPlay ad you play to make the audio go wild. After the ad completes, there will be a never-ending audio stutter...

    I hope this gets fixed soon.
     
  9. sunil_unity240

    sunil_unity240

    Joined:
    Nov 1, 2022
    Posts:
    3
    // below the code Add it your game it will work in ios

    public void Start()
    {
    IronSource.Agent.SetPauseGame(true);
    }
     
    Last edited: Jun 20, 2023
  10. sunil_unity240

    sunil_unity240

    Joined:
    Nov 1, 2022
    Posts:
    3
    Pause Game
    The API setPauseGame is introduced as part of the ironSource Unity SDK 7.2.4, and is relevant for iOS apps only.

    When setting your PauseGame status to “true”, all your Unity 3D game activities will be paused (Except the ad callbacks). The game activity will be resumed automatically when the ad is closed.

    You should call the setPauseGame API once in your session, before or after initializing the ironSource SDK, and as it affects all ads (Rewarded Video and Interstitial ads) in the session.

    >> below the code Add it your game it will work in ios


    public void Start()
    {
    IronSource.Agent.SetPauseGame(true);
    }
     
    Brother_77 likes this.
  11. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    233

    Have all the audio settings suggested by the OP already off by default, and using the call you suggested about SetPauseGame still does nothing. The game has 0 audio. And whats weird is that even if I reinstall the app the audio is still gone ?

    @melgeorgiou any luck yet ? This is such a bad bug, as there are no errors in xcode logs.

    IronSource.Agent.init("appkey");
     
  12. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    233
    Does not work. Raised the issue with IS, but op has already done that a good few weeks ago. Could you please help somehow ? @yunanhou
     
  13. melgeorgiou

    melgeorgiou

    Joined:
    Nov 3, 2012
    Posts:
    772
    Hi @Brother_77

    Apologies for the late reply.

    It's been 5 months since I reported it and there are no fixes yet on my end, unfortunately.

    Support was very responsive in the beginning but they were unable to fix it. They ended up suggesting I replace the entire audio engine in my game with FMOD which would require converting thousands of objects, rewriting scripts, audio managers, etc. Quite frankly an unfeasible solution - they accepted this was not a good approach to take. Tried to contact support in late April for an update and was ignored. Not promising.

    We were told to use IronSource as the current UnityAds platform was going to be deprecated. Telling people to use IronSource when these kinds of problems exist was probably not the best move on Unity's part - especially when it directly affects the monetisation of apps.

    IMO: Unity really needs to address this - putting their name on an ad service that is incompatible with core features of their own engine is not a good look... Especially after 5 months.

    Hope they do finally get it fixed. If you make any progress with this please let me know!
     
    io-games and Brother_77 like this.
  14. Brother_77

    Brother_77

    Joined:
    Feb 8, 2019
    Posts:
    233
    I got lucky and the problem was that the ios device had a silence switch, and me being a doughnut, somehow switched it mid testing, and though its because of ironsource... Thank you for the detailed answer!
     
    melgeorgiou likes this.
  15. melgeorgiou

    melgeorgiou

    Joined:
    Nov 3, 2012
    Posts:
    772
    Happy to hear you solved your issue.

    BTW: @sunil_unity240, as I mentioned earlier in the thread I already added this and it didn't solve the problem for me.

    I think my issue is specific to the need to use the microphone in the app ( Prepare iOS for Recording setting ). I asked for another update and still no reply yet... lol
     
    Last edited: Jul 17, 2023
  16. francisIsFine

    francisIsFine

    Joined:
    Jun 26, 2018
    Posts:
    40
    Probably not a performant workaround but I solved this by calling AudioSettings.Reset(AudioSettings.GetConfigurations()) upon ad close. I also had to reload the player's bgm/sfx volume preferences on the line after that as the reset wipes it all off. I resorted to this as none of the solutions above completely worked. Turning off 'Mute Other Audio Sources' only fixed it on my older iPhones running iOS15 below
     
    io-games likes this.
  17. melgeorgiou

    melgeorgiou

    Joined:
    Nov 3, 2012
    Posts:
    772
    Hi @francisIsFine,

    Thanks for this! I'm swamped with other projects at the moment but as soon as I get a chance I'll test that out and report back :)

    UPDATE: Finally got a chance to test this and it appears to be working! Thanks for sharing a workaround! :)

    - Mel
     
    Last edited: Aug 2, 2023
    io-games and francisIsFine like this.
  18. francisIsFine

    francisIsFine

    Joined:
    Jun 26, 2018
    Posts:
    40
    Glad that worked! However it seems the problem is back on my end after I've updated the recommended IronSourceSDK v7.4.0. All of a sudden none of the fixes previously mentioned are no longer working. On top of that, it seems the audio now also randomly disappears even when an interstitial loads in the background (during InterstitialAdReadyEvent). I've tried reverting the 7.4.0 update but I think I'm failing on that too as all IronSource references in my script are pointing out that my eventhandlers are deprecated even though it says I'm successfully back to using v7.3 in the Integration Manager panel.

    Honestly this is getting really annoying. Other than this major bug, I've had issues getting live ads to run and setting simple stuff up in their dashboard. If IronSource is the default way forward, integrating it shouldn't be this hard and unpredictable.
     
    io-games and melgeorgiou like this.
  19. melgeorgiou

    melgeorgiou

    Joined:
    Nov 3, 2012
    Posts:
    772
    That's not good. I haven't updated it yet but now it seems I'll wait it out a bit longer. I had the same headaches getting ads to work and I've had to contact IronSource in the past just to enable the ads from their end.

    Totally agree. This is really disappointing. Even worse, I've still had no response from IronSource / Unity about this. They have ignored several of my follow up emails about this issue so far over the last few months. When you consider that monetisation is the lifeblood of developers - this is quite unacceptable, really.

    If you do manage to find another workaround please do share - I'll do the same!

    - Mel
     
  20. francisIsFine

    francisIsFine

    Joined:
    Jun 26, 2018
    Posts:
    40
    Alright, some new findings. It seems the audio now also disappears when a RewardedVideoAd is trying to load in the background. I found this out when I set IronSource to load rewardedVideoAds manually via IronSource.instance.setManualRewardedVideo(). Perhaps my previous workaround of calling AudioSettings.Reset() on RewardedVideoAdClose was still working but gets overridden when a new ad gets requested after that. The funny thing is I've also tried running AudioSettings.Reset() on the RewardedVideoAvailableEvent in hopes of bringing audio back after the manual request but that callback for some reason never fires—hilarious... That explains why I thought I was randomly losing Audio — cause I had set the manual load to fire in the background whenever it's convenient, but it never resolves so the workaround just sits there waiting. So to sum up, still got no solutions. Just providing what I've found so far...
     
    melgeorgiou likes this.
  21. melgeorgiou

    melgeorgiou

    Joined:
    Nov 3, 2012
    Posts:
    772
    Wow. They've somehow managed to make a critical bug even worse. How this made it to production is beyond me.

    I'm currently caught up in other contract work and haven't had a chance to dig into this yet. I appreciate the update though!

    - Mel
     
  22. drazuerg

    drazuerg

    Joined:
    Jan 31, 2014
    Posts:
    62
    Hello there !
    I know it's a bit old but @melgeorgiou @francisIsFine did you get any update so far on this issue ?
    I've ran into this a few weeks ago but it appears so randomly that I couldn't easily narrow it down, but looking at this thread it might be related to IronSource on my end as well.
    Unity 2021.3.32 (although I also observed this issue on 2021.3.17) and IronSource 7.5.2.0. Tested on iPhone 6S with iOS 13.5.1, but I've also observed it on a relative playing my game on a much more recent iPhone.

    Thanks !
     
  23. melgeorgiou

    melgeorgiou

    Joined:
    Nov 3, 2012
    Posts:
    772
    @drazuerg,

    Nope. Unfortunately, they pretty much ghosted my emails and I ended up having to switch to a different ad network - although there was no shortage of different issues there too, but at least there was a somewhat workable solution in the end.

    Hopefully, others had better results than me, lol.

    - Mel
     
  24. io-games

    io-games

    Joined:
    Jun 2, 2016
    Posts:
    104
    Same issue, IronSource SDK 7.7.0 + Unity 2022.3.15f + Fmod + iphone 11 iOS 16.3.1
    No sound in game after Ad.

    UPD 1
    Interesting links with investigation
    https://qa.fmod.com/t/muting-pausing-sound-while-playing-ironsource-ads-on-ios/20196
    https://qa.fmod.com/t/ingame-ads-sound-auto-break-problem/17353/4

    UPD 2
    It seems the issue fixed after combination of

    1) in Unity at FMOD → Edit Settings → Platform Specific → iOS → DSP buffer length - 4096
    (not sure it's step required)

    2) FMODUnity.RuntimeManager.PauseAllEvents(true);
    FMODUnity.RuntimeManager.CoreSystem.mixerSuspend();
    just before your ads play, and then resume operation with

    FMODUnity.RuntimeManager.PauseAllEvents(false);
    FMODUnity.RuntimeManager.CoreSystem.mixerResume();
    when the ads finish.
     
    Last edited: Feb 13, 2024
  25. namtran_amanotes

    namtran_amanotes

    Joined:
    Mar 18, 2019
    Posts:
    3
    hello there

    in our games, we have to call reset the audio session after ad close to resolve that problem

    Code (CSharp):
    1. extern "C" void ActivateAudioSession()
    2. {
    3.     UnitySetAudioSessionActive(1);
    4. }