Start a new topic
Solved

Audio keeps playing when the app is minimized

Hi,


We integrated the JS SDK WIkitude 9.5. We have a looping sound running after the 3D has been placed.

On iOS (native, not Unity), if the user exits the app, the sound is still playing.


Any suggestions about how to prevent this?


Hi George,


could you please provide some further details:


  • What device does this happen with (model details and OS version)? Is it happening on different iOS devices?
  • Is this happening with the sample app or in your own app? If it happens with your own app, does the sample app work on your device when you change the experience code?
  • Could you send exact steps to reproduce the issue? Do you make sure to stop the sound once you exit the experience?


Thx and greetings

Nicola

Hi Nicola,


Thanks for the follow up. My device is a iPhone 11 Pro with iOS 14.7.1 

I think this also happens on other devices, like the iPhone 12. (because others noticed it too and sent me the feedback)


I checked the sample app and this behaviour does not happen in the sample app.


I found that the app is using this Audio background mode ON, in the project settings, I think for playing music tracks. (The app is a large one and we are only taking care of the AR component)


If I remove this setting, the sound does not carry on in the background. However that setting is needed for the music stream. 

Any idea on how we can stop the sound coming from the Architect World when the app is getting hidden and resume it when it comes back on?


Thank you.

I just managed to find a solution for this:


- registered to get notified when the app goes in and out of the background:

    __unsafe_unretained ARViewContentController *weakSelf = self;
    [[NSNotificationCenter defaultCenter] addObserver:weakSelf selector:@selector(didReceiveApplicationWillResignActiveNotification:) name:UIApplicationWillResignActiveNotification object:nil];
    [[NSNotificationCenter defaultCenter] addObserver:weakSelf selector:@selector(didReceiveApplicationDidBecomeActiveNotification:) name:UIApplicationDidBecomeActiveNotification object:nil];

- stopped / started the architect world when those events got triggered.

 

- (void)didReceiveApplicationWillResignActiveNotification:(NSNotification *)notification
{
    [self stopArchitectViewRendering];
}

- (void)didReceiveApplicationDidBecomeActiveNotification:(NSNotification *)notification
{
    [self startArchitectViewRendering];
}

 Thank you for your help.

Login or Signup to post a comment