deviceIds are hashed per frame/origin, so the ids the menu got from the chat page's enumerateDevices() were unknown inside the call iframe: the fork fell back to the default output while the menu showed a tick on the chosen device. Handle io.lotus.audio_output_state (also silencing the fork's "host did not ack" log) and build the menu from the fork's list and effective selection; older forks fall back to the old list. Fixes #310 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_017PCb59uY3UKqDqt7B6hzd5
25 lines
718 B
TypeScript
25 lines
718 B
TypeScript
import { test } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { parseAudioOutputState } from './CallControl';
|
|
|
|
test('parseAudioOutputState: keeps valid options, tolerates garbage (#310)', () => {
|
|
assert.deepEqual(
|
|
parseAudioOutputState({
|
|
deviceId: 'f2',
|
|
available: [{ id: '', label: 'Default' }, { id: 'f2', label: 'Headset' }, { id: 3 }, null],
|
|
}),
|
|
{
|
|
deviceId: 'f2',
|
|
available: [
|
|
{ id: '', label: 'Default' },
|
|
{ id: 'f2', label: 'Headset' },
|
|
],
|
|
},
|
|
);
|
|
assert.deepEqual(parseAudioOutputState({ deviceId: null }), {
|
|
deviceId: undefined,
|
|
available: undefined,
|
|
});
|
|
assert.equal(parseAudioOutputState('x'), undefined);
|
|
});
|