diff --git a/lang/en.json b/lang/en.json index 7210a73..724b8ca 100644 --- a/lang/en.json +++ b/lang/en.json @@ -63,5 +63,11 @@ "LIVEKITAVCLIENT.WarningCannotBroadcastUserVideo": "You cannot enable the user's camera because they to not have permission to broadcast their video feed.", "LIVEKITAVCLIENT.WarningCannotBroadcastUserAudio": "You cannot enable the user's microphone because they to not have permission to broadcast their audio feed.", "LIVEKITAVCLIENT.WarningCannotEnableUserVideo": "You cannot enable the user's camera because they have hidden themselves.", - "LIVEKITAVCLIENT.WarningCannotEnableUserAudio": "You cannot enable the user's microphone because they have muted themselves." + "LIVEKITAVCLIENT.WarningCannotEnableUserAudio": "You cannot enable the user's microphone because they have muted themselves.", + "LIVEKITAVCLIENT.limitBitRate": "Limit Bitrate", + "LIVEKITAVCLIENT.limitBitRateHint": "Set a maximum bitrate and framerate values to conserve bandwidth.", + "LIVEKITAVCLIENT.maximumVideoRate": "Maximum bitrate (kbps)", + "LIVEKITAVCLIENT.maximumVideoRateHint": "The maximum bitrate that will be used for both audio and video tracks.", + "LIVEKITAVCLIENT.maximumFrameRate": "Maximum frame rate (kbps)", + "LIVEKITAVCLIENT.maximumFrameRateHint": "The maximum frame rate of the video tracks. Limit this to conserve bandwidth." } diff --git a/lang/es.json b/lang/es.json index 509528a..46383e5 100644 --- a/lang/es.json +++ b/lang/es.json @@ -66,5 +66,11 @@ "LIVEKITAVCLIENT.WarningCannotBroadcastUserVideo": "No puede habilitar la cámara del usuario porque no tiene permisos para enviar vídeo", "LIVEKITAVCLIENT.WarningCannotBroadcastUserAudio": "No puede habilitar el micrófono del usuario porque no tiene permisos para enviar vídeo", "LIVEKITAVCLIENT.WarningCannotEnableUserVideo": "No puede habilitar la cámara porque el usuario la ha desactivado", - "LIVEKITAVCLIENT.WarningCannotEnableUserAudio": "No puede habilitar el micrófono porque el usuario se ha silenciado" + "LIVEKITAVCLIENT.WarningCannotEnableUserAudio": "No puede habilitar el micrófono porque el usuario se ha silenciado", + "LIVEKITAVCLIENT.limitBitRate": "Limitar el Bitrate", + "LIVEKITAVCLIENT.limitBitRateHint": "Limitar el bitrate máximo para reducir el consumo de ancho de banda", + "LIVEKITAVCLIENT.maximumVideoRate": "Bitrate máximo (kbps)", + "LIVEKITAVCLIENT.maximumVideoRateHint": "El bitrate máximo que se usara para la videoconferencia.", + "LIVEKITAVCLIENT.maximumFrameRate": "Fotogramas máximos (kbps)", + "LIVEKITAVCLIENT.maximumFrameRateHint": "El número máximo de fotogramas por minuto. Poner un valor más pequeño para reducir el consumo de ancho de banda" } diff --git a/src/LiveKitClient.ts b/src/LiveKitClient.ts index 38ebd1c..57c9170 100644 --- a/src/LiveKitClient.ts +++ b/src/LiveKitClient.ts @@ -1467,6 +1467,16 @@ export default class LiveKitClient { simulcast: true, videoSimulcastLayers: [VideoPresets43.h120, VideoPresets43.h240], }; + if (getGame().settings.get(MODULE_NAME, "limitBitRate")) { + const maxBitRate = getGame().settings.get(MODULE_NAME, "maximumVideoRate") as number; + const maxFrameRate = getGame().settings.get(MODULE_NAME, "maximumFrameRate") as number; + if (maxBitRate && maxFrameRate) { + trackPublishOptions.videoEncoding = + {maxBitrate: maxBitRate * 1000, maxFramerate: maxFrameRate} + } else { + log.warn("Invalid video encoding settings"); + } + } if (getGame().settings.get(MODULE_NAME, "audioMusicMode")) { const audioMusicModeRate = diff --git a/src/utils/registerModuleSettings.ts b/src/utils/registerModuleSettings.ts index ef35157..f01768f 100644 --- a/src/utils/registerModuleSettings.ts +++ b/src/utils/registerModuleSettings.ts @@ -117,4 +117,32 @@ export default function registerModuleSettings(): void { type: Boolean, onChange: () => delayReload(), }); + + registerModuleSetting({ + name: "limitBitRate", + scope: "world", + config: true, + default: false, + type: Boolean, + onChange: () => delayReload(), + }); + + registerModuleSetting({ + name: "maximumVideoRate", + scope: "world", + config: getGame().settings.get(MODULE_NAME, "limitBitRate") === true, + default: 300, + type: Number, + onChange: () => delayReload(), + }); + + registerModuleSetting({ + name: "maximumFrameRate", + scope: "world", + config: getGame().settings.get(MODULE_NAME, "limitBitRate") === true, + default: 60, + type: Number, + onChange: () => delayReload(), + }); + }