Skip to content

Conversation

@jspizziri
Copy link
Collaborator

@jspizziri jspizziri commented Jun 25, 2025

  • Migrates the library to use media3 on Android.
  • Migrates the library to be compatible with the newArch.
  • Removes support for the legacy architecture.
  • Removes deprecated functionality.

TODO:

  • Add web example
  • Fix issues with Remote playback events not firing.
  • Test web
  • Upgrade example to react-native@0.80.0
  • Fix iOS CI pipeline

behenate and others added 30 commits November 4, 2024 13:41
Node 22 has entered LTS as of October 2024
Brings in media3 & android-auto functionalities from https://github.com/lovegaoshi/react-native-track-player, leaving out widget & audio fading functionalities
- show jump backward & forward buttons in notification
- remove compactCapabilities
- rename BaseAudioPlayer#player to BaseAudioPlayer#forwardingPlayer
@jspizziri
Copy link
Collaborator Author

jspizziri commented Aug 6, 2025

Alright, I've fixed the issue where the remote events weren't firing.

While I was looking around I found a lot of Android Auto related code that I'm going to strip back out of this PR for the next release. To reiterate, this release is going to focus specifically on media3 and turbomodules.

EDIT: I'm going to wait a few days for some community feedback on the remote events. If everything checks out, I plan on releasing a 5.0.0-alpha.0 soon.

@revenkroz

This comment was marked as off-topic.

@jspizziri

This comment was marked as off-topic.

@dodgex
Copy link

dodgex commented Aug 7, 2025

Alright, I've fixed the issue where the remote events weren't firing.

While I was looking around I found a lot of Android Auto related code that I'm going to strip back out of this PR for the next release. To reiterate, this release is going to focus specifically on media3 and turbomodules.

EDIT: I'm going to wait a few days for some community feedback on the remote events. If everything checks out, I plan on releasing a 5.0.0-alpha.0 soon.

Hey @jspizziri cool that you fixed the events! :)

Could you consinder #2478 (comment) to fix MetadataTimedReceived events on iOS, before going 5.0.0-alpha.0?

Thanks in advance! ❤️

@radko93
Copy link

radko93 commented Aug 7, 2025

Retested the branch and confirm media buttons work on Android in my app. Same on iOS.

Tip: when testing this make sure to force close the app completely when changing any options in player. Changing and reloading might break it.

@doughsay
Copy link

doughsay commented Aug 7, 2025

I can confirm the remote events are now fixed for me! Thanks! ❤️

@jspizziri
Copy link
Collaborator Author

@dodgex 6107f65

@h1rdr3v2

This comment has been minimized.

…-agent for Media3 requests (#2496)

Added a custom user-agent string to prevent 403 errors when playing Live365 streams using Media3.
@tomislav-arambasic
Copy link
Contributor

tomislav-arambasic commented Aug 12, 2025

@jspizziri @lovegaoshi @puckey
Forgive my ignorance, please spare me time researching the code & testing full features....

Could someone explain where we at with CarPlay & Android Auto?

I've used something like @lovegaoshi's approach to carplay & android auto, on stable version of rntp, so far and I'd like to offer my help if there's anything else to be done about carplay, so that we can have proper feature integrated with new rntp version asap.

I can tell you that the current issue is with Google, they're rejecting builds that have both MediaBrowserService (defined by rntp) & CarAppService (defined in react-native-carplay, if rntp is to use it? or maybe you're creating fully owned implementation?) declarations in manifest files.
My app was fine removing CarAppService & all android auto specific permissions from that same manifest, but I'm not sure that'd be the case for all apps.

Any way, let me know if I can assist in any way.
And thanks for all the hard work!

@leonardopicinin
Copy link

leonardopicinin commented Aug 12, 2025

I’m testing the library on the latest commit (492d349) and here are some considerations that might help...

My setup:
React Native – 0.76.9
Expo – 52 managed

Android 16 and 15: Everything seems to work fine in the emulator, but on some real devices it doesn’t behave as expected, for example, when trying to use the remote controllers with the expanded notification (OnePlus 11 device). In other cases, the controller only closes if the app itself is closed.

Android 12 and 9: NOTHING works, none of the remote events.

iOS 18.5: Everything seems to be working very well.

EDIT:
After some testing with different commits and configurations, I arrived at this setup which, so far (for my setup), seems to be the most promising.

Using this commit: 0001895

const capabilities = [
Capability.Play,
Capability.Pause,
Capability.SkipToNext,
Capability.SkipToPrevious,
Capability.SeekTo,
Capability.JumpBackward,
Capability.JumpForward,
];

const notificationCapabilities = [Capability.Play, Capability.Pause];

if (Platform.OS === "android" && Platform.Version > 31) {
notificationCapabilities.push(
Capability.SkipToNext,
Capability.SkipToPrevious,
Capability.JumpBackward,
Capability.JumpForward,
);
}

With this approach, on Android <= 12, Play, Pause, Skip to Next, and Skip to Previous are enabled and working (even if Skip to Next and Previous are not explicitly enabled). For Android versions above 12, all events work, including the jumps. It’s also worth noting that the issues with the expanded card are still happening on some devices.

@jspizziri
Copy link
Collaborator Author

@tomislav-arambasic

Could someone explain where we at with CarPlay & Android Auto?

While those issues are very important and a priority for many (including me), this PR specifically is leaving carplay and android auto alone. Right now we're making some needed upgrades to the library that will, ideally pave the way for those things. We can talk about the future of android auto and carplay elsewhere once this has been released and is stable.

@tomislav-arambasic
Copy link
Contributor

@tomislav-arambasic

Could someone explain where we at with CarPlay & Android Auto?

While those issues are very important and a priority for many (including me), this PR specifically is leaving carplay and android auto alone. Right now we're making some needed upgrades to the library that will, ideally pave the way for those things. We can talk about the future of android auto and carplay elsewhere once this has been released and is stable.

Understandable. Appreciate the answer.

@jspizziri
Copy link
Collaborator Author

@leonardopicinin ,

Android 16 and 15: Everything seems to work fine in the emulator ... on some real devices it doesn’t behave as expected

I can't test what I can't see and reproduce. I'm not sure if this is an actionable statement for me at this point.

Android 12 and 9: NOTHING works, none of the remote events.

Android API Level 35 (Android 15) is now required for all Google Play apps. We will not be supporting those operating systems moving forward. If you need to support them then you'll either need to use an older version of the library or fork.

@jspizziri
Copy link
Collaborator Author

v5.0.0-alpha0 has been published to npm.

@jspizziri jspizziri merged commit 4f1e0c9 into main Aug 12, 2025
4 of 5 checks passed
@jspizziri jspizziri deleted the feat/media3-newarch branch August 12, 2025 13:24
@mcalc001
Copy link

Hi @jspizziri,

We’re still encountering a critical issue on Android with react-native-track-player.

Error:

Fatal Exception: java.lang.RuntimeException  
Unable to start service com.doublesymmetry.trackplayer.service.MusicService@ef92d81 with null:  
android.app.ForegroundServiceStartNotAllowedException: Service.startForeground() not allowed due to mAllowStartForeground false: service tv.liverpoolfc/com.doublesymmetry.trackplayer.service.MusicService

Environment:
• expo: ~51.0.39
• react-native: 0.74.5
• react-native-track-player: 4.1.1

Is this a known issue, or are there any recommended workarounds or fixes? This is currently our highest crash source on Android.

Thanks for your help 🙏

@watadarkstar
Copy link

watadarkstar commented Oct 8, 2025

v5.0.0-alpha0 has been published to npm.

@jspizziri Any idea when this will be stable? It still has bugs on Android like @mcalc001 pointed out.

@cbdeveloper
Copy link

Should this be updated? It still says that it does not support the newArch.

https://reactnative.directory/package/react-native-track-player

@gavrichards
Copy link
Contributor

Should this be updated? It still says that it does not support the newArch.

https://reactnative.directory/package/react-native-track-player

It doesn't. The last official release is still 4.1.2 which doesn't support the New Architecture. The only version of this library that does (although there are known unaddressed bugs) is an alpha version. Alpha versions are generally reserved for internal testing.

@subvertallchris
Copy link

Is there a timeline for more updates to this and getting v5 stable and launched? We'd be happy to discuss funding some of this work if it helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.