Gathering detailed insights and metrics for react-native-sound
Gathering detailed insights and metrics for react-native-sound
Gathering detailed insights and metrics for react-native-sound
Gathering detailed insights and metrics for react-native-sound
react-native-web-sound
React Native for Web implementation of react-native-sound
react-native-sound-player
Play or stream audio files in ReactNative on iOS/Android
react-native-use-sound
### 🔊 A React Native Hook for playing sounds 🔊
@react-native-oh-tpl/react-native-sound
React Native module for playing sound clips on iOS, Android, and Windows
npm install react-native-sound
Typescript
Module System
Node Version
NPM Version
Kotlin (24.02%)
TypeScript (19.98%)
Objective-C (18.03%)
Objective-C++ (14.11%)
C# (10.98%)
JavaScript (9.42%)
Ruby (3.46%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
2,843 Stars
303 Commits
770 Forks
38 Watchers
5 Branches
101 Contributors
Updated on Jul 14, 2025
Latest Version
0.12.0
Package Id
react-native-sound@0.12.0
Unpacked Size
85.87 kB
Size
21.41 kB
File Count
26
NPM Version
11.4.2
Node Version
22.15.0
Published on
Jul 14, 2025
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
2
⚠️ We need help to maintain react-native-sound https://github.com/zmxv/react-native-sound/pulls
React Native module for playing sound clips on iOS, Android, and Windows.
Be warned, this software is alpha quality and may have bugs. Test on your own and use at your own risk!
React-native-sound does not support streaming. See #353 for more info. Of course, we would welcome a PR if someone wants to take this on.
In iOS, the library uses AVAudioPlayer, not AVPlayer.
Feature | iOS | Android | Windows |
---|---|---|---|
Load sound from the app bundle | ✓ | ✓ | ✓ |
Load sound from other directories | ✓ | ✓ | ✓ |
Load sound from the network | ✓ | ✓ | |
Play sound | ✓ | ✓ | ✓ |
Playback completion callback | ✓ | ✓ | ✓ |
Pause | ✓ | ✓ | ✓ |
Resume | ✓ | ✓ | ✓ |
Stop | ✓ | ✓ | ✓ |
Reset | ✓ | ||
Release resource | ✓ | ✓ | ✓ |
Get duration | ✓ | ✓ | ✓ |
Get number of channels | ✓ | ||
Get/set volume | ✓ | ✓ | ✓ |
Get system volume | ✓ | ✓ | |
Set system volume | ✓ | ||
Get/set pan | ✓ | ||
Get/set loops | ✓ | ✓ | ✓ |
Get/set exact loop count | ✓ | ||
Get/set current time | ✓ | ✓ | ✓ |
Set speed | ✓ | ✓ |
First install the npm package from your app directory:
1npm install react-native-sound --save
Note: If your react-native version is >= 0.60 then linking is done automatically.
If your react-native version is < 0.60 then link it using:
1react-native link react-native-sound
If you encounter this error
undefined is not an object (evaluating 'RNSound.IsAndroid')
you may additionally need to fully clear your build caches for Android. You can do this using
1cd android 2./gradlew cleanBuildCache
After clearing your build cache, you should execute a new react-native
build.
If you still experience issues, know that this is the most common build issue. See #592 and the several issues linked from it for possible resolution. A pull request with improved documentation on this would be welcome!
Please see the Wiki for these details https://github.com/zmxv/react-native-sound/wiki/Installation
https://github.com/zmxv/react-native-sound-demo
https://github.com/benevbright/react-native-sound-playerview
First you'll need to add audio files to your project.
android/app/src/main/res/raw
. Note that files in this directory must be lowercase and underscored (e.g. my_file_name.mp3) and that subdirectories are not supported by Android.Add Files to [PROJECTNAME]
)1// Import the react-native-sound module 2var Sound = require('react-native-sound'); 3 4// Enable playback in silence mode 5Sound.setCategory('Playback'); 6 7// Load the sound file 'whoosh.mp3' from the app bundle 8// See notes below about preloading sounds within initialization code below. 9var whoosh = new Sound('whoosh.mp3', Sound.MAIN_BUNDLE, (error) => { 10 if (error) { 11 console.log('failed to load the sound', error); 12 return; 13 } 14 // loaded successfully 15 console.log('duration in seconds: ' + whoosh.getDuration() + 'number of channels: ' + whoosh.getNumberOfChannels()); 16 17 // Play the sound with an onEnd callback 18 whoosh.play((success) => { 19 if (success) { 20 console.log('successfully finished playing'); 21 } else { 22 console.log('playback failed due to audio decoding errors'); 23 } 24 }); 25}); 26 27// Reduce the volume by half 28whoosh.setVolume(0.5); 29 30// Position the sound to the full right in a stereo field 31whoosh.setPan(1); 32 33// Loop indefinitely until stop() is called 34whoosh.setNumberOfLoops(-1); 35 36// Get properties of the player instance 37console.log('volume: ' + whoosh.getVolume()); 38console.log('pan: ' + whoosh.getPan()); 39console.log('loops: ' + whoosh.getNumberOfLoops()); 40 41// Seek to a specific point in seconds 42whoosh.setCurrentTime(2.5); 43 44// Get the current playback point in seconds 45whoosh.getCurrentTime((seconds) => console.log('at ' + seconds)); 46 47// Pause the sound 48whoosh.pause(); 49 50// Stop the sound and rewind to the beginning 51whoosh.stop(() => { 52 // Note: If you want to play a sound after stopping and rewinding it, 53 // it is important to call play() in a callback. 54 whoosh.play(); 55}); 56 57// Release the audio player resource 58whoosh.release();
play()
(e.g. var s = new Sound(...);
) during app initialization. This also helps avoid a race condition where play()
may be called before loading of the sound is complete, which results in no sound but no error because loading is still being processed.AVAudioSessionCategoryAmbient
to mix sounds on iOS.Sound
instance for multiple playbacks.AVAudioPlayer
that supports aac, aiff, mp3, wav etc. The full list of supported formats can be found at https://developer.apple.com/library/content/documentation/MusicAudio/Conceptual/CoreAudioOverview/SupportedAudioFormatsMacOSX/SupportedAudioFormatsMacOSX.htmlandroid.media.MediaPlayer
. The full list of supported formats can be found at https://developer.android.com/guide/topics/media/media-formats.htmlsound.setVolume(.5).setPan(.5).play()
.Pull requests welcome with bug fixes, documentation improvements, and enhancements.
When making big changes, please open an issue first to discuss.
This project is licensed under the MIT License.
No vulnerabilities found.
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
3 existing vulnerabilities detected
Details
Reason
4 commit(s) and 2 issue activity found in the last 90 days -- score normalized to 5
Reason
Found 13/24 approved changesets -- score normalized to 5
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-07-07
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More