Apple Music Replay is here.


REPLAY { let instance = MusicKit.getInstance(); if (instance.isAuthorized) { showUser(); } instance.addEventListener(MusicKit.Events.authorizationStatusDidChange, () => { if (instance.isAuthorized) { showUser(); } }); // Signs user out signOutButton.addEventListener(‘click’, () => { userOptions.style.display = ‘none’; instance.unauthorize().then(() => { // Clear .music.apple.com cookie. This can be removed once auth-bridge is in prod for // 6 months. window.document.cookie = `media-user-token=; expires=${(new Date()).toUTCString()}; domain=music.apple.com; path=/`; window.document.cookie = `music-user-token=; expires=${(new Date()).toUTCString()}; domain=music.apple.com; path=/`; window.document.cookie = `itre=; expires=${(new Date()).toUTCString()}; domain=music.apple.com; path=/`; window.document.cookie = `itua=; expires=${(new Date()).toUTCString()}; domain=music.apple.com; path=/`; window.location.reload(false); }); }); // Show the user options userProfileContainer.addEventListener(‘click’, () => { userOptions.style.display = ‘inline-block’; }); }); function showUser() { webUser.style.display = ‘inline-block’; MusicKit.getInstance().me().then(me => { if (me.attributes && me.attributes.avatarArtwork) { let image = webUser.querySelector(‘img’); image.onload = () => { image.style.display = ‘inline’; webUser.querySelector(‘svg’).style.display = ‘none’; } image.src = MusicKit.formatArtworkURL(me.attributes.avatarArtwork, 56, 56).replace(‘{c}’, ‘bb’); } }).catch(); } ]]>

Source