Skip to content

Instantly share code, notes, and snippets.

@bbenetskyy
Created January 3, 2023 17:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbenetskyy/61cc6facc06a16c118027ac56f8c5bce to your computer and use it in GitHub Desktop.
Save bbenetskyy/61cc6facc06a16c118027ac56f8c5bce to your computer and use it in GitHub Desktop.
/// <summary>
/// Sound Service
/// </summary>
public interface ISoundService
{
/// <summary>
/// Play Embedded Sound from Resources
/// Usage example: ISoundService.PlaySound("success.mp3");
/// </summary>
/// <param name="sound">sound resource name with extension</param>
void PlaySound(string sound);
}
public partial class SoundService : ISoundService
{
public void PlaySound(string sound)
{
#if ANDROID
PlayAndroidSound(sound);
#elif IOS
PlayIosSound(sound);
#endif
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment