Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8716663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T06:08:19+00:00 2026-06-13T06:08:19+00:00

I see a lag in the display when trying to turn off the ambient

  • 0

I see a lag in the display when trying to turn off the ambient music (eg Music player or Spotify) for a sound effect. I’m using AudioServicesPlaySystemSound to play the effect itself. I use the following to start the session and play music in the background.

[audioSession setCategory:AVAudioSessionCategoryAmbient error:nil];    

Then I set the category to playback to stop the music to make way for my effect

 [[AVAudioSession sharedInstance] setCategory:AVAudioSessionCategoryPlayback error:nil];

and use the following to restart the music

[[AVAudioSession sharedInstance] setActive:NO withOptions:AVAudioSessionSetActiveOptionNotifyOthersOnDeactivation error:nil];

This feels stupidly hacky and the setCategory:AVAudioSessionCategoryPlayback produces a delay in the display as the volume dies.

What’s the correct way of muting background music?

Thanks, Steve

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T06:08:20+00:00Added an answer on June 13, 2026 at 6:08 am

    First of all, I’m not sure why you set the category to AVAudioSessionCategoryPlayback. Unless you really need to continue playing your sound effect with the silent switch off/the phone locked you should probably pick AVAudioSessionCategorySoloAmbient instead, which also mutes background sounds. Once you are done with playing your sound effect, you can switch back to ambiant.

    If playback is really what you need (because you have an alarm clock or something), you might consider switching to playback category right away, then set the kAudioSessionProperty_OverrideCategoryMixWithOthers property so the background sound is still playing, then switch that one off if you want it muted but you should first really make sure playback category is really needed.

    Alternatively, did you consider just ducking the background sound instead of muting it? Maybe you can stay at the ambiant category and just set the kAudioSessionProperty_OtherMixableAudioShouldDuck audio session property when you are playing the effect (and reset it afterwards). That means the background sound is reduced in volume when you do your effect which may be more desirable depending on what your app is doing.

    Last but not least, I’ve never used AudioServicesPlaySystemSound and it may not work with mixing or ducking, so you might need to switch to AVAudioPlayer.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

see fiddle if patient has time slot alloted already then make color yellow using
See this question. How to show popup message like in stackoverflow I am trying
I am using VideoView to display a video in my app. The problem is
I'm using MBProgressHud to show a load indicator. Here is my display code: self.hud
See Deepa answer for the solution :) I read all of the solution given
See the picture below. It's a flash game from a well known website :)
See here: http://jsfiddle.net/zYcJm/ The jQuery should be validating each field to check if they
see fiddle Firstly i am new to jquery. i have to make one cell
see fiddle I want to drag the mouse on cell and whatever is under
see fiddle i have html table and one textbox and one button.make cell selection

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.