Skip to content

WIP: Microphone in car - plan B - #115

Draft
dragan-n-dream wants to merge 13 commits into
masterfrom
drg/in-car-mic-b
Draft

dragan-n-dream wants to merge 13 commits into
masterfrom
drg/in-car-mic-b

Conversation

@dragan-n-dream

Copy link
Copy Markdown
Contributor

No description provided.

…Media

getUserMedia now runs a request/response exchange before handing a stream
to the game, so car head units can keep games on the phone's built-in
microphone:

- First request of a game: open stream #1, enumerate, send
  requestPreferredAudioInputDevice({devices, activeDeviceId}), then keep
  stream #1, reopen it if it ended, or stop it and open stream #2 with the
  non-exact deviceId.
- Later requests (after an accepted reply): no open on the hand-off, a
  list-less request, then a single open.
- setAudioInputDevices after every successful resolve;
  userMediaRequestFailed({reason, error}) where the base sends nothing.
- The hand-off and the reply are each accepted once per request.
- One permission timeout, 60 s of unpaused time, stopped while the screen
  is paused; a missing screen `paused` reads as not paused. On expiry it
  stops held streams and notifies the platform before rejecting.

#skip-tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KB3fBY6FZ4i3utrTgAvy3a
…nounces it

The exchange is for car head units. Without preferredAudioInputDeviceSupported in
ready, getUserMedia opens on the hand-off with the 45 s timeout, as at fe5da45, and
sends none of the new events. The base specs run unchanged without the flag.

#skip-tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KB3fBY6FZ4i3utrTgAvy3a
On a first request the API holds stream #1 while it waits for the preferred
device. destroy() rejected without stopping it, so the microphone, possibly the
car's, stayed on, and sent nothing, so the platform's prompts stayed open. With
the exchange, destroy() now stops held streams, sends userMediaRequestFailed and
then rejects. Without the flag it is unchanged.

#skip-tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KB3fBY6FZ4i3utrTgAvy3a
The event is a notification from the API to the platform, never answered; the old
name read like a setter. No behaviour change.

#skip-tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KB3fBY6FZ4i3utrTgAvy3a
On web a NotAllowedError is a permission denial and takes the base's denial path
for a fresh open, stream #2 and a later request's open alike. In the app the
native app has just granted the permission, so any failed open reaches the game
as userMediaRequestFailed(open-error) instead of the store's web overlay.

#skip-tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KB3fBY6FZ4i3utrTgAvy3a
The platform no longer echoes userMediaPermissionGranted down, so the
guard only keeps a duplicate hand-off from opening a second stream.

#skip-tests

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KB3fBY6FZ4i3utrTgAvy3a
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KB3fBY6FZ4i3utrTgAvy3a

# Conflicts:
#	CHANGELOG.md
The 1.12.0 beta (renamed from 1.11.1 on master) runs the shared
spec-usermedia-permissions.js, which tests the exchange added to
1.11.0. Apply the same changes to beta/airconsole-1.12.0.js so both
versions behave alike and every API suite passes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KB3fBY6FZ4i3utrTgAvy3a
The beta kept me.version = "1.11.0", so the platform saw it as 1.11.0.
Its test page reuses the 1.11.0 suite, whose setup test pinned that
version; the page now tells the shared suite which version to expect.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KB3fBY6FZ4i3utrTgAvy3a
This reverts commit 9d0179a. The 1.12.0 beta's version string stays as
master has it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KB3fBY6FZ4i3utrTgAvy3a
The flag switches on the audio input exchange flow; the platform decides
when (a car screen), so the API needs no notion of cars.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KB3fBY6FZ4i3utrTgAvy3a
Comments and CHANGELOG only: describe what each helper actually does
(destroy() also ends a request, the reply guard, the first/later flow
choice, the non-exact device) and drop stale timeout wording.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KB3fBY6FZ4i3utrTgAvy3a

This branch has not been deployed

No deployments
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.

2 participants