Event callback issues with MediaSession API and iOS

Hi, I'm working on a web project that uses the MediaSession API to interface with the media notification on iOS. The issue that I'm experiencing occurs after pressing the play button in the media session modal where the session seems to NOT fire the event handler callback and also kill the media session itself. It's a strange behaviour considering that the pause callback works fine.

audio_source = new Audio(url);

navigator.mediasession.metadata = {
    ... // Metadata here
};

navigator.mediasession.setActionHandler('play', (details) => {
        audio_source.play();
    }
);

navigator.mediasession.setActionHandler('pause', (details) => {
        audio_source.pause();
    }
);

加q 2099961945 帮你看下

Event callback issues with MediaSession API and iOS
 
 
Q