react-native-track-player: [iOS] Artwork not showing on lock screen

Configuration

React Native Environment Info: System: OS: macOS 10.14.3 Binaries: Node: 10.12.0 - /usr/local/bin/node Yarn: 1.9.4 - /usr/local/bin/yarn npm: 6.4.1 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman SDKs: iOS SDK: Platforms: iOS 12.2 Android SDK: API Levels: 23, 26, 27, 28 Build Tools: 28.0.3 System Images: android-28 | Google APIs Intel x86 Atom, android-28 | Google Play Intel x86 Atom npmPackages: react: 16.8.3 => 16.8.3 react-native: ^0.59.4 => 0.59.4

React Native Track Player - v1.1.4

Issue

The artwork for the tracks is not showing up on the lock screen on iOS, on Android everything is fine. On iOS, instead of showing the correct artwork it shows the app icon instead.

Code

I am adding tracks like this TrackPlayer.add({ id: value.name, url: value.url, title: value.name, artist: value.artist, artwork: value.artwork });

The artwork field is: artwork: require('App/assets/x.jpg')

The artwork is showing fine within the app but never works on the lock screen.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 1
  • Comments: 16 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Thanks! 🥇

I was able to reproduce the issue using the 2 ways of declaring a local file path mentioned in the docs.

artwork: require("./assets/art/101-200x200.jpg")
import RNFS from 'react-native-fs';

artwork: `file://${RNFS.MainBundlePath}/assets/art/102-200x200.jpg`

// file:///private/var/containers/Bundle/Application/6AC2D202-1D7D-45A7-BD2D-854ACBF7F0F1/RNTPExample.app/assets/art/102-200x200.jpg

In both of these cases the images fail to load in iOS lock screen controls.

In both cases, https://github.com/react-native-kit/react-native-track-player/pull/897 resolves the issue.