Allow candidates to toggle avatar visibility

Merged
LA
1mo ago
+330-38

Candidates can now hide and restore the interviewer avatar without refreshing the interview. Manual Hide preserves Jim’s audio track, so Show avatar rebuilds the model and restores lip sync, while automatic performance retirement remains permanent.

The toggle remains keyboard-accessible: manual Hide keeps focus on the Show avatar button and announces the updated state through the status region. The latest expression and speaking state are also preserved when the avatar is rebuilt.

Final teardown clears the manual-hide state and hides the control, preventing report, report-recovery, or leave paths from loading an avatar behind an overlay. Browser tests cover manual toggling, focus retention, loading cancellation, state restoration, and final cleanup.

https://github.com/user-attachments/assets/8c662d27-dd3c-4028-b118-7c7476103fe5

Closes #291


Summary by cubic

Allows candidates to show the interviewer avatar again after hiding it, including a hide that aborted the initial model load. Hide releases the renderer and flips the control to Show avatar, which reloads the model and reattaches Jim's audio analyser, so lip sync returns; automatic retirement for late audio or render pressure stays permanent, and a final stop removes the Show action so report and leave paths can't reload the avatar behind an overlay.

  • Preserves Jim's audio track across the manual toggle, plus his latest speaking and expression state, so a rebuilt avatar holds the correct pose and mouth.
  • Leaves keyboard focus on the button, announces the turn-off through the status region, and documents the Show variant in the avatar contract and browser tests.
  • Show waits for a parse that a Hide could not stop to settle, so toggling never runs two model loads or WebGL contexts at once.

Closes #291