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

Queue stops playing, or repeats a track 4 times

Open plell opened this issue 6 years ago • 1 comments

Configuration

System:
  OS: macOS High Sierra 10.13.6
  CPU: (4) x64 Intel(R) Core(TM) i5-7360U CPU @ 2.30GHz
  Memory: 9.68 GB / 16.00 GB
  Shell: 3.2.57 - /bin/bash
Binaries:
  Node: 10.13.0 - /usr/local/bin/node
  Yarn: 1.15.2 - /usr/local/bin/yarn
  npm: 6.4.1 - /usr/local/bin/npm
  Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
  iOS SDK:
    Platforms: iOS 12.0, macOS 10.14, tvOS 12.0, watchOS 5.0
  Android SDK:
    API Levels: 23, 25, 26, 27, 28
    Build Tools: 23.0.1, 26.0.1, 26.0.2, 27.0.3, 28.0.0, 28.0.3
    System Images: android-28 | Google Play Intel x86 Atom
IDEs:
  Android Studio: 3.4 AI-183.6156.11.34.5522156
  Xcode: 10.0/10A255 - /usr/bin/xcodebuild
npmPackages:
  react: ^16.8.4 => 16.8.6 
  react-native: ^0.59.9 => 0.59.10 
npmGlobalPackages:
  create-react-native-app: 2.0.2
  react-native-cli: 2.0.1
  react-native-create-library: 3.1.2
  react-native-git-upgrade: 0.2.7

What react-native-track-player version are you using? "react-native-track-player": "1.1.6"

Issue

I'm auto-playing voice notes received by MQTT connection through react-native-track-player. Using the queue, the track player stops playing after some time on samsung and huawei phones (new tracks will not play). I sometimes encounter the issue on my Pixel 3, but the phone type seems to dictate the frequency of the issue. After this issue starts, the only way to fix is to restart the app.

On other occasions, a single track will repeat 2 to 4 times.

Code

(event listener for clearing the queue when it's finished) TrackPlayer.addEventListener('playback-state', async (a) => { // console.log('playback-state',a) if (a.state === 1) { let existingQueue = await TrackPlayer.getQueue(); if (existingQueue.length) TrackPlayer.reset() } })

(method for adding a track to the queue and playing) const track = { id: data.wav+'_id', // Must be a string, required title: data.wav+'_t', artist: data.wav+'_a', url: https://h2h.sfo2.digitaloceanspaces.com/audio/${data.wav} } let existingQueue = await TrackPlayer.getQueue(); const alreadyInQueue = existingQueue.find(f=>f.url===track.url) if (alreadyInQueue) return await TrackPlayer.add(track) if (!existingQueue.length) TrackPlayer.play();

plell avatar Feb 24 '20 19:02 plell

Any traction with this issue? We've also had users reporting this issue with android / samsung devices. Seems very odd.

I'm using RNTP v1.2.2

octodhruv avatar Feb 25 '20 11:02 octodhruv