react-native-track-player icon indicating copy to clipboard operation
react-native-track-player copied to clipboard

When call `TrackPlayer.add` function, app always crash without any error log.

Open sarike opened this issue 2 years ago • 8 comments

Describe the Bug When call TrackPlayer.add function, app always crash without any error log.

Steps To Reproduce How can someone else reproduce this bug?

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

react-native info
info Fetching system and libraries information...
(node:5941) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
System:
    OS: macOS 12.2.1
    CPU: (4) x64 Intel(R) Core(TM) i5-5257U CPU @ 2.70GHz
    Memory: 28.21 MB / 8.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.7.0 - ~/.volta/tools/image/node/16.7.0/bin/node
    Yarn: 3.0.1 - ~/.volta/tools/image/yarn/1.22.11/bin/yarn
    npm: 7.20.3 - ~/.volta/tools/image/node/16.7.0/bin/npm
    Watchman: 4.7.0 - /usr/local/bin/watchman
  Managers:
    CocoaPods: 1.11.2 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.2, iOS 15.2, macOS 12.1, tvOS 15.2, watchOS 8.3
    Android SDK:
      API Levels: 28, 29, 30, 31
      Build Tools: 28.0.3, 29.0.2, 30.0.2, 30.0.3
      System Images: android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.1 AI-211.7628.21.2111.8139111
    Xcode: 13.2.1/13C100 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.12 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 17.0.2 => 17.0.2
    react-native: 0.67.3 => 0.67.3
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

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

v2.2.0-rc2

Real device? Or simulator?

Real device.

What OS are you running?

Android XiaoMi Mix3, Android 10

sarike avatar Mar 19 '22 15:03 sarike

I find the cause after so many tries.

I set Capability.JumpBackward and Capability.JumpForward in capabilities and compactCapabilities options.

sarike avatar Mar 19 '22 15:03 sarike

@mpivchev flagging this in the event that this is an issue with the Android rewrite.

The claim is that when you:

  1. Add the JumpBackward and JumpForward in capabilities to compactCapabilities options.
  2. Attempt to call TrackPlayer.add()

You get an app crash without error.

jspizziri avatar Apr 14 '22 14:04 jspizziri

@sarike I've just attempted to reproduce this in the example project against main and I'm unable to reproduce it. Steps I took:

  1. Added JumpForward & JumpBackward capabilities to both capabilities & compactCapabilities.
  2. Called TrackPlayer.add(...) of a track.

Result: everything worked as expected. If you're able to provide a more specific repro or ideally create an example based on the example project in this repo I'll reopen.

jspizziri avatar May 25 '22 20:05 jspizziri

Hi @jspizziri, I'm experience the same issue when calling TackPlayer.add(tracks) if I have the compactCapability Capability.SkipToPrevious added. We are on v2.2.0-rc3

Unfortunately I'm not able to get the example app up and running to try it out there (not sure what I'm doing wrong here, followed the Readme but getting a 500 in the metro bundler because it can't resolve react-native-track-player).

TobiDevloft avatar Jun 21 '22 14:06 TobiDevloft

@TobiDevloft can you please provide a reproducible example based on the example app? Happy to repoen if there's a clear repro.

jspizziri avatar Jun 21 '22 15:06 jspizziri

@jspizziri Here is a repo containing only the example app where the bug is reproducable. The crash happens if both Capability.Stop and Capability.SkipToPrevious are added to the compactCapabilities in StartupService.ts. If either of those are removed, the app does not crash.

TobiDevloft avatar Jun 22 '22 08:06 TobiDevloft

@TobiDevloft sorry, I don't want you to remove anything from the repo. I just want to see the modifications you made to the example app as it exists in the repository in order to reproduce the issue. The way you've done it generates a massive diff which is largely unusable.

The example app can build built and run in place right inside the repository.

jspizziri avatar Jun 23 '22 17:06 jspizziri

@jspizziri Sorry, I updated the repository to only contain the changes I made to reproduce the issue.

TobiDevloft avatar Jun 24 '22 09:06 TobiDevloft

I just tested the changes in your repo and I'm still not seeing the issue. Please make sure you're using the latest version (3.1 as of writing this).

jspizziri avatar Aug 30 '22 18:08 jspizziri