Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playback during focus loss #35

Closed
stacyh3 opened this issue Aug 15, 2021 · 9 comments
Closed

Playback during focus loss #35

stacyh3 opened this issue Aug 15, 2021 · 9 comments

Comments

@stacyh3
Copy link

stacyh3 commented Aug 15, 2021

Is there a way to continue Wwise playback during focus loss? This is a pretty important feature for an app that we're looking to develop with Godot.

@alessandrofama
Copy link
Owner

alessandrofama commented Aug 15, 2021

Yep, this is handled here:

void Wwise::_notification(int notification)
{
#if defined(AK_ANDROID) || defined(AK_IOS)
if (notification == NOTIFICATION_WM_FOCUS_OUT)
{
Wwise::suspend(false);
}
if (notification == NOTIFICATION_WM_FOCUS_IN)
{
Wwise::wakeupFromSuspend();
}
#endif
}

It's hardcoded right now, but ideally this should be an option in the project settings. Pushed the fix, should be available soon after the GitHub actions are completed.

@alessandrofama
Copy link
Owner

Libs to replace:
Android
iOS
macOS
Windows
Linux

Replace this file in the wwise folder: https://raw.githubusercontent.com/alessandrofama/wwise-godot-integration/main/wwise-gdnative/gdnative-demo/wwise/wwise_settings.gd

and disable this setting in the project settings (Wwise - Common User Settings):
image

@stacyh3
Copy link
Author

stacyh3 commented Aug 16, 2021

I gave this a quick try on an Android device. I'm a long time developer, but new to Android and Godot, so there may be something else needed. When I go to the phone's home screen, playback stops. When I switch back to the app, playback starts again.

Thanks for being super responsive! Your work is excellent!

@alessandrofama
Copy link
Owner

alessandrofama commented Aug 16, 2021

Works on desktop, I will try it on my Android device later today! Not super experienced in working with mobile.. there may be some setting to keep the app alive.

@alessandrofama
Copy link
Owner

alessandrofama commented Aug 16, 2021

I've tried this out on an old Xiaomi Redmi Note 3 (Android 7.0) and on a newer Android 10 device. Switching to the home screen or locking while audio is playing works fine.

If you applied the changes mentioned above it should work. Not sure what the cause of the problem is. Maybe try to activate and deactive the WwiseSettings script in the autoload tab of the project settings. Might be that the new Suspend At Focus Loss option in the settings does not get applied correctly.

If you manage to find time for a simple repro project I can take another look at this. :-)

@stacyh3
Copy link
Author

stacyh3 commented Aug 16, 2021

I'll try for a repro project. I may have goofed up on the settings. Should I close this for now or leave it going until I can test. It might be a few days.

@alessandrofama
Copy link
Owner

alessandrofama commented Aug 17, 2021

You can leave this issue open, does not bother me at all.

@stacyh3
Copy link
Author

stacyh3 commented Aug 17, 2021

Thanks. I'm testing between other things at work. I went back to a simple empty Godot project and I can build and deploy it. When I add in the Wwise features I'm getting a apksigner error. I'll try to track this down and get a working test.

@stacyh3
Copy link
Author

stacyh3 commented Aug 17, 2021

Success! I started with an empty app and checked the export at each step. Working great! Thanks! You are fantastic! Now I'm thinking about doing a similar type of integration project for Xamarin/MAUI apps. Hmm... Thanks again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants