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

[AVPlayerItem addOutput:] Cannot attach an output that is already attached or nil output #2230

Open AjayGol opened 6 months ago

AjayGol commented 6 months ago

Describe the Bug *** [AVPlayeritem addOutput:] Cannot attach an output that is already attached or nil output.

Steps To Reproduce TBH it did not happen to me on debug, but it seems that is happening to my users in production. I have reports from Firebase Crashlytics.

Screenshot 2023-12-29 at 12 25 40 PM

Screenshot 2023-12-29 at 12 25 50 PM

OS: macOS 13.5.2 CPU: (8) arm64 Apple M1 react-native: ^0.68.0 => ^0.68.0 xCode: 15(15A240d)/usr/bin/xcodebuild

Using react-native-track-player@^4.0.1

This is happen on real devices, most of them iOS 16 and up.

fivecar commented 3 months ago

My users are getting this in production off v4.0.1 as well (with an example today on iOS 17.4 using iPhone 15 Pro). @jspizziri : in #1818, you mentioned that the particular issue would be better handled/supported if people got off the RC's... I think it's now been seen by many folks on 4.0.1, so it feels like a legitimate/continued issue.

I'm happy to help make a PR here, but I'm not positive what the actual fix should be. For instance, should we try to detect an already-attached or nil output, and simply not try to startObserving it? Or alternatively, does hitting this code path indicate a deeper problem that we need to fix upstream of this moment?

9mzodiac commented 2 months ago

This issue is also affecting my app, I hope it gets fixed soon