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

[Feature Request] Expose isServiceBound / hasInitialized Bool #2241

Open uzegonemad opened 5 months ago

uzegonemad commented 5 months ago

What is the need and use case of this feature? My app has some observed properties / reactions that fire when the app is launched. It isn't feasible to call this code after setupPlayer() has been called because of past design considerations that are difficult to refactor. This leads to player_not_initialized rejections.

It would be great if the Android isServiceBound and iOS hasInitialized bools were exposed so my code could wait for player setup. I think there was a PR/patch for this in past versions

Describe the ideal solution Add a public function like isPlayerSetup() which returns the related bool.

Describe alternatives you've considered Right now, I have a wrapper function that calls getPlaybackState() and checks for the status of the promise. Returning the state of the bool seems a little cleaner.

How I can Help I can probably work up a PR in the next month or so unless someone beats me to it.

github-actions[bot] commented 2 months ago

This issue is stale because it has been open 90 days with no activity. Remove stale label or comment or this will be closed in 7 days.

uzegonemad commented 2 months ago

Still relevant