In ios, pressing the button(togglePlayPause) on the earpods does not receive an event. It was exactly until yesterday, but it didn't work today.
Since the event itself cannot be received, the logic cannot be implemented.
env
headphone: apple earpods (volume up / volume down / toggle-play,pause)
iphone 7 (ios15.1, ios15.2) - It worked until yesterday, not today.
iphone 12 mini (ios15.2)- didn't works
I made a sample cordova project, installed only the plugin, and tested it.
document.addEventListener('deviceready', onDeviceReady, false);
function onDeviceReady() {
// Cordova is now initialized. Have fun!
console.log('Running cordova-' + cordova.platformId + '@' + cordova.version);
document.getElementById('deviceready').classList.add('ready');
MusicControls.create({}, console.log('Success'), console.log('Fail'));
// Register callback
MusicControls.subscribe(function(action){
const message = JSON.parse(action).message; //miss typo
switch(message) {
case 'music-controls-next':
case 'music-controls-previous':
case 'music-controls-pause':
case 'music-controls-play':
console.log("next/prev/pause/play@@@");
break;
case 'music-controls-toggle-play-pause' :
console.log("toggle@@");
break;
default:
console.log("??");
break;
}
});
MusicControls.listen();
}
When built with xcode, the app runs fine without any errors, but when the button is pressed, the event is not received. What I need is a toggle button, is there a way to bypass it?
Hi,
In ios, pressing the button(togglePlayPause) on the earpods does not receive an event. It was exactly until yesterday, but it didn't work today. Since the event itself cannot be received, the logic cannot be implemented.
env
When built with xcode, the app runs fine without any errors, but when the button is pressed, the event is not received. What I need is a toggle button, is there a way to bypass it?
Thanks!