Stoat Chat FPS Unlocker

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

You will need to install an extension such as Tampermonkey, Greasemonkey or Violentmonkey to install this script.

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

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

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

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

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

(I already have a user script manager, let me install it!)

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.

(I already have a user style manager, let me install it!)

// ==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');
})();