Skip to content

Commit

Permalink
Update dittytoyMediaSession.js
Browse files Browse the repository at this point in the history
  • Loading branch information
reindernijhoff committed Mar 27, 2024
1 parent 0d6f58f commit 6db316e
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions example/src/dittytoyMediaSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,14 @@ export function initDittytoyMediaSession(dittytoy, prev = null, next = null) {
}

export function setMediaSessionMetadata({title, artist, album, artwork}) {
try {
navigator.mediaSession.metadata = new MediaMetadata({
title,
artist,
album,
artwork: artwork.map(({src, sizes, type}) => ({src, sizes, type})),
});
} catch (error) {
console.log(`The media session metadata is not supported yet.`);
}
}

0 comments on commit 6db316e

Please sign in to comment.