ce?.disconnect();
        mediaStream?.getTracks().forEach((track) => track.stop());
        isRecording = false;
        document.getElementById("record").textContent = "Start Realtime";
      }

      async function recordStart() {
        await recordAudio();
        isRecording = true;
        document.getElementById("record").textContent = "Stop Realtime";
      }

      // Recording audio logic reference:
      // https://github.com/google-gemini/multimodal-live-api-web-console/blob/main/src/lib/audio