async def _run_timer(self):
        """Run the timer and end the game when time is up."""
        try:
            # Wait for the game duration
            await asyncio.sleep(self._game_duration)

            # Game time is up, get the final score
            final_score = self._game_state_tracker.current_score

            # Create end game message
            end_message = f"Time's up! Thank you for playing Word Wrangler. Your final score is {final_score} point"
            if final_score != 1:
                end_message += "s"
            end_message += ". Great job!"

            # Send end game message as TTSSpeakFrame
            logger.info(f"Game over! Final score: {final_score}")
            await self._task.queue_frames([TTSSpeakFrame(text=end_message)])

            # End the game
            await self._task.queue_frames([EndFrame()])

        except asyncio.CancelledError:
            logger.debug("Game timer task cancelled")
        except Exception as e:
            logger.exception(f"Error in game timer: {e}")
Run the timer and end the game when time is up.
examples/word-wrangler-gemini-live/server/bot_phone_local.py