Stoat Chat FPS Unlocker

Снимает лимит 15 FPS в Stoat Chat (LiveKit)

K instalaci tototo skriptu si budete muset nainstalovat rozšíření jako Tampermonkey, Greasemonkey nebo Violentmonkey.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Violentmonkey.

K instalaci tohoto skriptu si budete muset nainstalovat rozšíření jako Tampermonkey nebo Userscripts.

You will need to install an extension such as Tampermonkey to install this script.

K instalaci tohoto skriptu si budete muset nainstalovat manažer uživatelských skriptů.

(Už mám manažer uživatelských skriptů, nechte mě ho nainstalovat!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(Už mám manažer uživatelských stylů, nechte mě ho nainstalovat!)

// ==UserScript==
// @name         Stoat Chat FPS Unlocker
// @namespace    http://tampermonkey.net/
// @license MIT
// @version      1.0
// @description  Снимает лимит 15 FPS в Stoat Chat (LiveKit)
// @match        *://*.stoat.chat/*
// @match        *://stoat.inkazap.space/*
// @match        *://localhost/*
// @grant        none
// @run-at       document-start
// ==/UserScript==

(function() {
    'use strict';

    // 1. Перехват WebRTC параметров
    const originalSetParameters = RTCRtpSender.prototype.setParameters;
    RTCRtpSender.prototype.setParameters = function(parameters) {
        if (parameters && parameters.encodings) {
            parameters.encodings.forEach(function(enc) {
                if (enc.maxFramerate) enc.maxFramerate = 60;
                if (enc.maxBitrate) {
                    if (enc.rid === 'q') enc.maxBitrate = 1500000;
                    else if (enc.rid === 'h') enc.maxBitrate = 6000000;
                    else enc.maxBitrate = Math.max(enc.maxBitrate, 6000000);
                }
            });
        }
        return originalSetParameters.apply(this, arguments);
    };

    // 2. Принудительный contentHint = 'motion' для демонстрации экрана
    setInterval(() => {
        document.querySelectorAll('video').forEach(video => {
            if (video.srcObject) {
                video.srcObject.getVideoTracks().forEach(track => {
                    if (track.kind === 'video' && track.contentHint !== 'motion') {
                        track.contentHint = 'motion';
                    }
                });
            }
        });
    }, 2000);

    console.log('[Stoat FPS Unlocker] Активен: 60 FPS / 6 Mbps / motion');
})();