简单YouTube环境

让您再感受一点环绕感。 (听歌的时候更好)

  1. // ==UserScript==
  2. // @name Simple Youtube Surround
  3. // @name:ko 유튜브 서라운드
  4. // @name:zh-CN 简单YouTube环境
  5. // @namespace https://github.com/KBluePurple/youtube-delay
  6. // @supportURL https://github.com/KBluePurple/youtube-delay/issues
  7. // @version 0.2
  8. // @description Makes the youtube sound more surrounded ( It's better when you listen to music )
  9. // @description:ko 조금 더 서라운드를 느낄 수 있도록 해줍니다. ( 노래를 들을 때 더 좋음 )
  10. // @description:zh-CN 让您再感受一点环绕感。 (听歌的时候更好)
  11. // @author KBluePurple
  12. // @match https://www.youtube.com/*
  13. // @match https://music.youtube.com/*
  14. // @match https://m.youtube.com/*
  15. // @match https://www.youtube-nocookie.com/*
  16. // @license MIT
  17. // @icon none
  18. // @grant none
  19. // ==/UserScript==
  20.  
  21. (function() {
  22. 'use strict';
  23.  
  24. const context = new AudioContext();
  25. const video = document.querySelector("#movie_player > div.html5-video-container > video");
  26. const source = context.createMediaElementSource(video);
  27.  
  28. const splitter = context.createChannelSplitter(2);
  29. const merger = context.createChannelMerger(2);
  30.  
  31. const leftDelay = context.createDelay();
  32. const rightDelay = context.createDelay();
  33.  
  34. leftDelay.delayTime.value = 0;
  35. rightDelay.delayTime.value = 0.01;
  36.  
  37. source.connect(splitter);
  38.  
  39. splitter.connect(leftDelay, 0);
  40. splitter.connect(rightDelay, 1);
  41.  
  42. leftDelay.connect(merger, 0, 0);
  43. rightDelay.connect(merger, 0, 1);
  44.  
  45. merger.connect(context.destination);
  46.  
  47. })();