react-native-is-playing
v1.0.2
Published
a simple module to see if music is playing on your device! simulator is no go!
Downloads
12
Readme
react-native-is-playing
a simple module to see if music is playing on your device! simulator is no go!
Only for ios, android is comming soon!
Getting started
$ yarn add react-native-is-playing
Mostly automatic installation
$ react-native link react-native-is-playing
Manual installation
iOS
- In XCode, in the project navigator, right click
Libraries
➜Add Files to [your project's name]
- Go to
node_modules
➜react-native-is-playing
and addRNIsPlaying.xcodeproj
- In XCode, in the project navigator, select your project. Add
libRNIsPlaying.a
to your project'sBuild Phases
➜Link Binary With Libraries
- Run your project (
Cmd+R
)<
Android
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.reactlibrary.RNIsPlayingPackage;
to the imports at the top of the file - Add
new RNIsPlayingPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-is-playing' project(':react-native-is-playing').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-is-playing/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-is-playing')
Windows
- In Visual Studio add the
RNIsPlaying.sln
innode_modules/react-native-is-playing/windows/RNIsPlaying.sln
folder to their solution, reference from their app. - Open up your
MainPage.cs
app
- Add
using Is.Playing.RNIsPlaying;
to the usings at the top of the file - Add
new RNIsPlayingPackage()
to theList<IReactPackage>
returned by thePackages
method
Usage
import isPlayingAudio from 'react-native-is-playing'
isPlayingAudio().then((res) => {
if (res) console.warn('💃YEH! MUSIC IS OOOOON! 🤘')
else console.warn('🔇NO MUSIC HERE...🔇')
})