Skip to content

Commit

Permalink
iAnother dummy attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
rtshkmr committed Aug 1, 2024
1 parent d79b816 commit cf05f76
Showing 1 changed file with 21 additions and 8 deletions.
29 changes: 21 additions & 8 deletions assets/js/hooks/audio_player.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,26 @@ AudioPlayer = {
if (!isSupported) {
return;
}
const newMetadata = this.createMediaMetadata(playback)
console.log("new metadata", newMetadata)
navigator.mediaSession.metadata = newMetadata
const payload = this.createMediaMetadataPayload(playback)
console.log("new metadata payload", payload)
// navigator.mediaSession.metadata = new MediaMetadata(payload)

navigator.mediaSession.metadata = new MediaMetadata({
"title": "Hanuman Chalisa",
"album": "Shree Hanuman Chalisa - Hanuman Ashtak",
"artwork": [
{
"type": "image/jpeg",
"src": "https://i.ytimg.com/vi/AETFvQonfV8/hqdefault.jpg",
"sizes": "480x360"
}
],
"artist": "Hariharan, Gulshan Kumar"
})

// TODO: register action handlers
},
createMediaMetadata(playback) {
createMediaMetadataPayload(playback) {
const {meta} = playback
const session = navigator.mediaSession
const sessionMetadata = session?.metadata
Expand All @@ -221,17 +234,17 @@ AudioPlayer = {
artist,
}


const res = new MediaMetadata(metadata)
// const res = new MediaMetadata(metadata)
console.log("creating new MediaMetadata", {
oldMetadata,
meta,
sessionMetadata,
metadata,
res
// res
})

return res
// return res
return metadata
}
}

Expand Down

0 comments on commit cf05f76

Please sign in to comment.