Add files via upload
This commit is contained in:
parent
5be2cbda15
commit
8ccab3a671
1 changed files with 13 additions and 5 deletions
18
index.js
18
index.js
|
|
@ -1,5 +1,13 @@
|
|||
import 'expo-router/entry';
|
||||
import TrackPlayer from 'react-native-track-player';
|
||||
import { PlaybackService } from './hooks/PlaybackService';
|
||||
|
||||
TrackPlayer.registerPlaybackService(() => PlaybackService);
|
||||
import 'expo-router/entry';
|
||||
|
||||
// Register TrackPlayer background service safely
|
||||
// Must be wrapped — if native module isn't ready, app would white-screen otherwise
|
||||
try {
|
||||
const TrackPlayer = require('react-native-track-player').default;
|
||||
const { PlaybackService } = require('./hooks/PlaybackService');
|
||||
TrackPlayer.registerPlaybackService(() => PlaybackService);
|
||||
} catch (e) {
|
||||
// TrackPlayer native module not ready yet — skip service registration
|
||||
// Music playback via TrackPlayer will still work, just no remote controls
|
||||
console.warn('[TrackPlayer] registerPlaybackService failed:', e?.message);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue