You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 6, 2022. It is now read-only.
Hi, i have the problem, that the playPause button on EarPods with lightning connector doesn't work - bluetooth earphones work as expected.
Here is the hook I use to init the music controls.
import MusicControl, {Command} from 'react-native-music-control';
import {usePlayerStore} from './usePlayerStore';
import {Platform} from 'react-native';
export const useControlCenter = () => {
const playerStore = usePlayerStore();
const init = () => {
MusicControl.enableBackgroundMode(true);
if (Platform.OS === 'ios') {
MusicControl.handleAudioInterruptions(true);
}
// Basic Controls
MusicControl.enableControl('play', true);
MusicControl.enableControl('pause', true);
MusicControl.enableControl('stop', false);
MusicControl.on(Command.play, () => {
playerStore.updatePaused(false);
});
// on iOS this event will also be triggered by audio router change events
// happening when headphones are unplugged or a bluetooth audio peripheral disconnects from the device
MusicControl.on(Command.pause, () => {
playerStore.updatePaused(true);
});
MusicControl.on(Command.stop, () => {
playerStore.updatePaused(true);
});
MusicControl.on(Command.togglePlayPause, () => {
playerStore.updatePaused(!playerStore.paused);
});
};
const updatePosition = (position: number) => {
MusicControl.updatePlayback({
elapsedTime: position,
});
};
return {
init: init,
updatePosition: updatePosition,
};
};
Platform ?
iOS
Android
Device
Simulator
Real device
The text was updated successfully, but these errors were encountered:
Found it. Had to enable togglePlayPause with MusicControl.enableControl('togglePlayPause', true);.
Maybe it would be helpful to include this line in the README.md examples.
Uh oh!
There was an error while loading. Please reload this page.
Description
Hi, i have the problem, that the playPause button on EarPods with lightning connector doesn't work - bluetooth earphones work as expected.
Here is the hook I use to init the music controls.
Platform ?
The text was updated successfully, but these errors were encountered: