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.31k stars 1.02k forks source link

Fix broken events in Bridgeless mode (React Native New Architecture) #2370

Open robik opened 2 months ago

robik commented 2 months ago

This PR fixes broken event emitting in React Native new architecture.

EDIT: This is breaking change, and mostly acts as a preview. I will try to come up with a solution for it if time allows.

This is a partial solution, and requires:

pigeonmal commented 2 months ago

I have test this patch with new arch react native 0.75.3. But i got this kotlin error : MusicService.kt error: unresolved reference: reactContext

robik commented 2 months ago

I have test this patch with new arch react native 0.75.3. But i got this kotlin error : MusicService.kt error: unresolved reference: reactContext

This probably is caused by the fact that the old RN is used (RN patch was not applied or it was not built from source)

pigeonmal commented 2 months ago

Thanks for your reply, and how can i fix that ?

My steps :

lovegaoshi commented 2 months ago

see https://github.com/lovegaoshi/RNTPExampleNewArch/tree/fix ur either missing https://github.com/lovegaoshi/RNTPExampleNewArch/blob/830428365aac927e2f3c984fe414469b6d4c88af/android/settings.gradle#L9 or https://github.com/lovegaoshi/RNTPExampleNewArch/blob/fix/patches/react-native%2B0.75.3.patch

pigeonmal commented 2 months ago

Yes the only file i not have the same as you is settings.gradle (i have the default one). If add your modifications, i have an other error :

`Could not determine the dependencies of task ':react-native:packages:react-native:ReactAndroid:hermes-engine:configureBuildForHermes'.

Could not create task ':react-native:packages:react-native:ReactAndroid:hermes-engine:installCMake'. Could not find sdkmanager executable.`

lovegaoshi commented 2 months ago

so u r having compilation issues. if u dont add that in, ie. https://reactnative.dev/contributing/how-to-build-from-source, ur not compiling RN and not applying any changes. this is outside the scope of this PR and u should seek help in the general RN community. im not going to pretend compiling RN is easy. its a PITA and im too sane now to troubleshoot someone elses env setup.

Noitham commented 4 weeks ago

Now that 0.76 has been released, should we pick up again on this PR?

Ref. https://github.com/doublesymmetry/react-native-track-player/pull/2290

lovegaoshi commented 4 weeks ago

with 0.76.1 released these prs can finally be tested. for the lazy folks my example is now upgraded to newarch + 0.76.1. im still waiting for expo 52 to actually test newarch myself, but with possibly many of my used libs breaking, im not spending a whole lot of effort here.

syed-shoaib-ali commented 3 weeks ago

Now that 0.76 has been released, should we pick up again on this PR?

Ref. #2290

in new architecture the app crashes while setupPlayer so will this PR covered that issue as well?

lovegaoshi commented 3 weeks ago

like i said my example app runs. so presumably yes.

On Thu, Oct 31, 2024, 11:59 AM Syed Shoaib Ali @.***> wrote:

Now that 0.76 has been released, should we pick up again on this PR?

Ref. #2290 https://github.com/doublesymmetry/react-native-track-player/pull/2290

in new architecture the app crashes while setupPlayer so will this PR covered that issue as well?

— Reply to this email directly, view it on GitHub https://github.com/doublesymmetry/react-native-track-player/pull/2370#issuecomment-2450614958, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZMOVVTUY5Q3D56O6YSFBJ3Z6J4XXAVCNFSM6AAAAABOFEDBAGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDINJQGYYTIOJVHA . You are receiving this because you commented.Message ID: @.*** com>