doublesymmetry / react-native-track-player

A fully fledged audio module created for music apps. Provides audio playback, external media controls, background mode and more!
https://rntp.dev/
Apache License 2.0
3.2k stars 984 forks source link

TrackPlayer.remove() seem not to work for my use case - removing my first and only track. #2175

Closed eedeebee closed 9 months ago

eedeebee commented 9 months ago

Describe the Bug I want to load one track. Then unload it and load a new one. I was hoping I could add() the first track. And then when I need, remove() it and add() a new one. If there is another way to achieve this use case, please lmk.

No matter whether I call remove(0) or remove(1), the only track I can get to play is the first one I added().

Steps To Reproduce See above.

Code To Reproduce pseudo code - add(track1 details), remove(0), add(track2 details), play() and I hear track 1.

Replicable on Example App? I dunno.

Environment Info: iOS simulator

System:
  OS: macOS 13.4
  CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz
  Memory: 1.08 GB / 64.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.16.0
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.19
    path: ~/.yarn/bin/yarn
  npm:
    version: 9.5.1
    path: /usr/local/bin/npm
  Watchman:
    version: 2023.08.07.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.12.1
    path: /usr/local/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 22.4
      - iOS 16.4
      - macOS 13.3
      - tvOS 16.4
      - watchOS 9.4
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.3 AI-223.8836.35.2231.10811636
  Xcode:
    version: 14.3.1/14E300c
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 11.0.20.1
    path: /usr/bin/javac
  Ruby:
    version: 2.6.10
    path: /usr/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.4
    wanted: 0.72.4
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

How I can Help Best I can tell the issue is in the native code and I barely speak swift, etc.

eedeebee commented 9 months ago

I was able to use .reset() to effect this. closing for now.