Greasy Fork is available in English.

Hide HDR support from YouTube

Hide HDR support for Firefox 69. v0.1 2019-10-10

  1. // ==UserScript==
  2. // @name Hide HDR support from YouTube
  3. // @author Jefferson "jscher2000" Scher
  4. // @namespace JeffersonScher
  5. // @version 0.1
  6. // @copyright Copyright 2019 Jefferson Scher
  7. // @license BSD-3-Clause
  8. // @description Hide HDR support for Firefox 69. v0.1 2019-10-10
  9. // @match https://www.youtube.com/*
  10. // @match https://www.youtube-nocookie.com/*
  11. // @match https://www.youtu.be/*
  12. // @run-at document-start
  13. // @grant none
  14. // ==/UserScript==
  15.  
  16. var mse = window.MediaSource;
  17.  
  18. if (mse){
  19. // Set up replacement for MediaSource type support function
  20. var nativeITS = mse.isTypeSupported.bind(mse);
  21. mse.isTypeSupported = ourITS(nativeITS);
  22. }
  23.  
  24. // Here's the replacement
  25. function ourITS(fallback){
  26. // type is a string (hopefully!) sent by the page
  27. return function (type) {
  28. if (type === undefined) return '';
  29. //console.log('testing for: '+ type);
  30.  
  31. // Don't support HDR (current as of 10/10/2019)
  32. if (type.toLowerCase().indexOf('eotf=bt709') > -1 ||
  33. type.toLowerCase().indexOf('eotf=catavision') > -1) return '';
  34.  
  35. // Uncomment to block all VP9 (if performance is bad)
  36. //if (type.toLowerCase().indexOf('vp9') > -1) return '';
  37.  
  38. // Let Firefox handle everything else
  39. return fallback(type);
  40. };
  41. }