You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the Bug
I am encountering an issue where playbackState.state === State.Ended is not reliably triggered when an audio file finishes playing. Instead of reaching Ended, the playback state sometimes gets stuck in Loading or Buffering, and the same audio repeats unexpectedly.
This issue occurs inconsistently and seems to affect both real devices and emulators.
Steps To Reproduce
Setup Location-Based Playback
Implement react-native-track-player to play audio based on the user’s location.
Use a queue of audio tracks that play when the user reaches specific GPS coordinates.
Trigger Audio Playback by Changing Location
When the user arrives at a predefined location, start playing the assigned audio track.
If a video is playing, queue the next audio track instead of playing it immediately.
Monitor Playback State
Use usePlaybackState() to track changes in playback state.
Log the state changes (Loading, Playing, Paused, Buffering, Ended, etc.).
Issue Observed:
Sometimes, when a track finishes playing, playbackState.state does not transition to State.Ended.
Instead, it gets stuck in Buffering or Loading, causing the same track to replay instead of moving to the next track.
This behavior occurs inconsistently but affects both real devices and emulators.
i cant reproduce. if u cant reproduce using (a modified ver of) the example app, most likely people dont know what u did or even what ur talking about. ur best bet is to reproduce with the example app, bc ppl know how to compile and run that. otherwise gl.
i cant reproduce. if u cant reproduce using (a modified ver of) the example app, most likely people dont know what u did or even what ur talking about. ur best bet is to reproduce with the example app, bc ppl know how to compile and run that. otherwise gl.
please check the Code To Reproduce section now I have updated the code with what I'm using
Having the same issue - anyone found any workarounds yet?
You can respond with this message in the GitHub issue section:
Hey @alexd-femmi, I ran into the same issue and found a workaround. I added a 2-second silent buffer at the end of each audio file and then manually checked the playback progress to stop the player when it reaches the expected end. Here's the approach:
It’s not a perfect solution, but it ensures the player stops correctly without cutting off the last part of the audio. Hope this helps! Let me know if you find a better fix. 🚀
Describe the Bug
I am encountering an issue where playbackState.state === State.Ended is not reliably triggered when an audio file finishes playing. Instead of reaching Ended, the playback state sometimes gets stuck in Loading or Buffering, and the same audio repeats unexpectedly.
This issue occurs inconsistently and seems to affect both real devices and emulators.
Steps To Reproduce
Setup Location-Based Playback
react-native-track-player
to play audio based on the user’s location.Trigger Audio Playback by Changing Location
Monitor Playback State
usePlaybackState()
to track changes in playback state.Loading
,Playing
,Paused
,Buffering
,Ended
, etc.).Issue Observed:
playbackState.state
does not transition toState.Ended
.Buffering
orLoading
, causing the same track to replay instead of moving to the next track.Code To Reproduce
Expected Behavior:
• State should transition to Ended when audio finishes.
• Should not get stuck in Buffering or Loading after finishing a track.
Actual Behavior:
• The track sometimes repeats instead of stopping.
• The state gets stuck in Buffering or Loading instead of Ended.
Replicable on Example App?
No
Environment Info:
System:
OS: macOS 15.3
CPU: (8) arm64 Apple M2
Memory: 143.38 MB / 8.00 GB
Shell:
version: "5.9"
path: /bin/zsh
Binaries:
Node:
version: 23.2.0
path: /opt/homebrew/bin/node
Yarn:
version: 1.22.22
path: /opt/homebrew/bin/yarn
npm:
version: 10.9.0
path: /opt/homebrew/bin/npm
Watchman:
version: 2024.11.11.00
path: /opt/homebrew/bin/watchman
Managers:
CocoaPods:
version: 1.16.2
path: /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms:
- DriverKit 24.2
- iOS 18.2
- macOS 15.2
- tvOS 18.2
- visionOS 2.2
- watchOS 11.2
Android SDK: Not Found
IDEs:
Android Studio: 2024.2 AI-242.23726.103.2422.12816248
Xcode:
version: 16.2/16C5032a
path: /usr/bin/xcodebuild
Languages:
Java:
version: 17.0.13
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.10
wanted: 0.72.10
react-native-macos: Not Found
npmGlobalPackages:
"react-native": Not Found
Android:
hermesEnabled: true
newArchEnabled: false
iOS:
hermesEnabled: true
newArchEnabled: false
react-native-track-player: 4.1.1
Both Android and iOS
Both Real and Simulators/Emulators
Android: 14
ios: 18.1.1
The text was updated successfully, but these errors were encountered: