react-native-track-player: updateMetadataForTrack not working most of the time
Describe the Bug updateMetadataForTrack is not changing the notification and the Now Playing Center on Android. I’m leaving an example with the title property changing, but the same happens with the duration and with every other property.
Steps To Reproduce On Android Add a track to the queue, play it and try to update the notification with the updateMetadataForTrack. You should see a change in the notification, but that’s not happening. If you get the track you’ll see the changes, but the notification always stays the same (I think it worked once or twice, but fails most times).
Code To Reproduce
const oldTitle = (await TrackPlayer.getTrack(0))?.title;
console.log('old Title: ', oldTitle);
await TrackPlayer.updateMetadataForTrack(0, {
title: 'has changed',
});
const newTitle = (await TrackPlayer.getTrack(0))?.title;
console.log('newTitle', newTitle);
// oldTitle: 'My favourite Song'
// newTitle: 'hasChanged'
Environment Info:
System:
OS: macOS 12.2.1
CPU: (10) x64 Apple M1 Max
Memory: 28.82 MB / 32.00 GB
Shell: 5.8 - /bin/zsh
Binaries:
Node: 14.15.0 - ~/.nvm/versions/node/v14.15.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v14.15.0/bin/yarn
npm: 6.14.8 - ~/.nvm/versions/node/v14.15.0/bin/npm
Watchman: 2022.07.04.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 21.4, iOS 15.5, macOS 12.3, tvOS 15.4, watchOS 8.5
Android SDK: Not Found
IDEs:
Android Studio: 2021.2 AI-212.5712.43.2112.8609683
Xcode: 13.4.1/13F100 - /usr/bin/xcodebuild
Languages:
Java: 11.0.16 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: Not Found
react-native: Not Found
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
react-native-track-player v3.1.0 Also happens in nightly.
Android Studio Simulator and device.
MacOS.
How I can Help I can provide support and data.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 3
- Comments: 26 (10 by maintainers)
This is now fixed in
nightly, issue can be closed.This should be fixed now in
v4.0.0.0-rc07This issue was fixed in
4.0.0-rc05but seems to have come back in4.0.0-rc06.Should be fixed by https://github.com/doublesymmetry/KotlinAudio/pull/59
In the current
nightly, artist and title is now working, but the artwork no longer updates, getting stuck on the initial image for the track.@jspizziri I’ll give it a quick try now.