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.29k stars 1.01k forks source link

[Feature Request] Android Auto #1533

Closed lostchopstik closed 2 years ago

lostchopstik commented 2 years ago

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.

jspizziri commented 2 years ago

@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

dcvz commented 2 years ago

@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.

lostchopstik commented 2 years ago

@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.

martinmidtsund commented 2 years ago

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.

davidsalib commented 2 years ago

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

github-actions[bot] commented 2 years 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.

jspizziri commented 2 years ago

Moving to the feature backlog

kristjanulst commented 1 year ago

Any progress/alternative solutions regarding this?

DanielKuhn commented 1 year ago

There's active development for android auto in #2094

harrymash2006 commented 1 year ago

is there any support for Apple CarPlay?

DanielKuhn commented 1 year ago

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

harrymash2006 commented 1 year ago

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

DanielKuhn commented 1 year ago

@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

harrymash2006 commented 1 year ago

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.

elieT27 commented 11 months ago

@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

syedslegend786 commented 5 months ago

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.

Hi, i am building a react native+ RNTP app , i want to play my audio podcasts on android-auto, but iam facing alot of errors. Do you have any working example project , which you can share with me,

DanielKuhn commented 5 months ago

@syedslegend786 you need to check out https://github.com/doublesymmetry/react-native-track-player/pull/2094