cmatsuoka / xmp-android

20 stars 7 forks source link

Android Auto support #9

Open HunterZ opened 4 years ago

HunterZ commented 4 years ago

I just started using Xmp again, and it would be really convenient if it were to have minimal Android Auto support, so that I could control playback from my car's screen instead of having to reach for my phone.

LossyDragon commented 4 years ago

Hi HunterZ,

Last year I did dabble on some form of integration with Android Audio on my fork/rewrite of XMP player. Though I did come up sort on actually utilizing any functionality on it because I didn't have a physical headunit to test on. (That and the Emulator is garbage).

Does Xmp actually play through Android Audio, though wired or wireless?

HunterZ commented 4 years ago

If I unlock my phone and run Xmp via the phone's screen, it does play on my car's audio system via the USB connection. My guess is that Android Auto simply routes to the car all audio produced by applications running on the phone. This is good, because it means I don't have to do any additional setup to get Xmp working with my car - it's just not very convenient to have to reach for my phone while driving if I want to start/stop it or whatever.

Also, Android Auto now has the ability to run on a phone without being connected to a car. The main Android Auto UI itself looks nothing like how it appears on a car, but I think apps launched from it do look the same? This may be an easier route for testing.

Anyway, no pressure - just wanted to let you know that there is user interest. Thanks for at least thinking about it!

On Wed, Feb 19, 2020 at 9:44 AM Lossy notifications@github.com wrote:

Hi HunterZ,

Last year I did dabble on some form of integration with Android Audio on my fork/rewrite of XMP player. Though I did come up sort on actually utilizing any functionality on it because I didn't have a physical headunit to test on. (That and the Emulator is garbage).

Does Xmp actually play through Android Audio, though wired or wireless?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cmatsuoka/xmp-android/issues/9?email_source=notifications&email_token=AAA2TC5WTR7JEWXRKJBPWXLRDVVWPA5CNFSM4KXS4RKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMIYHGY#issuecomment-588350363, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2TCYFPAFL75YUCZ4BGHTRDVVWPANCNFSM4KXS4RKA .

LossyDragon commented 4 years ago

Thanks!

I'll take another look at it later on.

The documentation is a bit weak for Android Auto. How I was interpreting it is that it sends the audio to the head unit for it to be processed and played.

If I can at least get the player controls to work for it. I'll see if I can backport the changes to Java and send a PR here for it. Hopefully that will be enough for google to approve it as Android Auto compatible if Claudio approves it

The downside is for XMP-android is that its minimum support will be raised to Lollipop, instead of Ice Cream Sandwich as it currently sits now.

HunterZ commented 4 years ago

Yes, when the phone is running Android Auto on the car's screen over USB, all phone audio outputs seems to get routed to the car's audio system automatically - even for non-AA apps. This means that it might be enough to implement an Android Auto UI for Xmp that drives the existing audio back-end.

If it helps, I can sideload test versions and maybe post youtube videos (or at least text descriptions) of testing results.

On Wed, Feb 19, 2020 at 3:36 PM Lossy notifications@github.com wrote:

Thanks!

I'll take another look at it later on.

The documentation is a bit weak for Android Auto. How I was interpreting it is that it sends the audio to the head unit for it to be processed and played.

If I can at least get the player controls to work for it. I'll see if I can backport the changes to Java and send a PR here for it. Hopefully that will be enough for google to approve it as Android Auto compatible if Claudio approves it

The downside is for XMP is that its minimum support will be raised to Lollipop, instead of Ice Cream Sandwich as it currently sits now.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cmatsuoka/xmp-android/issues/9?email_source=notifications&email_token=AAA2TCY6LCVWNDDXTUFQYSLRDW67VA5CNFSM4KXS4RKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMKEGCA#issuecomment-588530440, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2TCZ6FAK4BCOFBFEF6L3RDW67VANCNFSM4KXS4RKA .

LossyDragon commented 4 years ago

😄 Okay, I got something to interface with it. But the hard part is to actually get the player to produce sound, since its a custom audio player.

So far my next go is to implement a "dummy" music player, just to get some transport controls going, but have XMP actually stream the music. But i'll see if I can not make it so hacky and not have a dummy player implemented.

MediaBrowserServiceCompat assumes playable music is a standard format, with metadata items

I am also not touching the original service, so there will be no co-op between Android Audio and the standard Application itself. Just to preserve functionality as this is a different beast than 99% of all music apps.

LossyDragon commented 4 years ago

Update: Its playing tunes now and behaving nicely so far.

HunterZ commented 4 years ago

Exciting!

Used the official xmp-android some more and ran into some weird issues with audio - lesser granularity of volume control at times, channels quiet/muted at times, unable to recover from being quieted/muted when Google Maps butts in.

On Sat, Feb 22, 2020 at 11:33 PM Lossy notifications@github.com wrote:

Update: Its playing tunes now and behaving nicely so far.

https://camo.githubusercontent.com/48b2270ac36cda0514f8061bf305193b16e4d583/68747470733a2f2f692e696d6775722e636f6d2f726275316236572e706e67

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cmatsuoka/xmp-android/issues/9?email_source=notifications&email_token=AAA2TC2O43IT6LJI2R6EJ2TREIRDVA5CNFSM4KXS4RKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEMVTXWY#issuecomment-590035931, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2TC2URYP2BEWFVDRZ2FTREIRDVANCNFSM4KXS4RKA .

LossyDragon commented 4 years ago

That is just good old android reinventing the wheel on older api functions. 😄

Individual channels shouldn't go quiet, only everything that's playing globally.

If you're device is running Oreo plus, there is a new Audio Focus class that needs to be initialized for that quirk to go away.

Which I've already fixed on my fork: https://github.com/LossyDragon/xmp-android/blob/Kotlin/app/src/main/java/org/helllabs/android/xmp/service/utils/OreoAudioFocusHandler.kt

And with that, XMP should not duck it's own volume, the system should do that from what I discovered 🙄

HunterZ commented 4 years ago

I'm on 5.1 Lollipop - it's an old phone.

On Tue, Feb 25, 2020 at 9:23 AM Lossy notifications@github.com wrote:

That is just good old android reinventing the wheel on older api functions. 😄

Individual channels shouldn't go quiet, only everything that's playing globally.

If you're device is running Oreo plus, there is a new Audio Focus class that needs to be initialized for that quirk to go away.

Which I've already fixed on my fork: https://github.com/LossyDragon/xmp-android/blob/Kotlin/app/src/main/java/org/helllabs/android/xmp/service/utils/OreoAudioFocusHandler.kt

And with that, XMP should not duck it's own volume, the system should do that from what I discovered 🙄

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/cmatsuoka/xmp-android/issues/9?email_source=notifications&email_token=AAA2TC7JQZYDRKU3LIUBTNLREVHXZA5CNFSM4KXS4RKKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEM4XBPQ#issuecomment-590966974, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAA2TCZ5PJGUJGOWRPOUUZDREVHXZANCNFSM4KXS4RKA .