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 980 forks source link

[Feature Request] Dcument AudioPlaybackState.Error codes #2325

Open eedeebee opened 2 weeks ago

eedeebee commented 2 weeks ago

What is the need and use case of this feature? I want to capture playback errors (to sentry for example), but some errors are expected under normal conditions of use. In particular, I want to be able to differentiate errors caused by the network being inaccessible as those are interesting to me (content is missing or corrupt or whatever other errors I don't actually know since they aren't documented) per se. There are apis that will tell me when the device is on/off line but coordinating those with rntp will make it challenging and it would be more practical if rntp just documented the errors it sends so I could make a call on what is interesting or not.

Describe the ideal solution Documentation of the error codes

Describe alternatives you've considered See above - it would be possible to use some other utility for detecting networking state but coordinating that state with rntp error state and the timing of changes would likely be challenging at best.

Example For example, when I'm calling fetch I can ignore the networking errors this way

if (!(error instanceof TypeError) && (error as Error).name !== "TimeoutError") {    
       Sentry.captureException(error);
}
lovegaoshi commented 2 weeks ago

i dont think rntp reimplements any of the native errors. so u shiuld consult the native players error constants and diy

eedeebee commented 2 weeks ago

You can imagine that a user of rntp doesn’t know the names of the native packages rntp uses never mind what api calls rntp uses etc and what errors can be sent from those… would you want to consider including in the rntp docs some links to those details or do you expect someone to have to peer into rntp implementation to discover that?Thank you!On Jun 13, 2024, at 7:08 AM, lovegaoshi @.***> wrote: i dont think rntp reimplements any of the native errors. so u shiuld consult the native players error constants and diy

—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>

lovegaoshi commented 2 weeks ago

cant u just open up xcode/android studio and click though a bunch of function names, and they will land u to what native players used?

but if ud like u can add this to the docs. Android is kotlinaudio -> exoplayer 2, and iOS is swiftaudioex -> AVPlayer. much appreciated. they are somewhat described in the example app's readme. https://github.com/doublesymmetry/react-native-track-player/tree/main/example