# iOS sounds not working after watching an ad in Safari

**URL:** <https://qa.fmod.com/t/ios-sounds-not-working-after-watching-an-ad-in-safari/22974>\
**Category:** FMOD Engine\
**Tags:** ios, csharp\
**Created:** [May 25, 2025, 6:07pm UTC](https://qa.fmod.com/t/ios-sounds-not-working-after-watching-an-ad-in-safari/22974 "2025-05-25T18:07:40Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![janne-hmp](https://avatars.discourse-cdn.com/v4/letter/j/0ea827/32.png) [@janne-hmp](https://qa.fmod.com/u/janne-hmp)\
**Post date:** [August 4, 2025, 9:57am UTC](https://qa.fmod.com/t/ios-sounds-not-working-after-watching-an-ad-in-safari/22974/5 "2025-08-04T09:57:37Z")

</div>

I now implemented the other proposed fix, and it seems to solve the issue without increasing latency. Also, SoloAmbient category didn’t seem to do anything for me, so I kept the category at Ambient as before. So the final solution to the problem (using .NET for iOS bindings) is as follows for me (SetCategory and SetActive were there before):

> ```csharp
> _coresystem.getSoftwareFormat(out int systemSampleRate, out _, out _);
> _coresystem.getDSPBufferSize(out uint systemDSPBufferLength, out _);
> SetAudioSessionSettings(systemSampleRate, systemDSPBufferLength);
> 
> private void SetAudioSessionSettings(double rate, double blockSize)
> {
> #if IOS
> AVAudioSession si = AVAudioSession.SharedInstance();
> if (si != null)
> {
> Debug.WriteLine("SetAudioSessionSettings: rate is " + rate + ", blockSize is " + blockSize);
> try
> {
> NSError audioSessionError;
> double bufferDuration = blockSize / rate;
> si.SetPreferredIOBufferDuration(bufferDuration, out audioSessionError);
> si.SetPreferredSampleRate(rate, out audioSessionError);
> si.SetCategory(AVAudioSessionCategory.Ambient);
> si.SetActive(true);
> }
> catch (Exception ex)
> {
> Debug.WriteLine("Exception occurred with AVAudioSession: " + ex.Message);
> }
> }
> #endif
> }
> 
> ```

---

_[View the full topic](https://qa.fmod.com/t/ios-sounds-not-working-after-watching-an-ad-in-safari/22974)._
