As I can see, your code is mostly correct, but the issue on iOS could be due to limitations with how iOS handles the MediaSession API. To fix the “Ionic App” display, try adding a web app manifest
to your project with a proper name
and short_name
. iOS might be using this information for the app name display. Additionally, make sure your metadata includes artwork
, as it can help iOS handle the session better:
navigator.mediaSession.metadata = new MediaMetadata({
title: 'Track',
artist: 'Artist',
album: 'Album',
artwork: [{ src: 'path_to_image', sizes: '96x96', type: 'image/png' }]
});
Thanks