1.0.2 • Published 7 years ago
react-native-is-playing v1.0.2
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-playingand addRNIsPlaying.xcodeproj - In XCode, in the project navigator, select your project. Add
libRNIsPlaying.ato 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.slninnode_modules/react-native-is-playing/windows/RNIsPlaying.slnfolder to their solution, reference from their app. - Open up your
MainPage.csapp
- Add
using Is.Playing.RNIsPlaying;to the usings at the top of the file - Add
new RNIsPlayingPackage()to theList<IReactPackage>returned by thePackagesmethod
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...🔇')
})