{"id":840,"date":"2025-09-13T23:02:48","date_gmt":"2025-09-13T23:02:48","guid":{"rendered":"https:\/\/www.youtubehack.jp\/?p=840"},"modified":"2025-09-13T23:12:45","modified_gmt":"2025-09-13T23:12:45","slug":"%e3%83%af%e3%82%a4%e3%83%97%e3%82%b3%e3%83%b3%e3%83%88%e3%83%ad%e3%83%bc%e3%83%ab-2","status":"publish","type":"post","link":"https:\/\/www.youtubehack.jp\/?p=840","title":{"rendered":"\u30ef\u30a4\u30d7\u30b3\u30f3\u30c8\u30ed\u30fc\u30eb002"},"content":{"rendered":"\n<!-- \u25bc A\u30a8\u30ea\u30a2\uff1a\u30e1\u30a4\u30f3\u52d5\u753b -->\n<div id=\"main-container\" style=\"position:relative; width:640px; height:360px; background:#000;\">\n  <div id=\"main-player\"><\/div>\n\n  <!-- \u25bc \u30ef\u30a4\u30d7\u7528\u30b3\u30f3\u30c6\u30ca -->\n  <div id=\"wipe-container\" style=\"\n      position:absolute;\n      bottom:10px; right:10px;\n      width:200px; height:112px;\n      background:#000;\n      border:2px solid #fff;\n      border-radius:8px;\n      overflow:hidden;\n      display:none;  \/* \u521d\u671f\u306f\u975e\u8868\u793a *\/\n  \">\n    <div id=\"wipe-player\"><\/div>\n\n    <!-- \u25bc \u30af\u30ea\u30c3\u30af\u7121\u52b9\u5316\u7528\u306e\u900f\u660e\u30ab\u30d0\u30fc -->\n    <div id=\"wipe-cover\" style=\"\n        position:absolute;\n        top:0; left:0;\n        width:100%; height:100%;\n        background:transparent;\n        z-index:2;\">\n    <\/div>\n  <\/div>\n<\/div>\n\n<script>\nvar mainPlayer, wipePlayer;\nvar currentWipe = null;\n\n\/\/ \u25bc \u30ef\u30a4\u30d7\u30ea\u30b9\u30c8\nconst WIPES = [\n  { id: 'M7lc1UVf-VE', start: 5,  end: 15 },\n  { id: 'Yxep-gS-Btg', start: 20, end: 30 },\n  { id: 'bL5hJEauvu4', start: 35, end: 45 }\n];\n\n\/\/ \u25bc YouTube IFrame API \u8aad\u307f\u8fbc\u307f\nvar tag = document.createElement('script');\ntag.src = \"https:\/\/www.youtube.com\/iframe_api\";\ndocument.getElementsByTagName('script')[0].parentNode.insertBefore(tag, null);\n\n\/\/ \u25bc API\u6e96\u5099\u5b8c\u4e86\nfunction onYouTubeIframeAPIReady() {\n  \/\/ \u30e1\u30a4\u30f3\u30d7\u30ec\u30a4\u30e4\u30fc\n  mainPlayer = new YT.Player('main-player', {\n    height: '360',\n    width: '640',\n    videoId: 'ZnCvp0QkIlc',\n    playerVars: { 'playsinline': 1 },\n    events: { 'onStateChange': onMainStateChange }\n  });\n\n  \/\/ \u30ef\u30a4\u30d7\u30d7\u30ec\u30a4\u30e4\u30fc\n  wipePlayer = new YT.Player('wipe-player', {\n    height: '112',\n    width: '200',\n    playerVars: { 'playsinline': 1 }\n  });\n}\n\n\/\/ \u25bc \u30e1\u30a4\u30f3\u52d5\u753b\u306e\u72b6\u614b\u5909\u5316\nfunction onMainStateChange(event) {\n  if (event.data === YT.PlayerState.PLAYING) {\n    monitorMain();\n  } else if (event.data === YT.PlayerState.PAUSED) {\n    if (wipePlayer && wipePlayer.pauseVideo) wipePlayer.pauseVideo();\n  } else if (event.data === YT.PlayerState.ENDED) {\n    if (wipePlayer && wipePlayer.stopVideo) wipePlayer.stopVideo();\n    document.getElementById('wipe-container').style.display = 'none';\n  }\n}\n\n\/\/ \u25bc \u30e1\u30a4\u30f3\u52d5\u753b\u306e\u6642\u9593\u76e3\u8996\nfunction monitorMain() {\n  var check = setInterval(function() {\n    if (!mainPlayer || mainPlayer.getPlayerState() !== YT.PlayerState.PLAYING) {\n      clearInterval(check);\n      return;\n    }\n\n    var t = mainPlayer.getCurrentTime();\n\n    var match = WIPES.find(w => t >= w.start && t < w.end);\n\n    if (match) {\n      if (!currentWipe || currentWipe.id !== match.id) {\n        currentWipe = match;\n        document.getElementById('wipe-container').style.display = 'block';\n        wipePlayer.loadVideoById({\n          videoId: match.id,\n          startSeconds: match.start\n        });\n      }\n    } else {\n      if (currentWipe) {\n        wipePlayer.stopVideo();\n        document.getElementById('wipe-container').style.display = 'none';\n        currentWipe = null;\n      }\n    }\n  }, 500);\n}\n<\/script>\n\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-840","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/www.youtubehack.jp\/index.php?rest_route=\/wp\/v2\/posts\/840","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.youtubehack.jp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.youtubehack.jp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.youtubehack.jp\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.youtubehack.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=840"}],"version-history":[{"count":5,"href":"https:\/\/www.youtubehack.jp\/index.php?rest_route=\/wp\/v2\/posts\/840\/revisions"}],"predecessor-version":[{"id":845,"href":"https:\/\/www.youtubehack.jp\/index.php?rest_route=\/wp\/v2\/posts\/840\/revisions\/845"}],"wp:attachment":[{"href":"https:\/\/www.youtubehack.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=840"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.youtubehack.jp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=840"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.youtubehack.jp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=840"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}