Gathering detailed insights and metrics for react-native-use-sound
Gathering detailed insights and metrics for react-native-use-sound
Gathering detailed insights and metrics for react-native-use-sound
Gathering detailed insights and metrics for react-native-use-sound
react-native-sound-detection
This library simply gets the audio/video tracks and their type. This is to detect whether they exist on a media file (Video/Mp3/etc) in Android and iOS React Native. **Note**: Skip 2.0.0 as it's corrupted, use 2.0.2 ## Getting started
use-audio-capture
🎙️ A lightweight React hook for audio recording using native Web APIs (MediaRecorder, getUserMedia). Start, stop, pause, resume audio recordings with customizable callbacks. Perfect for voice notes, interviews, podcasts, and real-time audio processing in
useSound 🔊 A React Native hook for playing sounds 🔊
npm install react-native-use-sound
Typescript
Module System
Node Version
NPM Version
TypeScript (38.56%)
Java (29.17%)
Objective-C (22.65%)
JavaScript (3.9%)
Ruby (2.9%)
Starlark (2.83%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
82 Stars
58 Commits
9 Forks
2 Watchers
1 Branches
4 Contributors
Updated on Feb 11, 2025
Latest Version
1.2.2
Package Id
react-native-use-sound@1.2.2
Unpacked Size
938.43 kB
Size
364.77 kB
File Count
68
NPM Version
6.14.16
Node Version
12.22.10
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
1
3
react-native-use-sound is largely based on the work by @joshwcomeau use-sound
⚠ You must first install react-native-sound ⚠
1npm i react-native-sound 2cd ios && pod install
Then, our Hook can be added:
1npm install react-native-use-sound
1import useSound from "react-native-use-sound"; 2import { Button } from "react-native"; 3 4const MusicButton = () => { 5 const coolMusic = 6 "http://commondatastorage.googleapis.com/codeskulptor-demos/DDR_assets/Kangaroo_MusiQue_-_The_Neverwritten_Role_Playing_Game.mp3"; 7 const [play, pause, stop, data] = useSound(coolMusic); 8 9 const handlePlay = () => { 10 if (data.isPlaying) pause(); 11 else play(); 12 }; 13 14 return ( 15 <> 16 <Button 17 title={data.isPlaying ? "Pause" : "Play"} 18 onPress={handlePlay} 19 /> 20 <Button 21 title={"Stop"} 22 onPress={stop} 23 /> 24 </> 25 ); 26};
The useSound
hook takes two arguments:
HookOptions
)It produces an array with four values:
ExposedData
)When calling useSound
, you can pass it a variety of options:
Name | Value |
---|---|
volume | number |
interrupt | boolean |
soundEnabled | boolean |
timeRate | number |
numberOfLoops | boolean |
volume
is a number from 0
to 1
, where 1
is full volume and 0
is comletely muted.interrupt
specifies whether or not the sound should be able to "overlap" if the play
function is called again before the sound has ended.soundEnabled
allows you to pass a value (typically from context or redux or something) to mute all sounds. Note that this can be overridden in the PlayOptions
, see belowtimeRate
is the frequency (in milliseconds) at which the currentTime
value will be updated. Default is 1000,numberOfLoops
specifies the number of times you want the sound repeated. Note that you can use -1
to Loop indefinitely until stop() is called.The hook produces a tuple with 4 options, the play, pause, stop functions and an Data
object:
1const [play, pause, stop, data] = useSound("/meow.mp3"); 2// ^ What we're talking about
Name | Value |
---|---|
sound | Sound |
seek | function ((sec: number) => void) |
isPlaying | boolean |
duration | number |
currrentTime | number |
loading | boolean |
sound
is an escape hatch. It grants you access to the underlying Sound
instance.seek
is a function you can use to seek to a position in the sound.isPlaying
lets you know whether this sound is currently playing or not. When the sound reaches the end, or it's interrupted with stop
or paused
, this value will flip back to false
. You can use this to show some UI only while the sound is playing.duration
is the length of the sample, in milliseconds.currentTime
is the current time of the sample, in milliseconds. You can chose the rate at which this is updated by specifying timeRate
in the hook options (see above).loading
lets you know whether the current sample is loading.No vulnerabilities found.
Reason
license file detected
Details
Reason
binaries present in source code
Details
Reason
Found 3/27 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
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
Reason
52 existing vulnerabilities detected
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