dongsik22 commited on
Commit
783fd79
·
1 Parent(s): 7cc88b3

fix(player): 다음화 카운트다운 취소/지금시청 모바일 무반응 보강

Browse files

증상: 모바일에서 엔딩 자동 다음화 카운트다운의 [취소] 버튼이 아예 안 먹음.
풀스크린·일반 모드 둘 다 동일.

원인 후보: wrap의 passive:false + capture touchstart 핸들러가 자식 ncCancel
탭의 click 합성을 일부 모바일 브라우저에서 지연·소실시키는 케이스. 7cc88b3로
closest('#nextCountdown') 차단을 넣었지만 capture 단계 진입 자체로 발생하는
사고는 못 잡음.

조치:
- ncCancel/ncGo에 pointerup 핸들러 추가. click 합성 의존 제거(터치/마우스/펜
통합 입력으로 즉시 처리). 같은 탭에서 click이 또 발화해도 카운트다운이 이미
닫혀서 두 번째 호출은 no-op.
- #nextCountdown 전체 영역의 touchstart/touchend/pointerdown/pointerup/click을
capture 단계에서 stopPropagation. wrap의 더블탭(±5초)·hold(2배속) 핸들러로
새어나가는 경로 이중 차단.
- 기존 click 핸들러 보존 — 데스크탑·키보드(Enter 합성) 호환.

Files changed (1) hide show
  1. index.html +24 -3
index.html CHANGED
@@ -3993,8 +3993,13 @@ function setupMediaIndicators() {
3993
  // ─── C5: 카운트다운 버튼 + G-6: 키보드 단축키 ───
3994
  let _ncPaused = false;
3995
  function setupNextCountdownButtons() {
3996
- document.getElementById('ncCancel')?.addEventListener('click', cancelNextCountdown);
3997
- document.getElementById('ncGo')?.addEventListener('click', () => {
 
 
 
 
 
3998
  const titleEl = document.getElementById('ncTitle');
3999
  if (!titleEl) return;
4000
  const label = titleEl.textContent;
@@ -4006,7 +4011,23 @@ function setupNextCountdownButtons() {
4006
  $('#player').play().catch(() => {});
4007
  });
4008
  }
4009
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4010
  // G-6: Enter=지금시청, Esc=취소, Space=일시정지 (카운트다운 표시 중일 때만)
4011
  document.addEventListener('keydown', (e) => {
4012
  const el = document.getElementById('nextCountdown');
 
3993
  // ─── C5: 카운트다운 버튼 + G-6: 키보드 단축키 ───
3994
  let _ncPaused = false;
3995
  function setupNextCountdownButtons() {
3996
+ // 모바일에서 wrap capture 단계 핸들러나 click 합성 지연으로 취소/지금시청이 안 먹는 사고가
3997
+ // 반복돼서, pointerup으로 직접 받고 wrap 쪽 핸들러로 새어나가지 않게 stopPropagation까지 박는다.
3998
+ // click도 살려두어 데스크탑·키보드(Enter 합성) 호환.
3999
+ const ncBox = document.getElementById('nextCountdown');
4000
+ const doCancel = (e) => { e?.stopPropagation?.(); e?.preventDefault?.(); cancelNextCountdown(); };
4001
+ const doGo = (e) => {
4002
+ e?.stopPropagation?.(); e?.preventDefault?.();
4003
  const titleEl = document.getElementById('ncTitle');
4004
  if (!titleEl) return;
4005
  const label = titleEl.textContent;
 
4011
  $('#player').play().catch(() => {});
4012
  });
4013
  }
4014
+ };
4015
+ // pointerup이 click보다 먼저 발화 + 모든 입력타입(터치/마우스/펜) 통합.
4016
+ // 같은 탭에서 click이 또 발화해도 카운트다운이 이미 닫혀서 두 번째 호출은 no-op.
4017
+ const ncCancelBtn = document.getElementById('ncCancel');
4018
+ const ncGoBtn = document.getElementById('ncGo');
4019
+ ncCancelBtn?.addEventListener('pointerup', doCancel);
4020
+ ncCancelBtn?.addEventListener('click', doCancel);
4021
+ ncGoBtn?.addEventListener('pointerup', doGo);
4022
+ ncGoBtn?.addEventListener('click', doGo);
4023
+ // 박스 전체의 touch/pointer 이벤트가 wrap의 더블탭·hold 핸들러로 새어나가지 않게 차단.
4024
+ // closest 가드(2518/2565행)에 더해 이중 안전망 — capture 단계에서 wrap이 이미 보고 넘어가도
4025
+ // 이후 단계에서 다른 핸들러가 더블탭으로 오인하지 않도록.
4026
+ if (ncBox) {
4027
+ for (const t of ['touchstart','touchend','pointerdown','pointerup','click']) {
4028
+ ncBox.addEventListener(t, (e) => e.stopPropagation(), true);
4029
+ }
4030
+ }
4031
  // G-6: Enter=지금시청, Esc=취소, Space=일시정지 (카운트다운 표시 중일 때만)
4032
  document.addEventListener('keydown', (e) => {
4033
  const el = document.getElementById('nextCountdown');