Skip to content

[Feature] "Play x" Voice Commands via Assistant/Gemini on Android Auto - #13648

Open
EspoTek wants to merge 1 commit into
TeamNewPipe:devfrom
EspoTek:voice-play-from-search
Open

[Feature] "Play x" Voice Commands via Assistant/Gemini on Android Auto#13648
EspoTek wants to merge 1 commit into
TeamNewPipe:devfrom
EspoTek:voice-play-from-search

Conversation

@EspoTek

@EspoTek EspoTek commented Jun 28, 2026

Copy link
Copy Markdown

What this PR Adds

As the title suggests, you can now say "Play x" on Android Auto and it'll play x on NewPipe - with slight caveats (see below)

WhatsApp.Video.2026-06-29.at.02.02.22.mp4

According to PR #12044, this isn't possible:

voice search from within the app works, but search from the google assistant (e.g., "play on NewPipe") only supports applications from the Google Play Store.

But that didn't stop me because I'm too lazy to read!
image

Testing and Caveats

I tested this on two devices in 3 configurations.

  • My Pixel 5 running regular Google Assistant (not Gemini) and no other media apps such as Spotify "Just Works". You say "Play Chocolate Rain", it plays Chocolate Rain - no questions asked.
  • My Wife's Pixel 7 running Gemini, and also with Spotify installed would play some videos, sometimes. Gemini seems to have a "safety" feature that blocks it from playing a video if you're driving - and what it defines as a "video" seems to be nondeterministic. For example, it will gladly comply if you say "Play Chocolate Rain by Tay Zonday", but not "Play Chocolate Rain". And sometimes it doesn't enforce the safety feature at all and lets you play whatever you want? It's strange.
  • Using my Wife's Pixel 7, but with regular Google Assistant, complies 100% of the time but will very eagerly try to route requests to Spotify. In order to get it to work reliably, I had to open NewPipe manually and play a piece of media. Then, all future requests would be routed to NewPipe until I played something on Spotify again. It doesn't look like there's a way to fix this, we can't define "play on NewPipe" without going through the Google Play Store process (OK, maybe I can read a little bit).

Who actually deserves the credit for this

All code written by Claude Opus 4.8 with some gentle steering on my end.
Unedited Claude PR text below:


NewPipe's onPrepareFromSearch was a no-op (it returned ERROR_CODE_NOT_SUPPORTED), so voice "play <something>" commands in Android Auto did nothing. This implements it.

Changes

  • Implement onPrepareFromSearch — search the selected service and play the top result. An empty query (e.g. a bare "play music") resumes the most recently played stream instead of erroring.
  • Advertise the search actions in getSupportedPrepareActions() (PREPARE/PLAY_FROM_MEDIA_ID + PREPARE/PLAY_FROM_SEARCH), so the connector forwards both playFromSearch and prepareFromSearch.
  • Add PlayMediaFromSearchActivity with a bare MEDIA_PLAY_FROM_SEARCH intent filter. Android Auto only routes a spoken play-from-search to an app that declares such an activity (see UAMP play from search not working on Android Auto (DHU): "Sorry, something went wrong. Try opening the app to continue" android/uamp#479); NewPipe's existing filters are all gated behind YouTube-URL data constraints, so AA never treated it as voice-search-capable. The activity also handles the direct intent (search + play) for automation tools.

Testing

Verified in Android Auto (Desktop Head Unit + a real connection) on Pixel 5 and Pixel 7: saying "play <query>" plays the top result.

Note / scope

This targets Android Auto. The phone Google Assistant/Gemini only routes "play on <app>" to apps in Google's curated media-provider catalog, so it won't trigger this for a non-listed app like NewPipe — that's a Google-side gate, not something the app can change.

Implement MediaBrowserPlaybackPreparer.onPrepareFromSearch (previously a
no-op that returned ERROR_CODE_NOT_SUPPORTED): search the user's selected
service and start background playback of the first matching stream. An empty
query (e.g. a bare "play music" voice command) resumes the most recently
played stream instead of erroring, so voice agents don't treat the app as
non-search-capable.

Advertise the PREPARE/PLAY variants for both media id and search in
getSupportedPrepareActions(), so the MediaSessionConnector delegates
prepareFromSearch as well as playFromSearch.

Add PlayMediaFromSearchActivity with a bare MEDIA_PLAY_FROM_SEARCH intent
filter (no data constraints). Android Auto only routes a spoken
play-from-search to an app's MediaSession when such an activity is declared
(see android/uamp#479); the existing filters on RouterActivity are all gated
behind YouTube-URL data constraints and don't qualify. The activity also
handles the activity-style intent directly (search + play) as a fallback.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@github-actions github-actions Bot added the size/medium PRs with less than 250 changed lines label Jun 28, 2026
@EspoTek EspoTek changed the title Add voice "play from search" support for Android Auto Android Auto Voice Commands Jun 28, 2026
@TobiGr TobiGr added accessibility Issue is related to accessibility Android Auto Issue is related to Android Auto labels Jun 28, 2026
@EspoTek EspoTek changed the title Android Auto Voice Commands [Feature] Android Auto Voice Commands via Assistant and Gemini Jun 28, 2026
@EspoTek EspoTek changed the title [Feature] Android Auto Voice Commands via Assistant and Gemini [Feature] Voice Commands via Assistant/Gemini on Android Auto Jun 28, 2026
@EspoTek EspoTek changed the title [Feature] Voice Commands via Assistant/Gemini on Android Auto [Feature] "Play x" Voice Commands via Assistant/Gemini on Android Auto Jun 28, 2026
@EspoTek
EspoTek marked this pull request as ready for review June 28, 2026 16:07
@EspoTek EspoTek mentioned this pull request Jun 28, 2026
6 tasks
@TobiGr TobiGr added template missing The bug/feature template is missing (e.g. the used app does not support issue templates) feature request Issue is related to a feature in the app labels Jun 28, 2026
@TobiGr TobiGr linked an issue Jun 28, 2026 that may be closed by this pull request
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

accessibility Issue is related to accessibility Android Auto Issue is related to Android Auto feature request Issue is related to a feature in the app size/medium PRs with less than 250 changed lines template missing The bug/feature template is missing (e.g. the used app does not support issue templates)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Android Auto voice inputs

2 participants