Hi everyone, it has been a loooong time since I have written an article and thought I would do another today regarding adding sound to a react native app. Let’s go!
Firstly, the documentation for this can be found here — https://www.npmjs.com/package/react-native-sound and has a lot of great stuff in it, but if you like the format of Medium feel free to stick around!
I will be using React-Native 0.60 version or greater so you will most likely need to do a pod install but I will talk about that later.
The first thing you will want to do is to open your command prompt/terminal and create a react-native project, to do this enter the below.
Playing from local file
react-native init mysoundproject
After you have done this a project folder will be created, open this project in your favoured text editor, open the terminal within your text editor, to open this in vs code on a mac you will need to press “ctrl” and “`" at the same time.
Now enter the command
npm install react-native-sound --save
This will install the react-native-sound which is a fantastic package which allows you to play sounds locally from a project or from a url as well as a myriad of other features!