Author Topic: No sound after returning to iOS app  (Read 103 times)

Zarqon

  • Posts: 2
No sound after returning to iOS app
« on: 13 Feb '18 - 09:41 »
I built a simple player app by using libbass.a under iOS 11 (Swift). By tapping one button the playback starts, by tapping an other button it stops. This works fine so far. 
After stopping the playback I press the home button to return to the home screen. I start another player app (f.e. Spotify) and listen to some music there. 
Then I return to my own app and tap the play button and - there's suddenly no sound. The mp3 file is playing but I can't hear anything. 
Is there a special function to call in viewDidAppear (window gets the focus) or something like this?

In my main view controller I called BASS_Init and there I also BASS_setConfig(BASS_CONFIG_IOS_MIXAUDIO, 0) to give my app the "feeling" of standard iOS audio player (f.e. using the command center etc.).

Ian @ un4seen

  • Administrator
  • Posts: 20616
Re: No sound after returning to iOS app
« Reply #1 on: 13 Feb '18 - 14:13 »
A few questions... Are you using the latest BASS (2.4.13.8) version? You can use BASS_GetVersion to check that. Do you see any error messages in the console when you return to your app? Does the problem only happen when BASS_CONFIG_IOS_MIXAUDIO is set to 0? Are you using the BASS_CONFIG_IOS_NOCATEGORY option? When the MP3 file is playing silently, does BASS_ChannelGetPosition show its position advancing? If you use the BASS_CONFIG_IOS_NOTIFY option to request interruption notifictions, do you receive one when returning to your app?

Code: [Select]
BASS_SetConfigPtr(BASS_CONFIG_IOS_NOTIFY, IOSNotifyProc);

...

void IOSNotifyProc(DWORD status)
{
NSLog(@"IOSNotifyProc(%d)", status);
}

Zarqon

  • Posts: 2
Re: No sound after returning to iOS app
« Reply #2 on: 18 Feb '18 - 05:22 »
I try to answer all of your questions...

Error log: Unfortunately there are no errors or exceptions in the console.

BASS_CONFIG_IOS_MIXAUDIO: Yes, the problem only occurs if the option is set to 0. With 1, 2 or 4 there's no problem but with these modes I'm not able to show the player controls in the lock screen.

BASS_CONFIG_IOS_NOCATEGORY: This option is not set in my case (default value).

BASS_ChannelGetPosition: The function returns the correct position. This was the reason why I think that the track is playing but without sound.

BASS_CONFIG_IOS_NOTIFY: The interruption notifications fire as expected.

BASS version: Exactly that was the trick. I used a version of 2017. Now I updated to the version of 6 Feb '18 and it works. It seems a problem since iOS 11.2 but I don't know what's the error behind.

Thanks a lot!

Ian @ un4seen

  • Administrator
  • Posts: 20616
Re: No sound after returning to iOS app
« Reply #3 on: 19 Feb '18 - 16:07 »
Good to hear that the latest BASS version fixed the problem. One change is that it will retry several times when its output restart requests fail upon receiving an interruption end notification (it seems that the output can't always be restarted immediately), so I guess that is what made the difference for you.