bilibili BufferTime Change

BufferTime Set 250s

目前為 2024-01-01 提交的版本,檢視 最新版本

您需要先安裝使用者腳本管理器擴展,如 TampermonkeyGreasemonkeyViolentmonkey 之後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyViolentmonkey 後才能安裝該腳本。

您需要先安裝使用者腳本管理器擴充功能,如 TampermonkeyUserscripts 後才能安裝該腳本。

你需要先安裝一款使用者腳本管理器擴展,比如 Tampermonkey,才能安裝此腳本

您需要先安裝使用者腳本管理器擴充功能後才能安裝該腳本。

(我已經安裝了使用者腳本管理器,讓我安裝!)

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展,比如 Stylus,才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

你需要先安裝一款使用者樣式管理器擴展後才能安裝此樣式

(我已經安裝了使用者樣式管理器,讓我安裝!)

// ==UserScript==
// @name           bilibili BufferTime Change
// @version        1.0.0
// @description    BufferTime Set 250s
// @author         Vanisoul
// @match          https://www.bilibili.com/*
// @license        MIT
// @namespace      https://greasyfork.org/users/429936
// @grant          GM_registerMenuCommand
// @grant          GM_setValue
// @grant          GM_getValue
// @grant          unsafeWindow
// ==/UserScript==

!function(){"use strict";const e=new class{};const t=setInterval((()=>{const r=unsafeWindow.DashPlayer;r&&function(t){const r=t.prototype.fire;r&&(t.prototype.fire=function(...o){e.dashPlayer=this,t.prototype.fire=r,r.apply(this,o)})}(r),e.dashPlayer&&clearInterval(t)}),1e3);let r=GM_getValue("triggerKey","v");let o=GM_getValue("bufferTime",250);function a(t){const r=setInterval((()=>{const o=e.dashPlayer;o&&(o.player.setBufferPruningInterval(3),o.player.setStableBufferTime(t),o.player.setBufferTimeAtTopQuality(t),o.player.setBufferTimeAtTopQualityLongForm(t),o.player.setBufferAheadToKeep(t+10),o.player.setBufferToKeep(3e4),console.log(`hook set buffer time ${t}`),clearInterval(r))}),1e3)}GM_registerMenuCommand("設置Buffer時間",(function(){var e=prompt("請輸入新的Buffer時間:",o.toString());e&&(GM_setValue("bufferTime",e),o=parseInt(e),a(o),alert("Buffer時間已更改為: "+o))})),GM_registerMenuCommand("設置查看目前 Buffer 按鈕",(function(){var e=prompt("請輸入新的觸發按鈕:",r);e&&(GM_setValue("triggerKey",e.toLocaleLowerCase()),r=e.toLocaleLowerCase(),alert("觸發按鈕已更改為: "+r))})),document.addEventListener("keydown",(function(t){if(t.key.toLocaleLowerCase()===r){const t=e.dashPlayer;console.log(`Now BufferLength : ${null==t?void 0:t.getBufferLength("video")}`)}})),a(o)}();