Skip to content

Conversation

Copy link

Copilot AI commented Nov 30, 2025

Two changes: (1) Play endauto.wav before transition.mp3 at end of autonomous period, (2) Client timers should start synchronized with host but run independently without periodic server updates.

Audio Sequence at End of Autonomous

  • Extended useDisplayAudioService hook to support onEnded callback:
const playAudio = useCallback((key: string, onEnded?: () => void) => {
  // ...
  if (onEnded) {
    audio.onended = () => {
      audio.onended = null;
      onEnded();
    };
  }
  // ...
}, []);
  • Updated TRANSITION state handler to chain audio playback:
case 'TRANSITION':
  playAudio('endauto', () => {
    playAudio('transition');
  });
  break;

Independent Client Timers

  • Both display/page.tsx and score/page.tsx now capture timer_started_at on timer start
  • Local timer calculation uses captured start timestamp instead of polling server values
  • Removed updateTimerDisplay(data) calls from polling loops
  • Timer resets when match state returns to NOT_STARTED

This ensures all clients start at the exact same moment (via server timestamp) but calculate elapsed time locally, eliminating timer drift from network latency.

Original prompt

At the end of the autonomous period, play the "endauto.wav" file before playing the "transition.mp3" audio file. Also the timer on the camera and the scoring mode clients should start at the same time as the host timer, but should run independently and not try and update periodically from the host timer.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI self-assigned this Nov 30, 2025
@vercel
Copy link

vercel bot commented Nov 30, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
ftcscorer Ready Ready Preview Comment Nov 30, 2025 1:53am

Copilot AI changed the title [WIP] Add audio playback sequence for end of autonomous period Play endauto.wav before transition.mp3 and run client timers independently Nov 30, 2025
Copilot AI requested a review from acurra3398 November 30, 2025 01:55
@acurra3398 acurra3398 marked this pull request as ready for review November 30, 2025 01:57
@acurra3398 acurra3398 merged commit ac05c7c into main Nov 30, 2025
8 checks passed
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