Home

Awesome

react-native-simple-sound

React Native module for playing, pausing, and stopping sound clips.

Derived from react-native-sound, which allows multiple sound files to be played at once, but does not offer pause or stop.

Installation

npm install react-native-simple-sound --save

In XCode, right click Libraries. Click Add Files to "[Your project]". Navigate to node_modules/react-native-simple-sound. Add the file RNSimpleSound.xcodeproj.

In the project navigator, select your project. Click the build target. Click Build Phases. Expand Link Binary With Libraries. Click the plus button and add libRNSimpleSound.a under Workspace.

Run your project (⌘+R).

Example

var Sound = require('react-native-simple-sound');
Sound.enable(true); // Enable sound
Sound.prepare('tap.aac'); // Preload the sound file 'tap.aac' in the app bundle
Sound.play(); // Play the sound 'tap.aac'
Sound.pause(); // Pause the sound
Sound.play(); // Resume playing the sound
Sound.stop(); // Stop and reset the sound.

Notes