1

I'm using track player in react-native for ios. I also added background mode functionality from xcode now play functionality works properly and the remote also works but when I pause the music and back to the home screen so using trackplayer.reset() reset the data mean from the notification bar the music data have remove but empty players are showing there. enter image description here

 useEffect(() => {
    return () => {
      TrackPlayer.getState().then(state => {
        if (state !== State.Playing) {
          removePlayingStream();
          TrackPlayer.reset();
        }
      });
    };
  }, []);

const handlePlay = async () => {
      await TrackPlayer.play();
  };

  const handlePause = async () => {
    await TrackPlayer.pause();
  };

can someone give a good solution to fix this? I also want when the user again navigate to the player screen then the music start position with start location not from the resume position. I'm using trackplayer("^3.2.0") for hls streams

1 Answer 1

0

I found something, when i do:

await TrackPlayer.reset();
await TrackPlayer.clearNowPlayingMetadata();

the empty remote is gone!

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.