Audio interface
Stay organized with collections
Save and categorize content based on your preferences.
Methods for controlling audio.
Methods
isEnabled(): boolean
Determines if game sound should be audible at this instant. Required
subscribe(callback: (isEnabled: boolean) => void): void
Subscribes to changes to isEnabled.
Requirements
- Your game should not show an overall mute button and should instead rely
on the GameSnacks platform control for this.
- Your game may have separate granular audio controls in the game, such as
for background music or sound effects, but it must still follow these
requirements.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-03 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-03 UTC."],[[["All games must respect the platform's audio control which dictates whether sound is enabled or disabled."],["Games can implement individual sound controls (e.g., for music or effects) but must still adhere to the platform's master audio control."],["Developers can access and subscribe to the platform's audio state using provided methods `isEnabled` and `subscribe`."],["Games should not display their own global mute button, relying instead on the platform's built-in control."]]],[]]