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

[4.0.0-rc09] Eventually playback stops in iOS at the end of a track if the screen is locked #2154

Closed lelukas closed 9 months ago

lelukas commented 9 months ago

Describe the Bug In iOS, playback eventually stops while playing with the screen locked. With the example queue provided by gist, it happened to me after 5 tracks. Sometimes it happens sooner, sometimes later. I tested this with a release build. Debug seems to be working fine.

Steps To Reproduce

This can be reproduced using the Example App:

1 - Use these tracks 2 - In the Example App, replace the added tracks in QueueInitialTracksServices.ts with the ones provide by the gist above. 3 - Build the app with build configuration set to Release, start playback, minimize the app and lock the screen.

Code To Reproduce

https://gist.github.com/lelukas/7415a86747273f9ba0a98dd68dac6b47

Replicable on Example App? Yes

Environment Info:

System: OS: macOS 13.5 CPU: (8) arm64 Apple M2 Memory: 114.72 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 20.5.1 - /opt/homebrew/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 9.8.0 - /opt/homebrew/bin/npm Watchman: 2023.09.04.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.13.0 - /Users/lucas/.rvm/gems/ruby-3.2.1/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.3 AI-223.8836.35.2231.10671973 Xcode: 15.0/15A240d - /usr/bin/xcodebuild Languages: Java: 11.0.20 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 18.2.0 => 18.2.0 react-native: 0.71.12 => 0.71.12 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

react-native-track-player 4.0.0-rc09 Tested in two real devices. iPhone Xs and iPhone 15. Both running 17.0.2

How I can Help What can you do to help resolve this? I can perform more tests in different iPhone devices Have you investigated the underlying JS or Swift/Android code causing this bug? No Can you create a Pull Request with a fix? No

jspizziri commented 9 months ago

@lelukas , so you're not able to reproduce the issue with the default tracks in the example app? Do you have any theories as to why that might be? It's possible that something is wrong with one or more of your audio files or something.

dcvz commented 9 months ago

Hey @lelukas I've tried this on my device using the example project and release mode. I cannot reproduce. I have my device locked, skipping tracks and am having no issues. Have you tried different devices and trying to see if there's any changes? Different networks?

jspizziri commented 9 months ago

@lelukas any thoughts on our comments above? We need to be able to reproduce it reliably otherwise this ticket will likely get closed.

jspizziri commented 9 months ago

@lelukas given the lack of response I'm going to close this. If you can provide more information to help us repro then we can reopen.

lelukas commented 9 months ago

Hey, sorry for the late reply. I haven't had much time to touch on this back again, but I tested a few more times and I still could not reproduce a pattern. It's still happening but always at a random track. I'm considering it indeed might be something wrong with the files or something regarding how these files are served.

I'll download a bunch of them and self host or load locally to see if the problem persists. I'll come back with more details later. Thanks again.

wowitsjerome commented 5 months ago

@jspizziri we found the issue and what we were experiencing with the player was only a symptom of an issue related to the main app on iOS with high CPU usage due to some poor performance in one of our components. Just thought we'd share since we discovered and fixed the issue and now the player works uninterrupted.