feat: speak collision voice cues via browser Web Speech API
Agent-published LiveKit audio is unreliable for voice: the track is short-lived (publish, speak ~3s, unpublish) and blocked by browser autoplay, so participants heard nothing even though the server published fine. The VOICE_CUE text already arrives over the data channel, so speak it in the browser via speechSynthesis instead — instant and reliable. Prime speechSynthesis from user gestures (Enable sound, Share screen) so later cues are allowed to play. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AaCFWMkYQmTcuPsxaaACft
This commit is contained in:
@@ -20,7 +20,7 @@ import {
|
||||
import type { Room, RemoteTrack, RemoteTrackPublication, RemoteParticipant } from 'livekit-client';
|
||||
import type { Pod, PodActivityEvent, PodActivityKind } from '@podman/shared';
|
||||
import { startBeat, type BeatHandle } from '../lib/beat.js';
|
||||
import { useInterventions } from '../livekit/useInterventions.js';
|
||||
import { useInterventions, primeSpeech } from '../livekit/useInterventions.js';
|
||||
import { usePodActivity } from '../hooks/use-pod-activity.js';
|
||||
import LiveWaveform from '@/components/ruixen/live-waveform';
|
||||
import { Alert, AlertDescription, AlertTitle } from '@/components/ui/alert';
|
||||
@@ -161,6 +161,7 @@ export function PodView({
|
||||
}, [room, me]);
|
||||
|
||||
async function enableSound() {
|
||||
primeSpeech(); // unlock browser voice from this gesture
|
||||
if (!room) return;
|
||||
try {
|
||||
await room.startAudio();
|
||||
@@ -209,6 +210,7 @@ export function PodView({
|
||||
}
|
||||
|
||||
async function toggleScreen() {
|
||||
primeSpeech(); // unlock browser voice from this gesture too
|
||||
if (!room) return;
|
||||
setNote(null);
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user