react-native-track-player icon indicating copy to clipboard operation
react-native-track-player copied to clipboard

[Feature Request] Android Auto

Open lostchopstik opened this issue 2 years ago • 5 comments

What is the need and use case of this feature? In order to support the proper media architecture and ultimately support Android Auto, the music service would have to implement MusicBrowserServiceCompat.

Describe the ideal solution The MusicService.kt extends MusicBrowserServiceCompat

Describe alternatives you've considered Not sure of any alternative.

Additional context I saw this old issue #598, so I'm aware this is probably a no-go. But I'm really just curious what I would lose in a forked project if I swapped out HeadlessJsTaskService with a MediaBrowserServiceCompat.

My ultimate goal here is to be able to use the services in this library and extend them to be able to support Android Auto and Google Assistant commands.

How I can Help What can you do to help get this feature into production? I can be available to test the feature as needed.

Can you assist by working on this feature and creating a Pull Request? The services area is not my area of expertise, unfortunately.

lostchopstik avatar May 06 '22 21:05 lostchopstik

@lostchopstik

I think android auto support would be excellent. With that said I don't think the approach you suggest will work. The HeadlessJSTaskService is necessary perform JS executions while an app is in the background. Removing it would interrupt headless events.

I'm not sure what the correct approach is but if you're willing to do some legwork on it it might be worth getting the insights of @mpivchev and @dcvz

jspizziri avatar May 06 '22 22:05 jspizziri

@lostchopstik as @jspizziri mentioned, we need the headless task service for RN functionality to work and we can't implement both.

We haven't given auto support a lot of thought and it's not in our immediate roadmap, but if it's something you're willing to work on we can get @mpivchev to brainstorm with us on ideas for implementation possibilities.

dcvz avatar May 07 '22 07:05 dcvz

@dcvz I can certainly work on it, and I've got a good amount of bandwidth to do so right now. I would definitely need the brainstorming to figure out what direction to go.

lostchopstik avatar May 07 '22 23:05 lostchopstik

Both Android Auto and Apple Carplay would be awesome. There are some work going on in https://github.com/birkir/react-native-carplay/issues/81 regarding the possibility of supporting both with React Native, but I am not sure if and how this would integrate with RNTP, and I think it does not have a working Playing Now template which would be important for an app using RNTP.

martinmidtsund avatar May 09 '22 09:05 martinmidtsund

I wonder if there's a way to be able to create a CarPlay app that can trigger play/pause/skip using the SoundPlayerService?

davidsalib avatar Jun 17 '22 20:06 davidsalib

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.

github-actions[bot] avatar Sep 16 '22 02:09 github-actions[bot]

Moving to the feature backlog

jspizziri avatar Sep 16 '22 09:09 jspizziri

Any progress/alternative solutions regarding this?

kristjanulst avatar Feb 09 '23 09:02 kristjanulst

There's active development for android auto in #2094

DanielKuhn avatar Aug 23 '23 11:08 DanielKuhn

is there any support for Apple CarPlay?

harrymash2006 avatar Oct 09 '23 10:10 harrymash2006

is there any support for Apple CarPlay?

@harrymash2006 For CarPlay there's this package which integrates nicely with RNTP: https://github.com/birkir/react-native-carplay/issues/43

DanielKuhn avatar Oct 09 '23 11:10 DanielKuhn

@DanielKuhn yes I am trying to integrate this but do not have any idea how it exactly works due to lack of examples.

harrymash2006 avatar Oct 09 '23 11:10 harrymash2006

@harrymash2006 There's a fully-fledged react native CarPlay example provided by the package: https://github.com/birkir/react-native-carplay/tree/master/apps/example

Integrating the package boils down to

  • adding a useEffect somewhere in your app that listens to the CarPlayConnected event provided by the package
  • pushing a base template onto the CarPlay stack
  • starting track player playback based on an itemSelected event
  • pushing the NowPlaying template onto the CarPlay stack

DanielKuhn avatar Oct 09 '23 12:10 DanielKuhn

let me check, in meantime if any one have example using track player and cardplay please share, thanks and I really appreciate the help @DanielKuhn.

harrymash2006 avatar Oct 09 '23 12:10 harrymash2006

@harrymash2006 Did you manage to run the example app in react-native-carplay ? if so the latest version ? I am getting a bunch of errors

elieT27 avatar Dec 06 '23 09:12 elieT27