mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-22 03:02:20 +00:00
Keep an active voice session through engine switches
The page creates the voice once; each engine attachment only gives it that scene's action runner, pointer canvas and annotation events. Calls made during a switch wait for the incoming engine and are refused with ENGINE_SWITCHING when none attaches in time; results name the engine that answered, and the session hears engine-changed after a switch. The analyst's follow-up memory and layer enable times outlive one engine's runner. scripts/qa-voice-engine-switch.mjs drives a fake microphone and Realtime transport through the switches.
This commit is contained in:
1 parent
35ed499ae4
commit
05578c61b9
13 files changed
+998
-139
No files matched your search
@@ -276,7 +276,8 @@ export function createPointerTracker({
|
||||
let held = null;
|
||||
let active = null;
|
||||
let destroyed = false;
|
||||
const listeners = new AbortController();
|
||||
// The element's own listeners; replaced with the element (setElement).
|
||||
let listeners = new AbortController();
|
||||
|
||||
function size() {
|
||||
return {
|
||||
@@ -328,12 +329,14 @@ export function createPointerTracker({
|
||||
cancelDwell();
|
||||
}
|
||||
|
||||
if (element?.addEventListener) {
|
||||
function listen() {
|
||||
if (!element?.addEventListener) return;
|
||||
const options = { passive: true, signal: listeners.signal };
|
||||
element.addEventListener('pointermove', onMove, options);
|
||||
element.addEventListener('pointerdown', onMove, options);
|
||||
element.addEventListener('pointerleave', onLeave, options);
|
||||
}
|
||||
listen();
|
||||
|
||||
/** Is the pointer a referent right now? */
|
||||
function isFresh(recentMs = POINTER_FRESH_MS) {
|
||||
@@ -372,7 +375,21 @@ export function createPointerTracker({
|
||||
}
|
||||
|
||||
return {
|
||||
element,
|
||||
get element() {
|
||||
return element;
|
||||
},
|
||||
/**
|
||||
* Follow another element (the next globe's canvas after an engine
|
||||
* switch), or none. The pointer starts outside it.
|
||||
*/
|
||||
setElement(next) {
|
||||
if (destroyed || next === element) return;
|
||||
listeners.abort();
|
||||
listeners = new AbortController();
|
||||
element = next ?? null;
|
||||
onLeave();
|
||||
listen();
|
||||
},
|
||||
capture,
|
||||
isFresh,
|
||||
/** Push-to-talk keydown: snapshot now, keep it for the hold. */
|
||||
|
||||
Reference in new issue
Block a user