Skip to content

Commit

Permalink
set url
Browse files Browse the repository at this point in the history
  • Loading branch information
kimgh06 committed Sep 23, 2024
1 parent 0825188 commit 47e0ed7
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/player/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,17 @@ export default function Player() {
localStorage.setItem('play', play);
if (play && audio.current.paused) {
let promise = audio.current.play();
setPlay(e => false)
promise.catch(err => {
console.log(err);
getMusicUrl(id)
setPlay(e => false)
getMusicUrl(id).then(() => {
let cached_url = JSON.parse(localStorage.getItem('cached_url')) || {};
if (cached_url[`${id}`]) {
return;
}
audio.current.src = cached_url[`${id}`];
setPlay(true);
})
});
return;
}
Expand Down

0 comments on commit 47e0ed7

Please sign in to comment.