Stoat Chat FPS Unlocker

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

Dovrai installare un'estensione come Tampermonkey, Greasemonkey o Violentmonkey per installare questo script.

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

Dovrai installare un'estensione come Tampermonkey o Violentmonkey per installare questo script.

Dovrai installare un'estensione come Tampermonkey o Userscripts per installare questo script.

Dovrai installare un'estensione come ad esempio Tampermonkey per installare questo script.

Dovrai installare un gestore di script utente per installare questo script.

(Ho già un gestore di script utente, lasciamelo installare!)

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione come ad esempio Stylus per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

Dovrai installare un'estensione per la gestione degli stili utente per installare questo stile.

(Ho già un gestore di stile utente, lasciamelo installare!)

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