Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

24 Commits

Repository files navigation

@alloc/react-native-sound

Sound effect player for react-native-macos

Compatible with macOS 10.13+ only.

import{Sound}from'@alloc/react-native-sound'// When a Sound is constructed, its source is pre-loaded.constfoo=newSound({source: require('./foo.wav'),// Throttle the sound to once per secondtimeout: 1000,// The volume limit (between 0 and 1)volume: 0.5,// Mute the sound without modifying `volume`muted: true,// Called once the sound is ready to playonLoad: ()=>{},// Called when the sound fails to loadonError: (error)=>{// The default behaviorthrowerror},})// Play oncefoo.play()// Some options can be mutated after creationfoo.volume=0foo.muted=false// Release memoryfoo.dispose()

Notes

⚠️ Audio must be .wav format (48kHz 32bit)

Thanks to Starling for providing much of the native implementation.

Type definitions included!! (TypeScript only)

About

Sound effect player for react-native-macos

Topics

Resources

Stars

3 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages