A fully fledged audio module created for music apps
npm install react-native-haptic-music-player-newA fully-fledged audio module created for music apps. Provides audio playback, external media controls, background mode and more!


For React Native 0.70+ and New Architecture compatibility, use the built-in simple player:
``bash`No installation needed - uses built-in React Native components
`javascript
import React from 'react';
import { View } from 'react-native';
import PureRNHapticPlayer from './PureRNHapticPlayer'; // Copy from package
export default function App() {
return (
);
}
`
:
`xml
`$3
`javascript
// In PureRNHapticPlayer.js, modify:
const tracks = [
{ title: 'Your Song 1', artist: 'Your Artist 1' },
{ title: 'Your Song 2', artist: 'Your Artist 2' },
];
`Advanced Installation (Legacy)
For older React Native versions or advanced features:
`bash
npm install react-native-haptic-music-player-new
`$3
`bash
cd ios && pod install
`$3
Auto-linking handles setup for RN 0.60+$3
`bash
npx react-native start --reset-cache
cd ios && xcodebuild clean && pod install
cd android && ./gradlew clean
npx react-native run-android
`Usage Examples
$3
`javascript
import HapticPlayer from 'react-native-haptic-music-player-new';const setupPlayer = async () => {
try {
await HapticPlayer.setupPlayer();
await HapticPlayer.add({
id: 'track1',
url: 'https://example.com/song.mp3',
title: 'Song Title',
artist: 'Artist Name'
});
await HapticPlayer.play();
} catch (error) {
console.error('Setup failed:', error);
}
};
`$3
`javascript
import { useProgress, usePlaybackState } from 'react-native-haptic-music-player-new';function Player() {
const progress = useProgress();
const playbackState = usePlaybackState();
return (
{progress.position} / {progress.duration}
State: {playbackState.state}
);
}
`Features Comparison
| Feature | Simple Player | Advanced Package |
|---------|---------------|------------------|
| Haptic Feedback | ✅ | ✅ |
| Play/Pause | ✅ | ✅ |
| Track Navigation | ✅ | ✅ |
| Progress Bar | ✅ | ✅ |
| Background Play | ❌ | ✅ |
| Media Controls | ❌ | ✅ |
| Streaming | ❌ | ✅ |
| Dependencies | None | Audio libraries |
| RN 0.83+ Support | ✅ | ⚠️ |
Troubleshooting
$3
Solution: Use the Simple Player instead - it has no native dependencies.$3
Solution: Copy PureRNHapticPlayer.js and use built-in components.$3
Solution: The Simple Player works with all React Native versions.Recommendation
For new projects: Use
PureRNHapticPlayer.js` - it's dependency-free and works with all React Native versions including 0.83+ and New Architecture.For existing projects: Migrate to the Simple Player to avoid compatibility issues.
- ✅ Zero Dependencies - No native modules to break
- ✅ Always Compatible - Works with any React Native version
- ✅ Haptic Feedback - Built-in vibration API
- ✅ Modern UI - Spotify-inspired design
- ✅ Easy Setup - Just copy and use
This package is maintained and developed by me as a personal project.