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.18k stars 981 forks source link

setQueue() crashes app with bundled audio file #2191

Closed mihailapuste closed 5 months ago

mihailapuste commented 8 months ago

Describe the Bug A clear and concise description of what the bug is.

When using local bundled files along with TrackPlayer.setQueue(tracks) my react native app crashes. I've only tested iOS. This is not however an issue if I use TrackPlayer.add(tracks)

Steps To Reproduce How can someone else reproduce this bug?

Code To Reproduce Please provide a simple code example that allows others to replicate the bug.

repro crash on ios

const audioTracks = [
 {
    url: require('./audioFile.mp3')
 }
];

const loadTracks = async (tracks: Track[]): Promise<void> => {
  try {
    await TrackPlayer.setQueue(tracks);
  } catch (err: any) {
    warn('Error loading tracks:', err);
  }
};

await loadTracks(audioTracks); // crash

const addTracks = async (tracks: Track[]): Promise<void> => {
  try {
    await TrackPlayer.add(tracks);
  } catch (err: any) {
    warn('Error loading tracks:', err);
  }
};

await addTracks(audioTracks); // works

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

System:
  OS: macOS 14.0
  CPU: (8) arm64 Apple M1
  Memory: 84.64 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.1.0
    path: /opt/homebrew/bin/node
  Yarn:
    version: 1.22.19
    path: /opt/homebrew/bin/yarn
  npm:
    version: 10.2.0
    path: /opt/homebrew/bin/npm
  Watchman:
    version: 2023.10.23.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.13.0
    path: /Users/mihailapuste/.rvm/gems/ruby-3.1.2/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 23.0
      - iOS 17.0
      - macOS 14.0
      - tvOS 17.0
      - watchOS 10.0
  Android SDK: Not Found
IDEs:
  Android Studio: 2022.1 AI-221.6008.13.2211.9514443
  Xcode:
    version: 15.0/15A240d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.8
    path: /Library/Java/JavaVirtualMachines/jdk-17.jdk/Contents/Home/bin/javac
  Ruby:
    version: 3.1.2
    path: /Users/mihailapuste/.rvm/rubies/ruby-3.1.2/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.2.0
    wanted: 18.2.0
  react-native:
    installed: 0.72.5
    wanted: 0.72.5
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: true
  newArchEnabled: false
iOS:
  hermesEnabled: true
  newArchEnabled: false

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

    "react-native-track-player": "^4.0.0",

Real device? Or simulator?

How I can Help What can you do to help resolve this? Have you investigated the underlying JS or Swift/Android code causing this bug? Can you create a Pull Request with a fix?

lovegaoshi commented 8 months ago

this might be related to the local import asset issues people have been experiencing; does this pr fix this?

github-actions[bot] commented 5 months ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 5 months ago

This issue was closed because it has been stalled for 7 days with no activity.