Skip to content

Commit

Permalink
Added onCanPlay handler
Browse files Browse the repository at this point in the history
  • Loading branch information
jjuback committed Apr 8, 2024
1 parent 13f4c2b commit 018ac81
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Album.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const Album = (props) => {
props.goBack();
}
}}
onPlay={() => {
onCanPlay={() => {
navigator.mediaSession.metadata = new MediaMetadata({
title: props.Tracks[trackNo].Title,
artist: props.Artist,
Expand All @@ -39,6 +39,9 @@ export const Album = (props) => {
{ src: makeUrl(props.Cover), sizes: '96x96' }
]
});
if (trackNo > 0) {
document.getElementById("audioElement").play();
}
}}
/>
<ListGroup numbered>
Expand Down

0 comments on commit 018ac81

Please sign in to comment.