Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clearNowPlayingMetadata clears metadata, but never comes back #1653

Closed
DennisdeWitNL opened this issue Aug 17, 2022 · 15 comments
Closed

clearNowPlayingMetadata clears metadata, but never comes back #1653

DennisdeWitNL opened this issue Aug 17, 2022 · 15 comments

Comments

@DennisdeWitNL
Copy link

DennisdeWitNL commented Aug 17, 2022

Describe the Bug
After clearing the now playing metadata by clearNowPlayingMetadata, every new track added, will not show the metadata anymore, unless you fully restart the app after forcing the app to stop. This is an Android issue.

Steps To Reproduce

  1. Download my example here: https://github.com/DennisdeWitNL/example-clearmetadata
  2. Play the song. Check the metadata in the notification control center. It is there.
  3. Now pause the song and check the metadata. It is still there.
  4. Now click Clear Metadata. The metadata has been cleared.
  5. Now click Queue and then click Play. There is still no metadata, unless you fully restart the app and stop the service.

Code To Reproduce
Please download my edited example here: https://github.com/DennisdeWitNL/example-clearmetadata

Environment Info:
Paste the results of npx react-native info

info Fetching system and libraries information...
System:
    OS: macOS 13.0
    CPU: (10) arm64 Apple M1 Max
    Memory: 3.93 GB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.7.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - ~/Documents/Apps/node_modules/.bin/yarn
    npm: 8.15.0 - /opt/homebrew/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.0, iOS 16.0, macOS 13.0, tvOS 16.0, watchOS 9.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 14.0/14A5270f - /usr/bin/xcodebuild
  Languages:
    Java: 17.0.3.1 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2 
    react-native: 0.68.1 => 0.68.1 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found


Paste the exact react-native-track-player version you are using

[email protected]
Real device? Or simulator?
Both

What OS are you running?
macOS Ventura with Android Studio, the latest SDK. Also fails on a Samsung Galaxy S10 Ultra

How I can Help
What can you do to help resolve this?
Have you investigated the underlying JS or Swift/Android code causing this bug?
Can you create a Pull Request with a fix?

There is no log in Logcat, therefore I don't know where to start. Willing to test a PR of course!

@jspizziri
Copy link
Collaborator

Possibly related to #1719?

@gavrichards
Copy link
Contributor

  1. Now click Queue and then click Play. There is still no metadata, unless you fully restart the app and stop the service.

The code for the Queue button in the example app is:

          <Button
            title="Queue"
            onPress={() => console.log('TODO: implement queue interface')}
            type="primary"
          />

So I don't think we can expect this to do anything 😉

@jspizziri
Copy link
Collaborator

@gavrichards ahh... Nice catch!

@DennisdeWitNL , @gavrichards is correct, that button in the example app currently doesn't do anything. Can you update your reproduction steps to outline how to repro?

@DennisdeWitNL
Copy link
Author

@gavrichards
Copy link
Contributor

@jspizziri I can confirm the described behaviour is correct - no matter what you do, the metadata doesn't come back once it has been cleared. Even calling TrackPlayer.updateMetadataForTrack with the proposed fix for KotlinAudio doesn't bring it back.

@puckey
Copy link
Collaborator

puckey commented Oct 7, 2022

I can fix this, but I am wondering what TrackPlayer.clearNowPlayingMetadata() is expected to do exactly. I don't see the method in the docs.. @jspizziri perhaps you know?

@DennisdeWitNL what do you expect from this functionality and why do you need it?

Is it supposed to set all the metadata fields to empty string?

Should it remove the notification? (in which case, why would you want to?)

@DennisdeWitNL
Copy link
Author

To be fair, I don’t need this function anymore. I have replaced it with the StoppedPlaybackAndRemoveNotification updateOption.

@puckey
Copy link
Collaborator

puckey commented Oct 7, 2022

Does anyone have a use for this functionality? Otherwise I would probably just nominate it for removal...

@jspizziri
Copy link
Collaborator

@gavrichards Do you know of a use case for this?

@gavrichards
Copy link
Contributor

@jspizziri I don't use it in our codebase. Our app is for live radio stations, and their "on demand" content. For live radio, when a track is playing we show that, and when a track is no longer playing we update the metadata to show the programme/host who is currently on air, or the station name/logo. So we never have a need to clear it completely.

@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2023

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 github-actions bot added the Stale label Jan 7, 2023
@jspizziri jspizziri removed the Stale label Jan 7, 2023
puckey added a commit to puckey/react-native-track-player that referenced this issue Feb 6, 2023
@puckey
Copy link
Collaborator

puckey commented Feb 6, 2023

Deprecated this functionality in the following pull request: #1909

@watadarkstar
Copy link

@puckey We are on version 3.2 and use clearNowPlayingMetadata method to remove the track player from the notifications tray. See here for more context:
#1834 (comment)

Are you sure you want to deprecate this method? If so, how will we clear the track player from the notification tray? Since calling reset does not clear it from the tray.

hlieb53 added a commit to hlieb53/react-native-track-player that referenced this issue Nov 9, 2023
@puckey
Copy link
Collaborator

puckey commented Dec 3, 2024

@watadarkstar Could you make a feature request for this functionality? I guess the api would need to be something like hideNotification() and showNotification()? We will be going ahead with removing this undocumented method in the next major version, since I see no easy way to support it when we upgrade to media3 and the functionality is unclear.

@watadarkstar
Copy link

@watadarkstar Could you make a feature request for this functionality? I guess the api would need to be something like hideNotification() and showNotification()? We will be going ahead with removing this undocumented method in the next major version, since I see no easy way to support it when we upgrade to media3 and the functionality is unclear.

Ok I created the feature request #2415

puckey added a commit to puckey/react-native-track-player that referenced this issue Dec 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

5 participants