Gathering detailed insights and metrics for lvbk-react-native-sound-player
Gathering detailed insights and metrics for lvbk-react-native-sound-player
Gathering detailed insights and metrics for lvbk-react-native-sound-player
Gathering detailed insights and metrics for lvbk-react-native-sound-player
npm install lvbk-react-native-sound-player
Typescript
Module System
Node Version
NPM Version
Java (43.42%)
Objective-C (38.96%)
JavaScript (14.56%)
Ruby (3.06%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
282 Stars
205 Commits
95 Forks
2 Watchers
5 Branches
23 Contributors
Updated on Jul 02, 2025
Latest Version
0.6.2
Package Id
lvbk-react-native-sound-player@0.6.2
Unpacked Size
27.26 kB
Size
8.03 kB
File Count
13
NPM Version
6.4.1
Node Version
10.11.0
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
No dependencies detected.
Play audio files, stream audio from URL, using ReactNative.
yarn
or npm
// yarn
yarn add react-native-sound-player
// or npm
npm install --save react-native-sound-player
react-native link react-native-sound-player
{project_root}/android/app/src/main/res/raw/
. Just create the folder if it doesn't exist.playSoundFile(fileName, fileType)
function:1import SoundPlayer from 'react-native-sound-player' 2 3try { 4 // play the file tone.mp3 5 SoundPlayer.playSoundFile('tone', 'mp3') 6 // or play from url 7 SoundPlayer.playUrl('https://example.com/music.mp3') 8} catch (e) { 9 console.log(`cannot play the sound file`, e) 10}
Please note that the device can still go to sleep (screen goes off) while audio is playing. When this happens, the audio will stop playing. To prevent this, you can something like react-native-keep-awake.
1... 2 3// subscribe to the finished playing event in componentDidMount 4componentDidMount() { 5 SoundPlayer.onFinishedPlaying((success: boolean) => { // success is true when the sound is played 6 console.log('finished playing', success) 7 }) 8 SoundPlayer.onFinishedLoading(async (success: boolean) => { 9 console.log('finished loading', success) 10 // ready to `play()`, `getInfo()`, etc 11 console.log(await SoundPlayer.getInfo()) 12 }) 13} 14 15// unsubscribe when unmount 16componentWillUnmount() { 17 SoundPlayer.unmount() 18} 19 20 21} 22 23...
Play the sound file named fileName
with file type fileType
.
Load the sound file named fileName
with file type fileType
, without playing it.
This is useful when you want to play a large file, which can be slow to mount,
and have precise control on when the sound is played. This can also be used in
combination with getInfo()
to get audio file duration
without playing it.
You should subscribe to the onFinishedLoading
event to get notified when the
file is loaded.
Play the audio from url. Supported formats are:
Subscribe to the "finished playing" event. The callback
function is called whenever a file is finished playing.
Subscribe to the "finished loading" event. The callback
function is called whenever a file is finished loading, i.e. the file is ready to be play()
, resume()
, getInfo()
, etc.
Unsubscribe the "finished playing" and "finished loading" event.
Play the loaded sound file. This function is the same as resume()
.
Pause the currently playing file.
Resume from pause and continue playing the same file. This function is the same as play()
.
Stop playing, call playSound(fileName: string, fileType: string)
to start playing again.
Set the volume of the current player. This does not change the volume of the device.
Get the currentTime
and duration
of the currently mounted audio media. This function returns a promise which resolves to an Object containing currentTime
and duration
properties.
1// Example 2... 3 playSong() { 4 try { 5 SoundPlayer.playSoundFile('engagementParty', 'm4a') 6 } catch (e) { 7 alert('Cannot play the file') 8 console.log('cannot play the song file', e) 9 } 10 } 11 12 async getInfo() { // You need the keyword `async` 13 try { 14 const info = await SoundPlayer.getInfo() // Also, you need to await this because it is async 15 console.log('getInfo', info) // {duration: 12.416, currentTime: 7.691} 16 } catch (e) { 17 console.log('There is no song playing', e) 18 } 19 } 20 21 onPressPlayButton() { 22 this.playSong() 23 this.getInfo() 24 } 25 26...
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 9/20 approved changesets -- score normalized to 4
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
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
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