react-music-player icon indicating copy to clipboard operation
react-music-player copied to clipboard

Property "remember: true," is not working.

Open nhridoy opened this issue 2 years ago • 0 comments

Description

I am using this package on my application. But I have a problem with the remember property. It was supposed to remember the last state of the playlist, which means the last song I was playing. So, if I reload the page, I can continue from that song. When I am playing a song some data is being saved on the local storage. But when I reload the page, the local storage data seems to be reset to the first song of the playlist.

Below is my code

const options = {
    glassBg: true,
    drag: false,
    seeked: true,
    toggleMode: true,
    autoPlay: false,
    clearPriorAudioLists: false,
    autoPlayInitLoadPlayList: false,
    showMiniProcessBar: true,
    showMiniModeCover: true,
    showProgressLoadBar: true,
    showPlay: true,
    showReload: true,
    showDownload: false,
    showPlayMode: true,
    showThemeSwitch: false,
    showLyric: true,
    showDestroy: false,
    preload: "auto",
    remove: false,
    remember: true,
    spaceBar: true,
    responsive: true,
    autoHiddenCover: true,
    quietUpdate: true,
    restartCurrentOnPrev: true,
    showMediaSession: true,
    theme: "auto",
    defaultPosition: { right: "4vw", bottom: "2vh" },
    bounds: { right: "4vw", bottom: "2vh", left: "4vw", top: "2vh" },
    sortableOptions: {
      sort: false,
      swap: false,
    },

    // defaultPlayIndex: 0,
    // theme: "dark",
    // mode: "full",

    // custom
    lyric: {
      color: "#fff",
      fontSize: "14px",
      textShadow: "0 0 5px #000",
    },
  };

<ReactJkMusicPlayer
        audioLists={fullPlayList}
        {...options}
      />

Data that is being saved on the local storage

{
    "currentTime": 0,
    "playId": "e4b28d31-7c65-5836-1eda-374edf89b522",
    "theme": "dark",
    "playMode": "order",
    "soundValue": 1,
    "name": "Al-Faatiha",
    "cover": "/static/media/logo.e4a082d466ccc7346f5b.png",
    "singer": 1,
    "musicSrc": "https://cdn.alquran.cloud/media/audio/ayah/ar.alafasy/1"
}

What is the issue? What am I doing wrong here and what should be done? I appreciate the help.

nhridoy avatar Mar 20 '22 12:03 nhridoy