npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-native-audio-helper

v1.5.3

Published

A library play audio based on react-native-sound

Downloads

4

Readme

React native audio helper

A library for audio application.

Table of content

Demo

  • Link youtube: https://www.youtube.com/watch?v=OfUqaofrcMw
  • Link github: https://github.com/uit2712/RNPlaySound

Installation

Install react-native-sound

Link: https://github.com/zmxv/react-native-sound

npm install react-native-sound --save
react-native link react-native-sound

Install react-native-audio-helper

npm install react-native-audio-helper --save

Usage

import SoundPlayer from 'react-native-sound';
import { useAudioHelper } from './helpers/audio-helper';

function App() {
    const player = useAudioHelper({
        listSounds: [
            { path: 'blue_dream_cheel.mp3', name: 'Blue Dream - Cheel', basePath: SoundPlayer.MAIN_BUNDLE },
            { path: 'know_myself_patrick_patrikios.mp3', name: 'Know Myself - Patrick Patrikios', basePath: SoundPlayer.MAIN_BUNDLE },
            { path: require('./sounds/Play-Doh-meets-Dora_Carmen-Maria-and-Edu-Espinal.mp3'), name: 'Play Doh meets Dora - Carmen Maria and Edu Espinal', isRequired: true, },
            { path: 'https://raw.githubusercontent.com/uit2712/RNPlaySound/develop/sounds/Tropic%20-%20Anno%20Domini%20Beats.mp3', name: 'Tropic - Anno Domini Beats', },
        ],
        timeRate: 15,
        isLogStatus: true,
    });
    ...
}

|Param name|Type|Description|Default value| |---|---|---|---| |listSounds|ISoundFile|List sounds we will play|[]| |timeRate|number|This is used for methods increaseTime, decreaseTime => increase or decrease current time by timeRate (seconds)|15 (seconds)| |isLogStatus|boolean|Log current status of player using console.log|false|

Methods

Play

Play current audio

player.play(); // player.status='play'

Pause

Pause current audio

player.pause(); // player.status='pause'

Stop

Stop current audio

player.stop(); // player.status='stop'

Next

Move to next audio

player.next(); // player.status='next'

Previous

Back to previous audio

player.previous(); // player.status='previous'

Increase time

Increase current time to next timeRate (seconds)

player.increaseTime();

Decrease time

Decrease current time to previous timeRate (seconds)

player.decreaseTime();

Seek to time

Change current time

player.seekToTime(15); // seconds

|Param name|Type|Description| |---|---|---| |seconds|number|Change current time to seconds|

Set speed

Change player's speed

player.setSpeed(1.25);

|Param name|Type|Description|Default value| |---|---|---|---| |speed|number|Change current speed to speed (speed > 0.0 and speed <= 2.0)|1|

Shuffle

Random next or previous audio index

player.shuffle(); // call odd time (2n+1 time, n>0) => isShuffle=true, call even time (2n time, n>0) => isShuffle=false 

|Relative variable|Type|Description|Default value| |---|---|---|---| |isShuffle|boolean|Is shuffle or not|false|

Loop

Loop current audio

player.loop(); // call odd time (2n+1 time, n>0) => isLoop=true, call even time (2n time, n>0) => isLoop=false

|Relative variable|Type|Description|Default value| |---|---|---|---| |isLoop|boolean|Is loop current audio or not|false|

Mute

Mute player

player.mute(); // isMuted=true

Unmute

Unmute player

player.unmute() // isMuted=false

Set volume

player.setVolume(50); // volume=50%

|Param name|Type|Description|Default value| |---|---|---|---| |volume|number|Change current volume to volume (volume >= 0% and volume <= 100%)|100%|

Variables

|Variable name|Type|Description|Default value| |---|---|---|---| |status|AudioStatusType|Current player's status|'loading'| |duration|number|Duration of current audio (seconds)|| |currentTime|number|Current time of current audio (seconds)|0| |durationString|string|Duration string with format 'hh:mm:ss'|| |currentTimeString|string|Current time string with format 'hh:mm:ss'|| |currentAudioName|string|Current audio name|''| |isDisabledButtonPlay|boolean|Disabled button play or not|| |isDisabledButtonPause|boolean|Disabled button pause or not|| |isDisabledButtonStop|boolean|Disabled button stop or not|| |timeRate|number|This is used for methods increaseTime, decreaseTime => increase or decrease current time by timeRate (seconds)|15 (seconds)| |speed|number|Change current speed to speed (speed > 0.0 and speed <= 2.0)|1| |isShuffle|boolean|Is shuffle or not|false| |isLoop|boolean|Is loop current audio or not|false| |isMuted|boolean|Is mute player or not|false| |volume|number|Change current volume to volume (volume >= 0% and volume <= 100%)|100%|