Skip to content

TrackPlayer.load does not accept artwork: ResourceObject and crashes #2462

@speedtreammanga

Description

@speedtreammanga

Describe the Bug
The function load does not accept a Track object with its artwork field defined as a ResourceObject.

Steps To Reproduce

  1. Clone this ready-made repository to reproduce the error
  2. In file App.js, comment lines 93-96, uncomment lines 98-101 and 113
  3. Run app

Code To Reproduce

await TrackPlayer.load({
  url: "https://files.freemusicarchive.org/storage-freemusicarchive-org/music/WFMU/Il_Sogno_Del_Marinaio/Live_on_Redundancy_Radio_with_DJ_Disk_Jockey_October_22_2014/Il_Sogno_Del_Marinaio_-_02_-_Partisian_Song.mp3",
  title: "some title",
  artist: "some artist",
  duration: 3.01,
  artwork: require("./assets/artwork.jpeg"), // causes a crash
});

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

❯ npx react-native info
info Fetching system and libraries information...
System:
  OS: macOS 15.5
  CPU: (10) arm64 Apple M1 Max
  Memory: 911.75 MB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 23.6.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.9.2
    path: /opt/homebrew/bin/npm
  Watchman: Not Found
Managers:
  CocoaPods:
    version: 1.16.2
    path: /opt/homebrew/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.4
      - iOS 18.4
      - macOS 15.4
      - tvOS 18.4
      - visionOS 2.4
      - watchOS 11.4
  Android SDK: Not Found
IDEs:
  Android Studio: Not Found
  Xcode:
    version: 16.3/16E140
    path: /usr/bin/xcodebuild
Languages:
  Java: Not Found
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli":
    installed: 18.0.0
    wanted: ^18.0.0
  react:
    installed: 19.0.0
    wanted: 19.0.0
  react-native:
    installed: 0.79.1
    wanted: 0.79.1
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: true
  newArchEnabled: true

info React Native v0.79.2 is now available (your project is running on v0.79.1).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.79.2
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.79.1&to=0.79.2
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".

Paste the exact react-native-track-player version you are using
^4.1.1
Real device? Or simulator?
real
What OS are you running?
iOS 18.4.1

How I can Help

  • Fix load to accept AddTrack instead of Track
    OR
  • Update TrackMetadataBase to match: artwork?: string | ResourceObject;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions