When we are creating a mobile application we want it to be friendly and intuitive. This is why it is so important to add some sounds to differentiate each action and warn the users using the Application. I’ll teach you how to do this in just three steps.
First of all.. What do I need?
- Add from NuGet Package the plugin: Xam.Plugin.SimpleAudioPlayer
Step 1 – Add your audio (You can add it to platform-specific projects or to a shared library):
On the image I show you, for each platform, the name of the folder that you have to place the sound file and the Build Action that you have to set.
Step 2 – Some configuration needed:
First, we need to load the file in a Stream and set your ProyectName.YourSound.ext ,then you have to load the sound (With .Load() Method) and from here, you will be able to handle the action to the sound. (Play, Stop , Pause, etc..).
Step 3 – Handling sounds ?:
There are a lot of Methods and Properties to handle the behavior of the sound, I’ll show you some of them bellow:
Done! You can add your prefered sound to your App!
Good luck with your implementation! ?