Last active
August 6, 2023 06:02
-
-
Save NightFeather/3b3860b314f156b4bc64a5ec23ec773f to your computer and use it in GitHub Desktop.
Stub some constant to make the video viewable on Firefox
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Hololive FC Player Firefox Stub | |
// @namespace Violentmonkey Scripts | |
// @match https://hololive-fc.com/video/* | |
// @grant none | |
// @version 1.0 | |
// @author Nightfeather | |
// @description 8/6/2023, 1:42:37 PM | |
// ==/UserScript== | |
/** | |
It looks like the video player it used is checking for PictureInPicture[^1] API, but firefox doesn't provided one atm, | |
makes it shows "This browser is not supported.". | |
But the player itself isn't configured to use this feature, so a fake class stub would work for me. | |
NOTE: THIS IS NOT A MEMBERSHIP BYPASS. | |
1: https://developer.mozilla.org/en-US/docs/Web/API/PictureInPictureWindow | |
*/ | |
(() => { | |
function PictureInPictureWindow() { return this; } | |
function PictureInPictureEvent() { return this; } | |
Object.defineProperty(window, 'PictureInPictureWindow', { | |
value: PictureInPictureWindow, | |
writable: false | |
}); | |
Object.defineProperty(window, 'PictureInPictureEvent', { | |
value: PictureInPictureEvent, | |
writable: false | |
}) | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment