Add YT/local audio toggle in pause menu for comparison
For songs with YouTube config, a YT: ON/OFF button appears in the pause menu next to KB. Toggling it recreates the audio player so you can compare YouTube vs local audio during the same session. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>main
parent
494e0d08ed
commit
b7f13f5593
|
|
@ -165,6 +165,10 @@
|
|||
left: 72px;
|
||||
}
|
||||
|
||||
.cornerBtnLeft3 {
|
||||
left: 140px;
|
||||
}
|
||||
|
||||
.cornerBtnRight {
|
||||
right: 16px;
|
||||
font-size: 18px;
|
||||
|
|
|
|||
|
|
@ -70,6 +70,7 @@ export function GamePage() {
|
|||
const [audioPlayer, setAudioPlayer] = useState<AudioPlayer | null>(null)
|
||||
const ytHostRef = useRef<HTMLDivElement>(null)
|
||||
const [keyboardMode, setKeyboardMode] = useState(false)
|
||||
const [useYoutube, setUseYoutube] = useState(!!resolvedSong.youtubeVideoId)
|
||||
|
||||
// Load chart
|
||||
useEffect(() => {
|
||||
|
|
@ -93,7 +94,7 @@ export function GamePage() {
|
|||
let destroyed = false
|
||||
let player: AudioPlayer | null = null
|
||||
|
||||
if (resolvedSong.youtubeVideoId && ytHostRef.current) {
|
||||
if (useYoutube && resolvedSong.youtubeVideoId && ytHostRef.current) {
|
||||
gameLog(`creating YouTube audio player: ${resolvedSong.youtubeVideoId} offset=${resolvedSong.youtubeOffset}`)
|
||||
createYouTubeAudioPlayer({
|
||||
videoId: resolvedSong.youtubeVideoId,
|
||||
|
|
@ -116,7 +117,7 @@ export function GamePage() {
|
|||
player?.destroy()
|
||||
setAudioPlayer(null)
|
||||
}
|
||||
}, [resolvedSong.id])
|
||||
}, [resolvedSong.id, useYoutube])
|
||||
|
||||
// Pose detection (disabled in keyboard mode)
|
||||
const { loading, error, calibrationStatus, framingHint, gesture } = usePoseLoop(
|
||||
|
|
@ -348,6 +349,17 @@ export function GamePage() {
|
|||
>
|
||||
{keyboardMode ? 'KB: ON' : 'KB: OFF'}
|
||||
</button>
|
||||
{resolvedSong.youtubeVideoId && (
|
||||
<button
|
||||
className={`${styles.cornerBtn} ${styles.cornerBtnLeft3}`}
|
||||
onClick={() => {
|
||||
playSound(SFX_BUTTON_DEFAULT)
|
||||
setUseYoutube((v) => !v)
|
||||
}}
|
||||
>
|
||||
{useYoutube ? 'YT: ON' : 'YT: OFF'}
|
||||
</button>
|
||||
)}
|
||||
{canFullscreen && !isFullscreen && (
|
||||
<button
|
||||
className={`${styles.cornerBtn} ${styles.cornerBtnRight}`}
|
||||
|
|
|
|||
Loading…
Reference in New Issue