react-native-track-player icon indicating copy to clipboard operation
react-native-track-player copied to clipboard

iOS Notification Center controls still present and empty after reset

Open Gregoirevda opened this issue 7 months ago • 1 comments

Describe the Bug on iOS the Notification Center displays an empty track after the track has been TrackPlayer.reset()

Code To Reproduce

  1. TrackPlayer.load(track); (same with setQueue)
  2. await TrackPlayer.play();
  3. TrackPlayer.reset();

Environment Info: Running on a physical device with react-native-track-player: 0.72.5. Both XCode and Metro have no stacktrace

Gregoirevda avatar Jan 24 '24 09:01 Gregoirevda

I too have the same issue,

After TrackPlayer.reset(), I am trying to play a video with react-native-video but still the notification control displays with empty data.

By updating the meta data, we can display data on it, but still I don't need that notification control in my app while playing video.

useEffect(() => {
    const updateMetaData = async () => {
      await TrackPlayer.updateNowPlayingMetadata({
        title: media.title,
        description: media.description,
        artist: media.author,
        artwork: media.imageUrl,
        elapsedTime: currentTime,
        duration,
      });
    };

    updateMetaData();
  }, [currentTime, media, duration]);

For events:

useTrackPlayerEvents(
    [
      Event.RemotePause,
      Event.RemotePlay,
      Event.RemoteJumpForward,
      Event.RemoteJumpBackward,
    ],
    async event => {
      if (event.type === Event.RemotePause) {
        setPlay(false);
      } else if (event.type === Event.RemotePlay) {
        setPlay(true);
      } else if (event.type === Event.RemoteJumpBackward) {
        skipBackward();
      } else if (event.type === Event.RemoteJumpForward) {
        skipForward();
      }
    },
  );

Pls share any alternative way for this issue

Version: react-native-track-player: ^4.1.1

lokeshk12510 avatar Apr 10 '24 13:04 lokeshk12510

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Jul 10 '24 01:07 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Jul 17 '24 01:07 github-actions[bot]