[TIL] 211231

Lee Syong·2021년 12ė›” 31ėž
0

TIL

ëŠĐ록 ëģīęļ°
135/204
post-thumbnail

📝 ė˜Ī늘 한 ęēƒ

  1. ëģĩėŠĩ - VIDEO PLAYER (ė™„ė„ą)

📚 ë°°ėšī ęēƒ (ëģĩėŠĩ)

video player ė™„ė„ą
ė‹Īė œ ė―”드는 githubė— ė˜ŽëĶž(wetube_v2)

8. VIDEO PLAYER

  • [TIL] 211211
    • Mouse Events - mousemove / mouseleave
    • watch.pug ėˆ˜ė • (ėķ”ę°€)
    • ėžėž˜í•œ ëē„ę·ļ ėˆ˜ė • (ėķ”ę°€)
      • ėŒė†Œęą° ëē„튞 íīëĶ­ ė‹œ ëģžëĨĻ 바ė— ė§„í–‰ ėƒíƒœę°€ ėƒ‰ęđ”ëĄœ 표ė‹œë˜ė§€ ė•ŠėŒ
      • 타ėž„띞ėļė˜ 폎ėļ터가 끝ęđŒė§€ 가ė§€ ė•ŠėŒ

ðŸ’Ą Mouse Events - mousemove / mouseleave

// videoPlayer.js
let videoPlayerTimeout = null;
let videoPlayerMovementTimeout = null;

const hideVideoPlayer = () => videoPlayer.classList.remove("showing");

const handleMouseMove = () => {
  if (videoPlayerTimeout) {
    clearTimeout(videoPlayerTimeout);
    videoPlayerTimeout = null;
  }
  if (videoPlayerMovementTimeout) {
    clearTimeout(videoPlayerMovementTimeout);
    videoPlayerMovementTimeout = null;
  }
  videoPlayer.classList.add("showing");
  videoPlayerMovementTimeout = setTimeout(hideVideoPlayer, 3000);
};

const handleMouseLeave = () => {
  videoPlayerTimeout = setTimeout(hideVideoPlayer, 3000);
};

video.addEventListener("mousemove", handleMouseMove);
video.addEventListener("mouseleave", handleMouseLeave);

âœĻ ë‚īėž 할 ęēƒ

  1. ëģĩėŠĩ ęģ„ė†í•˜ęļ° - VIEWS API
profile
ëŠĨ동ė ėœžëĄœ ė‚īėž, 행ëģĩ하ęēŒðŸ˜

0개ė˜ 댓ęļ€