react-native-track-player: [android] single tracks cannot be played

Describe the bug When there are three or more tracks everything seems to be fine but I can’t play less than 3 tracks.

To Reproduce

await TrackPlayer.add({
  id: 'test',
  title: 'sample title',
  url: 'https://file-examples.com/wp-content/uploads/2017/11/file_example_MP3_700KB.mp3',
});
await TrackPlayer.play();

Environment (please complete the following information):

System:
    OS: Linux 5.3 Ubuntu 18.04.4 LTS (Bionic Beaver)
    CPU: (4) x64 Intel(R) Core(TM) i3-4160 CPU @ 3.60GHz
    Memory: 130.73 MB / 7.67 GB
    Shell: 4.4.20 - /bin/bash
  Binaries:
    Node: 12.16.2 - /tmp/yarn--1588188922614-0.9850763653958186/node
    Yarn: 1.22.4 - /tmp/yarn--1588188922614-0.9850763653958186/yarn
    npm: 6.14.4 - /usr/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  SDKs:
    Android SDK: Not Found
  IDEs:
    Android Studio: Not Found
  Languages:
    Java: 1.8.0_252 - /usr/bin/javac
    Python: 2.7.17 - /usr/bin/python
  npmPackages:
    @react-native-community/cli: Not Found
    react: 16.11.0 => 16.11.0 
    react-native: 0.62.2 => 0.62.2 
  npmGlobalPackages:
    *react-native*: Not Found

What react-native-track-player version are you using?

  • 1.2.3

Are you testing on a real device or in the simulator? Which OS version are you running?

  • Both. Android 9 and 5

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 23 (3 by maintainers)

Most upvoted comments

{"code": "playback-source", "message": "Unexpected NullPointerException: Attempt to invoke virtual method 'java.lang.String android.net.Uri.toString()' on a null object reference", "type": "playback-error"}

The error says that the track URL is invalid, can you show what are you using as the URL?