Compare commits

...

10 Commits

Author SHA1 Message Date
1619fb2b26 Bump version to 1.17.1 2023-09-25 20:06:44 +07:00
d72641ba77 Bump version to 1.17.1 2023-09-25 20:06:22 +07:00
7c3f00f277 Update README.md 2023-09-25 20:05:50 +07:00
9bd0ee9097 Fix volume booster feature (#141)
* Trying to fix the audio problem with volume booster

* Add an option to disable volume control feature

* Update translations
2023-09-25 19:55:36 +07:00
a9bb977311 Update TR translation 2023-09-21 07:45:44 +07:00
3e0653fadf Add RU & TR to language list 2023-09-20 07:09:42 +07:00
36f6b04ad9 Add TR translation 2023-09-20 07:08:13 +07:00
60b70e259b Add RU translation 2023-09-20 07:06:12 +07:00
c50e0d6aff Update BR translation 2023-09-20 07:03:40 +07:00
a3fd3c9ebe Update README.md 2023-09-18 09:26:06 +07:00
3 changed files with 266 additions and 59 deletions

View File

@ -23,14 +23,15 @@ If you like this project please give it a 🌟. Thank you 🙏.
- [**Disclaimers**](#disclaimers) - [**Disclaimers**](#disclaimers)
## How to install ## How to install
1. Install [Tampermonkey extension](https://www.tampermonkey.net/) on suppported browsers. 1. Install an userscript extension:
For Safari, use the [Userscripts extension](https://apps.apple.com/us/app/userscripts/id1463298887) (check [this page](https://github.com/redphx/better-xcloud/wiki/Using-with-Safari) before using). - **Safari**: Install [Userscripts extension](https://apps.apple.com/us/app/userscripts/id1463298887). Check [this page](https://github.com/redphx/better-xcloud/wiki/Using-with-Safari) before using.
2. Install **Better xCloud**: - **All other browsers**: Install [Tampermonkey extension](https://www.tampermonkey.net/).
3. Install **Better xCloud**:
- [Stable version](https://github.com/redphx/better-xcloud/releases/latest/download/better-xcloud.user.js) - [Stable version](https://github.com/redphx/better-xcloud/releases/latest/download/better-xcloud.user.js)
<!-- - [Dev version](https://github.com/redphx/better-xcloud/raw/main/better-xcloud.user.js)--> <!-- - [Dev version](https://github.com/redphx/better-xcloud/raw/main/better-xcloud.user.js)-->
I only distribute **Better xCloud** on GitHub, *DO NOT* download it on other websites or from unknown sources. I only distribute **Better xCloud** on GitHub, *DO NOT* download it on other websites or from unknown sources.
3. Refresh [xCloud web page](https://www.xbox.com/play/). 4. Refresh [xCloud web page](https://www.xbox.com/play/).
4. Click on the new "SERVER NAME" button next to your profile picture to adjust settings. 5. Click on the new "SERVER NAME" button next to your profile picture to adjust settings.
To update manually, just install the script again (you won't lose your settings). To update manually, just install the script again (you won't lose your settings).
@ -61,7 +62,7 @@ Don't see your browser in the table? If it supports Tampermonkey/Userscript then
## Features ## Features
<img width="400" alt="Settings UI" src="https://github.com/redphx/better-xcloud/assets/96280/f759db0b-dcb6-46d9-99a0-044d2d431ee5"> <img width="400" alt="Settings UI" src="https://github.com/redphx/better-xcloud/assets/96280/8baddcfa-b528-4ba7-9392-7b5fe60cea11">
<br> <br>
<img width="600" alt="Stream HUD" src="https://github.com/redphx/better-xcloud/assets/96280/51bdb96c-79ab-402f-902a-a9e6229973b2"> <img width="600" alt="Stream HUD" src="https://github.com/redphx/better-xcloud/assets/96280/51bdb96c-79ab-402f-902a-a9e6229973b2">
<br> <br>
@ -102,6 +103,9 @@ Don't see your browser in the table? If it supports Tampermonkey/Userscript then
> Comparison video with the setting ON & OFF: https://youtu.be/-9PuBJJSgR4 > Comparison video with the setting ON & OFF: https://youtu.be/-9PuBJJSgR4
- **Disable bandwidth checking** - **Disable bandwidth checking**
> xCloud won't warn about slow connection speed. > xCloud won't warn about slow connection speed.
- **Enable volume control feature**
> Allow increasing stream's volume up to 600%
> ⚠️ Disable this setting if you experience slowdown, choppy/muted stream
- **Enable microphone on game launch** - **Enable microphone on game launch**
> Automatically enable the mic when starting to play a game. > Automatically enable the mic when starting to play a game.
- **Hide mouse cursor on idle** - **Hide mouse cursor on idle**
@ -157,6 +161,7 @@ Don't see your browser in the table? If it supports Tampermonkey/Userscript then
### In-game settings ### In-game settings
- **Volume control** - **Volume control**
> Increase stream's volume up to 600% > Increase stream's volume up to 600%
> Can be disabled in the Main Settings
- **🔥 Improve stream's clarity** - **🔥 Improve stream's clarity**
> Similar to (but not as good as) the "Clarity Boost" of xCloud on Edge browser. [Demo video](https://youtu.be/ZhW2choAHUs). > Similar to (but not as good as) the "Clarity Boost" of xCloud on Edge browser. [Demo video](https://youtu.be/ZhW2choAHUs).
> Also known as poor man's "Clarity Boost". > Also known as poor man's "Clarity Boost".
@ -267,7 +272,9 @@ Sorry, no. The server decides all these settings.
It's a reference to an Userscript called "better360" that I created many years ago. I regret not choosing the name "xCloud Enhancement Suite", or XES for short. It's a reference to an Userscript called "better360" that I created many years ago. I regret not choosing the name "xCloud Enhancement Suite", or XES for short.
## Translators ## Translators
- **Portuguese (Brazilian)**: [@ricardo404](https://github.com/ricardo404) - **Portuguese (Brazilian)**: [@ricardo404](https://github.com/ricardo404), [@Haisom](https://github.com/Haisom)
- **Russian**: [anpom6](https://crowdin.com/profile/anpom6)
- **Turkish**: [@transbebek](https://github.com/transbebek)
- **Vietnamese**: [@redphx](https://github.com/redphx) - **Vietnamese**: [@redphx](https://github.com/redphx)
Visit [here](https://crowdin.com/project/better-xcloud) if you want to translate **Better xCloud** to more languages. Visit [here](https://crowdin.com/project/better-xcloud) if you want to translate **Better xCloud** to more languages.

View File

@ -1,5 +1,5 @@
// ==UserScript== // ==UserScript==
// @name Better xCloud // @name Better xCloud
// @namespace https://github.com/redphx // @namespace https://github.com/redphx
// @version 1.17 // @version 1.17.1
// ==/UserScript== // ==/UserScript==

View File

@ -1,7 +1,7 @@
// ==UserScript== // ==UserScript==
// @name Better xCloud // @name Better xCloud
// @namespace https://github.com/redphx // @namespace https://github.com/redphx
// @version 1.17 // @version 1.17.1
// @description Improve Xbox Cloud Gaming (xCloud) experience // @description Improve Xbox Cloud Gaming (xCloud) experience
// @author redphx // @author redphx
// @license MIT // @license MIT
@ -13,7 +13,7 @@
// ==/UserScript== // ==/UserScript==
'use strict'; 'use strict';
const SCRIPT_VERSION = '1.17'; const SCRIPT_VERSION = '1.17.1';
const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud'; const SCRIPT_HOME = 'https://github.com/redphx/better-xcloud';
console.log(`[Better xCloud] readyState: ${document.readyState}`); console.log(`[Better xCloud] readyState: ${document.readyState}`);
@ -66,6 +66,8 @@ const Translations = {
const supportedLocales = [ const supportedLocales = [
'en-US', 'en-US',
'pt-BR', 'pt-BR',
'ru-RU',
'tr-TR',
'vi-VN', 'vi-VN',
]; ];
@ -89,476 +91,672 @@ const Translations = {
"advanced": { "advanced": {
"en-US": "Advanced", "en-US": "Advanced",
"pt-BR": "Avançado", "pt-BR": "Avançado",
"ru-RU": "Продвинутые",
"tr-TR": "Gelişmiş ayarlar",
"vi-VN": "Nâng cao", "vi-VN": "Nâng cao",
}, },
"audio": { "audio": {
"en-US": "Audio", "en-US": "Audio",
"pt-BR": "Áudio", "pt-BR": "Áudio",
"ru-RU": "Звук",
"tr-TR": "Ses",
"vi-VN": "Âm thanh", "vi-VN": "Âm thanh",
}, },
"auto": { "auto": {
"en-US": "Auto", "en-US": "Auto",
"pt-BR": "Automático", "pt-BR": "Automático",
"ru-RU": "Автоматически",
"tr-TR": "Otomatik",
"vi-VN": "Tự động", "vi-VN": "Tự động",
}, },
"badge-audio": { "badge-audio": {
"en-US": "Audio", "en-US": "Audio",
"pt-BR": "Áudio", "pt-BR": "Áudio",
"ru-RU": "Звук",
"tr-TR": "Ses",
"vi-VN": "Tiếng", "vi-VN": "Tiếng",
}, },
"badge-battery": { "badge-battery": {
"en-US": "Battery", "en-US": "Battery",
"pt-BR": "Bateria", "pt-BR": "Bateria",
"ru-RU": "Батарея",
"tr-TR": "Pil",
"vi-VN": "Pin", "vi-VN": "Pin",
}, },
"badge-in": { "badge-in": {
"en-US": "In", "en-US": "In",
"pt-BR": "Recebidos", "pt-BR": "Recebidos",
"ru-RU": "Входящие",
"tr-TR": "Gelen",
"vi-VN": "Nhận", "vi-VN": "Nhận",
}, },
"badge-out": { "badge-out": {
"en-US": "Out", "en-US": "Out",
"pt-BR": "Enviados", "pt-BR": "Enviados",
"ru-RU": "Исходящие",
"tr-TR": "Giden",
"vi-VN": "Gởi", "vi-VN": "Gởi",
}, },
"badge-playtime": { "badge-playtime": {
"en-US": "Playtime", "en-US": "Playtime",
"pt-BR": "Tempo de jogo", "pt-BR": "Tempo de jogo",
"ru-RU": "Время в игре",
"tr-TR": "Oynanış süresi",
"vi-VN": "Giờ chơi", "vi-VN": "Giờ chơi",
}, },
"badge-server": { "badge-server": {
"en-US": "Server", "en-US": "Server",
"pt-BR": "Servidor", "pt-BR": "Servidor",
"ru-RU": "Сервер",
"tr-TR": "Sunucu",
"vi-VN": "Máy chủ", "vi-VN": "Máy chủ",
}, },
"badge-video": { "badge-video": {
"en-US": "Video", "en-US": "Video",
"pt-BR": "Vídeo", "pt-BR": "Vídeo",
"ru-RU": "Видео",
"tr-TR": "Görüntü",
"vi-VN": "Hình", "vi-VN": "Hình",
}, },
"bottom-left": { "bottom-left": {
"en-US": "Bottom-left", "en-US": "Bottom-left",
"pt-BR": "Inferior Esquerdo", "pt-BR": "Inferior Esquerdo",
"ru-RU": "Левый нижний угол",
"tr-TR": "Sol alt",
"vi-VN": "Phía dưới bên trái", "vi-VN": "Phía dưới bên trái",
}, },
"bottom-right": { "bottom-right": {
"en-US": "Bottom-right", "en-US": "Bottom-right",
"pt-BR": "Inferior-direito", "pt-BR": "Inferior-direito",
"ru-RU": "Правый нижний угол",
"tr-TR": "Sağ alt",
"vi-VN": "Phía dưới bên phải", "vi-VN": "Phía dưới bên phải",
}, },
"brightness": { "brightness": {
"en-US": "Brightness", "en-US": "Brightness",
"pt-BR": "Brilho", "pt-BR": "Brilho",
"ru-RU": "Яркость",
"tr-TR": "Aydınlık",
"vi-VN": "Độ sáng", "vi-VN": "Độ sáng",
}, },
"browser-unsupported-feature": { "browser-unsupported-feature": {
"en-US": "Your browser doesn't support this feature", "en-US": "Your browser doesn't support this feature",
"pt-BR": "Seu navegador não suporta este recurso", "pt-BR": "Seu navegador não suporta este recurso",
"ru-RU": "Ваш браузер не поддерживает эту функцию",
"tr-TR": "Web tarayıcınız bu özelliği desteklemiyor",
"vi-VN": "Trình duyệt không hỗ trợ tính năng này", "vi-VN": "Trình duyệt không hỗ trợ tính năng này",
}, },
"clarity": { "clarity": {
"en-US": "Clarity", "en-US": "Clarity",
"pt-BR": "Clareza", "pt-BR": "Clareza",
"ru-RU": "Чёткость",
"tr-TR": "Netlik",
"vi-VN": "Độ nét", "vi-VN": "Độ nét",
}, },
"clarity-boost-warning": { "clarity-boost-warning": {
"en-US": "These settings don't work when the Clarity Boost mode is ON", "en-US": "These settings don't work when the Clarity Boost mode is ON",
"pt-BR": "Essas configurações não funcionam quando o modo de \"Clarity Boost\" está ATIVADO", "pt-BR": "Estas configurações não funcionam quando o modo de \"Clarity Boost\" está ATIVADO",
"ru-RU": "Эти настройки не работают, когда включен режим Clarity Boost",
"tr-TR": "Netliği Artırma modu açıkken bu ayarlar ETKİSİZDİR",
"vi-VN": "Các tùy chỉnh này không hoạt động khi chế độ Clarity Boost đang được bật", "vi-VN": "Các tùy chỉnh này không hoạt động khi chế độ Clarity Boost đang được bật",
}, },
"close": { "close": {
"en-US": "Close", "en-US": "Close",
"pt-BR": "Fechar", "pt-BR": "Fechar",
"ru-RU": "Закрыть",
"tr-TR": "Kapat",
"vi-VN": "Đóng", "vi-VN": "Đóng",
}, },
"conditional-formatting": { "conditional-formatting": {
"en-US": "Conditional formatting text color", "en-US": "Conditional formatting text color",
"pt-BR": "Cor do texto do formato condicional", "pt-BR": "Cor do texto do formato condicional",
"ru-RU": "Цвет текста в зависимости от условий",
"tr-TR": "Metin renginin koşullu biçimlendirilmesi",
"vi-VN": "Thay đổi màu chữ tùy theo giá trị", "vi-VN": "Thay đổi màu chữ tùy theo giá trị",
}, },
"confirm-reload-stream": { "confirm-reload-stream": {
"en-US": "Do you want to refresh the stream?", "en-US": "Do you want to refresh the stream?",
"pt-BR": "Você deseja atualizar o stream?", "pt-BR": "Você deseja atualizar o stream?",
"ru-RU": "Вы хотите перезапустить поток?",
"tr-TR": "Yayını yeniden başlatmak istiyor musunuz?",
"vi-VN": "Bạn có muốn kết nối lại stream không?", "vi-VN": "Bạn có muốn kết nối lại stream không?",
}, },
"contrast": { "contrast": {
"en-US": "Contrast", "en-US": "Contrast",
"pt-BR": "Contraste", "pt-BR": "Contraste",
"ru-RU": "Контрастность",
"tr-TR": "Karşıtlık",
"vi-VN": "Độ tương phản", "vi-VN": "Độ tương phản",
}, },
"custom": { "custom": {
"en-US": "Custom", "en-US": "Custom",
"pt-BR": "Customizado", "pt-BR": "Customizado",
"ru-RU": "Вручную",
"tr-TR": "Özel",
"vi-VN": "Tùy chỉnh", "vi-VN": "Tùy chỉnh",
}, },
"default": { "default": {
"en-US": "Default", "en-US": "Default",
"pt-BR": "Padrão", "pt-BR": "Padrão",
"ru-RU": "По умолчанию",
"tr-TR": "Varsayılan",
"vi-VN": "Mặc định", "vi-VN": "Mặc định",
}, },
"device-unsupported-touch": { "device-unsupported-touch": {
"en-US": "Your device doesn't have touch support", "en-US": "Your device doesn't have touch support",
"pt-BR": "Seu dispositivo não possui suporte de toque", "pt-BR": "Seu dispositivo não possui suporte de toque",
"ru-RU": "Ваше устройство не поддерживает сенсорное управление",
"tr-TR": "Cihazınızda dokunmatik ekran özelliği yoktur",
"vi-VN": "Thiết bị này không hỗ trợ cảm ứng", "vi-VN": "Thiết bị này không hỗ trợ cảm ứng",
}, },
"disable": { "disable": {
"en-US": "Disable", "en-US": "Disable",
"pt-BR": "Desabilitar", "pt-BR": "Desabilitar",
"ru-RU": "Отключить",
"tr-TR": "Devre dışı bırak",
"vi-VN": "Vô hiệu hóa", "vi-VN": "Vô hiệu hóa",
}, },
"disable-bandwidth-checking": { "disable-bandwidth-checking": {
"en-US": "Disable bandwidth checking", "en-US": "Disable bandwidth checking",
"pt-BR": "Desativar verificação de banda", "pt-BR": "Desativar verificação de banda",
"ru-RU": "Отключить проверку интернета",
"tr-TR": "İnternet hız testini atla",
"vi-VN": "Tắt kiểm tra băng thông", "vi-VN": "Tắt kiểm tra băng thông",
}, },
"disable-social-features": { "disable-social-features": {
"en-US": "Disable social features", "en-US": "Disable social features",
"pt-BR": "Desativar recursos sociais", "pt-BR": "Desativar recursos sociais",
"ru-RU": "Отключить социальные функции",
"tr-TR": "Sosyal özellikleri kapat",
"vi-VN": "Khóa các tính năng xã hội", "vi-VN": "Khóa các tính năng xã hội",
}, },
"disable-xcloud-analytics": { "disable-xcloud-analytics": {
"en-US": "Disable xCloud analytics", "en-US": "Disable xCloud analytics",
"pt-BR": "Desativar telemetria do xCloud", "pt-BR": "Desativar telemetria do xCloud",
"ru-RU": "Отключить аналитику xCloud",
"tr-TR": "xCloud'un veri toplamasını devre dışı bırak",
"vi-VN": "Khóa phân tích thông tin của xCloud", "vi-VN": "Khóa phân tích thông tin của xCloud",
}, },
"enable-mic-on-startup": { "enable-mic-on-startup": {
"en-US": "Enable microphone on game launch", "en-US": "Enable microphone on game launch",
"pt-BR": "Ativar microfone na inicialização do jogo", "pt-BR": "Ativar microfone na inicialização do jogo",
"ru-RU": "Автоматически включать микрофон при запуске игры",
"tr-TR": "Oyun başlarken mikrofonu aç",
"vi-VN": "Bật mic lúc vào game", "vi-VN": "Bật mic lúc vào game",
}, },
"enable-quick-glance-mode": { "enable-quick-glance-mode": {
"en-US": "Enable \"Quick Glance\" mode", "en-US": "Enable \"Quick Glance\" mode",
"pt-BR": "Ativar modo \"Revisão Rápida\"", "pt-BR": "Ativar modo \"Revisão Rápida\"",
"ru-RU": "Включить режим «Быстрый взгляд»",
"tr-TR": "\"Seri Bakış\" modunu aç",
"vi-VN": "Bật chế độ \"Xem nhanh\"", "vi-VN": "Bật chế độ \"Xem nhanh\"",
}, },
"enable-volume-control": {
"en-US": "Enable volume control feature",
"pt-BR": "Ativar recurso de controle de volume",
"tr-TR": "Ses düzeyini yönetmeyi etkinleştir",
"vi-VN": "Bật tính năng điều khiển âm lượng",
},
"hide-idle-cursor": { "hide-idle-cursor": {
"en-US": "Hide mouse cursor on idle", "en-US": "Hide mouse cursor on idle",
"pt-BR": "Ocultar o cursor do mouse no ocioso", "pt-BR": "Ocultar o cursor do mouse no ocioso",
"ru-RU": "Скрыть курсор мыши при бездействии",
"tr-TR": "Boştayken fare imlecini gizle",
"vi-VN": "Ẩn con trỏ chuột khi không di chuyển", "vi-VN": "Ẩn con trỏ chuột khi không di chuyển",
}, },
"hide-system-menu-icon": { "hide-system-menu-icon": {
"en-US": "Hide System menu's icon", "en-US": "Hide System menu's icon",
"pt-BR": "Ocultar ícone do menu do sistema", "pt-BR": "Ocultar ícone do menu do sistema",
"ru-RU": "Скрыть значок системного меню",
"tr-TR": "Sistem menüsü simgesini gizle",
"vi-VN": "Ẩn biểu tượng của menu Hệ thống", "vi-VN": "Ẩn biểu tượng của menu Hệ thống",
}, },
"language": { "language": {
"en-US": "Language", "en-US": "Language",
"pt-BR": "Linguagem", "pt-BR": "Linguagem",
"ru-RU": "Язык",
"tr-TR": "Dil",
"vi-VN": "Ngôn ngữ", "vi-VN": "Ngôn ngữ",
}, },
"large": { "large": {
"en-US": "Large", "en-US": "Large",
"pt-BR": "Largo", "pt-BR": "Largo",
"ru-RU": "Большой",
"tr-TR": "Büyük",
"vi-VN": "Lớn", "vi-VN": "Lớn",
}, },
"loading-screen": { "loading-screen": {
"en-US": "Loading screen", "en-US": "Loading screen",
"pt-BR": "Tela de Carregamento", "pt-BR": "Tela de Carregamento",
"ru-RU": "Экран загрузки",
"tr-TR": "Yükleme ekranı",
"vi-VN": "Màn hình chờ", "vi-VN": "Màn hình chờ",
}, },
"menu-stream-settings": { "menu-stream-settings": {
"en-US": "Stream settings", "en-US": "Stream settings",
"pt-BR": "Ajustes de transmissão", "pt-BR": "Ajustes de transmissão",
"ru-RU": "Настройки потоковой передачи",
"tr-TR": "Yayın ayarları",
"vi-VN": "Cấu hình stream", "vi-VN": "Cấu hình stream",
}, },
"menu-stream-stats": { "menu-stream-stats": {
"en-US": "Stream stats", "en-US": "Stream stats",
"pt-BR": "Estatísticas da transmissão", "pt-BR": "Estatísticas da transmissão",
"ru-RU": "Статистика потоковой передачи",
"tr-TR": "Yayın durumu",
"vi-VN": "Thông số stream", "vi-VN": "Thông số stream",
}, },
"normal": { "normal": {
"en-US": "Normal", "en-US": "Normal",
"pt-BR": "Normal", "pt-BR": "Normal",
"ru-RU": "Средний",
"tr-TR": "Normal",
"vi-VN": "Thường", "vi-VN": "Thường",
}, },
"off": { "off": {
"en-US": "Off", "en-US": "Off",
"pt-BR": "Desligado", "pt-BR": "Desligado",
"ru-RU": "Выключен",
"tr-TR": "Kapalı",
"vi-VN": "Tắt", "vi-VN": "Tắt",
}, },
"opacity": { "opacity": {
"en-US": "Opacity", "en-US": "Opacity",
"pt-BR": "Transparência", "pt-BR": "Transparência",
"ru-RU": "Непрозрачность",
"tr-TR": "Saydamsızlık",
"vi-VN": "Độ mờ", "vi-VN": "Độ mờ",
}, },
"other": { "other": {
"en-US": "Other", "en-US": "Other",
"pt-BR": "Outros", "pt-BR": "Outros",
"ru-RU": "Прочее",
"tr-TR": "Diğer",
"vi-VN": "Khác", "vi-VN": "Khác",
}, },
"position": { "position": {
"en-US": "Position", "en-US": "Position",
"pt-BR": "Posição", "pt-BR": "Posição",
"ru-RU": "Расположение",
"tr-TR": "Konum",
"vi-VN": "Vị trí", "vi-VN": "Vị trí",
}, },
"prefer-ipv6-server": { "prefer-ipv6-server": {
"en-US": "Prefer IPv6 server", "en-US": "Prefer IPv6 server",
"pt-BR": "Preferir servidor IPV6", "pt-BR": "Preferir servidor IPV6",
"ru-RU": "Предпочитать IPv6 сервер",
"tr-TR": "IPv6 sunucusunu tercih et",
"vi-VN": "Ưu tiên máy chủ IPv6", "vi-VN": "Ưu tiên máy chủ IPv6",
}, },
"preferred-game-language": { "preferred-game-language": {
"en-US": "Preferred game's language", "en-US": "Preferred game's language",
"pt-BR": "Idioma preferencial do jogo", "pt-BR": "Idioma preferencial do jogo",
"ru-RU": "Предпочитаемый язык игры",
"tr-TR": "Oyunda tercih edilen dil",
"vi-VN": "Ngôn ngữ game ưu tiên", "vi-VN": "Ngôn ngữ game ưu tiên",
}, },
"ratio": { "ratio": {
"en-US": "Ratio", "en-US": "Ratio",
"pt-BR": "Proporção", "pt-BR": "Proporção",
"ru-RU": "Соотношение сторон",
"tr-TR": "Görüntü oranı",
"vi-VN": "Tỉ lệ", "vi-VN": "Tỉ lệ",
}, },
"reduce-animations": { "reduce-animations": {
"en-US": "Reduce UI animations", "en-US": "Reduce UI animations",
"pt-BR": "Reduzir animações da interface", "pt-BR": "Reduzir animações da interface",
"ru-RU": "Убрать анимации интерфейса",
"tr-TR": "Arayüz animasyonlarını azalt",
"vi-VN": "Giảm hiệu ứng chuyển động", "vi-VN": "Giảm hiệu ứng chuyển động",
}, },
"region": { "region": {
"en-US": "Region", "en-US": "Region",
"pt-BR": "Região", "pt-BR": "Região",
"ru-RU": "Регион",
"tr-TR": "Bölge",
"vi-VN": "Khu vực", "vi-VN": "Khu vực",
}, },
"rocket-always-hide": { "rocket-always-hide": {
"en-US": "Always hide", "en-US": "Always hide",
"pt-BR": "Sempre ocultar", "pt-BR": "Sempre ocultar",
"ru-RU": "Всегда скрывать",
"tr-TR": "Her zaman gizle",
"vi-VN": "Luôn ẩn", "vi-VN": "Luôn ẩn",
}, },
"rocket-always-show": { "rocket-always-show": {
"en-US": "Always show", "en-US": "Always show",
"pt-BR": "Sempre mostrar", "pt-BR": "Sempre mostrar",
"ru-RU": "Всегда показывать",
"tr-TR": "Her zaman göster",
"vi-VN": "Luôn hiển thị", "vi-VN": "Luôn hiển thị",
}, },
"rocket-animation": { "rocket-animation": {
"en-US": "Rocket animation", "en-US": "Rocket animation",
"pt-BR": "Animação do foguete", "pt-BR": "Animação do foguete",
"ru-RU": "Анимация ракеты",
"tr-TR": "Roket animasyonu",
"vi-VN": "Phi thuyền", "vi-VN": "Phi thuyền",
}, },
"rocket-hide-queue": { "rocket-hide-queue": {
"en-US": "Hide when queuing", "en-US": "Hide when queuing",
"pt-BR": "Ocultar quando estiver na fila", "pt-BR": "Ocultar quando estiver na fila",
"ru-RU": "Скрыть, когда есть очередь",
"tr-TR": "Sıradayken gizle",
"vi-VN": "Ẩn khi xếp hàng chờ", "vi-VN": "Ẩn khi xếp hàng chờ",
}, },
"safari-failed-message": { "safari-failed-message": {
"en-US": "Failed to run Better xCloud. Retrying, please wait...", "en-US": "Failed to run Better xCloud. Retrying, please wait...",
"pt-BR": "Falha ao executar o Better xCloud. Tentando novamente, aguarde...", "pt-BR": "Falha ao executar o Better xCloud. Tentando novamente, aguarde...",
"ru-RU": "Не удалось запустить Better xCloud. Идет перезапуск, пожалуйста, подождите...",
"tr-TR": "Better xCloud çalıştırılamadı. Yeniden deneniyor...",
"vi-VN": "Không thể chạy Better xCloud. Đang thử lại, vui lòng chờ...", "vi-VN": "Không thể chạy Better xCloud. Đang thử lại, vui lòng chờ...",
}, },
"saturation": { "saturation": {
"en-US": "Saturation", "en-US": "Saturation",
"pt-BR": "Saturação", "pt-BR": "Saturação",
"ru-RU": "Насыщенность",
"tr-TR": "Renk doygunluğu",
"vi-VN": "Độ bão hòa", "vi-VN": "Độ bão hòa",
}, },
"screenshot-button-position": { "screenshot-button-position": {
"en-US": "Screenshot button's position", "en-US": "Screenshot button's position",
"pt-BR": "Posição do botão de Screenshot", "pt-BR": "Posição do botão de captura de tela",
"ru-RU": "Расположение кнопки скриншота",
"tr-TR": "Ekran görüntüsü düğmesi konumu",
"vi-VN": "Vị trí của nút Chụp màn hình", "vi-VN": "Vị trí của nút Chụp màn hình",
}, },
"server": { "server": {
"en-US": "Server", "en-US": "Server",
"pt-BR": "Servidor", "pt-BR": "Servidor",
"ru-RU": "Сервер",
"tr-TR": "Sunucu",
"vi-VN": "Máy chủ", "vi-VN": "Máy chủ",
}, },
"settings-reload": { "settings-reload": {
"en-US": "Reload page to reflect changes", "en-US": "Reload page to reflect changes",
"pt-BR": "Recarregue a página para refletir as alterações", "pt-BR": "Recarregue a página para refletir as alterações",
"ru-RU": "Перезагрузить страницу, чтобы применить изменения",
"tr-TR": "Kaydetmek için sayfayı yenile",
"vi-VN": "Tải lại trang để áp dụng các thay đổi", "vi-VN": "Tải lại trang để áp dụng các thay đổi",
}, },
"settings-reloading": { "settings-reloading": {
"en-US": "Reloading...", "en-US": "Reloading...",
"pt-BR": "Recarregando...", "pt-BR": "Recarregando...",
"ru-RU": "Перезагрузка...",
"tr-TR": "Sayfa yenileniyor...",
"vi-VN": "Đang tải lại...", "vi-VN": "Đang tải lại...",
}, },
"show-game-art": { "show-game-art": {
"en-US": "Show game art", "en-US": "Show game art",
"pt-BR": "Mostrar arte do jogo", "pt-BR": "Mostrar arte do jogo",
"ru-RU": "Показывать игровую обложку",
"tr-TR": "Oyun resmini göster",
"vi-VN": "Hiển thị ảnh game", "vi-VN": "Hiển thị ảnh game",
}, },
"show-stats-on-startup": { "show-stats-on-startup": {
"en-US": "Show stats when starting the game", "en-US": "Show stats when starting the game",
"pt-BR": "Mostrar estatísticas ao iniciar o jogo", "pt-BR": "Mostrar estatísticas ao iniciar o jogo",
"ru-RU": "Показывать статистику при запуске игры",
"tr-TR": "Oyun başlatırken yayın durumunu göster",
"vi-VN": "Hiển thị thông số khi vào game", "vi-VN": "Hiển thị thông số khi vào game",
}, },
"show-wait-time": { "show-wait-time": {
"en-US": "Show the estimated wait time", "en-US": "Show the estimated wait time",
"pt-BR": "Mostrar o tempo estimado de espera", "pt-BR": "Mostrar o tempo estimado de espera",
"ru-RU": "Показать предполагаемое время до запуска",
"tr-TR": "Tahminî bekleme süresini göster",
"vi-VN": "Hiển thị thời gian chờ dự kiến", "vi-VN": "Hiển thị thời gian chờ dự kiến",
}, },
"simplify-stream-menu": { "simplify-stream-menu": {
"en-US": "Simplify Stream's menu", "en-US": "Simplify Stream's menu",
"pt-BR": "Simplificar menu do streaming", "pt-BR": "Simplificar menu do streaming",
"ru-RU": "Упростить меню потока",
"tr-TR": "Yayın menüsünü basitleştir",
"vi-VN": "Đơn giản hóa menu của Stream", "vi-VN": "Đơn giản hóa menu của Stream",
}, },
"skip-splash-video": { "skip-splash-video": {
"en-US": "Skip Xbox splash video", "en-US": "Skip Xbox splash video",
"pt-BR": "Pular vídeo de abertura do Xbox", "pt-BR": "Pular vídeo de abertura do Xbox",
"ru-RU": "Пропустить видео с заставкой Xbox",
"tr-TR": "Xbox açılış ekranını atla",
"vi-VN": "Bỏ qua video Xbox", "vi-VN": "Bỏ qua video Xbox",
}, },
"small": { "small": {
"en-US": "Small", "en-US": "Small",
"pt-BR": "Pequeno", "pt-BR": "Pequeno",
"ru-RU": "Маленький",
"tr-TR": "Küçük",
"vi-VN": "Nhỏ", "vi-VN": "Nhỏ",
}, },
"stat-bitrate": { "stat-bitrate": {
"en-US": "Bitrate", "en-US": "Bitrate",
"pt-BR": "Bitrate", "pt-BR": "Bitrate",
"ru-RU": "Скорость соединения",
"tr-TR": "Bit hızı",
"vi-VN": "Bitrate", "vi-VN": "Bitrate",
}, },
"stat-decode-time": { "stat-decode-time": {
"en-US": "Decode time", "en-US": "Decode time",
"pt-BR": "Tempo de decodificação", "pt-BR": "Tempo de decodificação",
"ru-RU": "Время декодирования",
"tr-TR": "Kod çözme süresi",
"vi-VN": "Thời gian giải mã", "vi-VN": "Thời gian giải mã",
}, },
"stat-fps": { "stat-fps": {
"en-US": "FPS", "en-US": "FPS",
"pt-BR": "FPS", "pt-BR": "FPS",
"ru-RU": "Кадр/сек",
"tr-TR": "FPS",
"vi-VN": "FPS", "vi-VN": "FPS",
}, },
"stat-frames-lost": { "stat-frames-lost": {
"en-US": "Frames lost", "en-US": "Frames lost",
"pt-BR": "Quadros perdidos", "pt-BR": "Quadros perdidos",
"ru-RU": "Потери кадров",
"tr-TR": "Kare kaybı",
"vi-VN": "Số khung hình bị mất", "vi-VN": "Số khung hình bị mất",
}, },
"stat-packets-lost": { "stat-packets-lost": {
"en-US": "Packets lost", "en-US": "Packets lost",
"pt-BR": "Pacotes perdidos", "pt-BR": "Pacotes perdidos",
"ru-RU": "Потери пакетов",
"tr-TR": "Paket kaybı",
"vi-VN": "Số gói tin bị mất", "vi-VN": "Số gói tin bị mất",
}, },
"stat-ping": { "stat-ping": {
"en-US": "Ping", "en-US": "Ping",
"pt-BR": "Ping", "pt-BR": "Ping",
"ru-RU": "Задержка соединения",
"tr-TR": "Gecikme",
"vi-VN": "Ping", "vi-VN": "Ping",
}, },
"stats": { "stats": {
"en-US": "Stats", "en-US": "Stats",
"pt-BR": "Estatísticas", "pt-BR": "Estatísticas",
"ru-RU": "Статистика",
"tr-TR": "Durum",
"vi-VN": "Các thông số", "vi-VN": "Các thông số",
}, },
"stream": { "stream": {
"en-US": "Stream", "en-US": "Stream",
"pt-BR": "Stream", "pt-BR": "Stream",
"ru-RU": "Видеопоток",
"tr-TR": "Yayın",
"vi-VN": "Stream", "vi-VN": "Stream",
}, },
"stream-stats-settings": { "stream-stats-settings": {
"en-US": "Stream stats settings", "en-US": "Stream stats settings",
"pt-BR": "Ajustes de estatísticas", "pt-BR": "Ajustes de estatísticas",
"ru-RU": "Настройки потоковой передачи",
"tr-TR": "Yayın durumu ayarları",
"vi-VN": "Cấu hình thông số của stream", "vi-VN": "Cấu hình thông số của stream",
}, },
"stretch": { "stretch": {
"en-US": "Stretch", "en-US": "Stretch",
"pt-BR": "Esticar", "pt-BR": "Esticar",
"ru-RU": "Растянуть",
"tr-TR": "Genişlet",
"vi-VN": "Kéo giãn", "vi-VN": "Kéo giãn",
}, },
"target-resolution": { "target-resolution": {
"en-US": "Target resolution", "en-US": "Target resolution",
"pt-BR": "Resolução alvo", "pt-BR": "Resolução alvo",
"ru-RU": "Целевое разрешение",
"tr-TR": "Tercih edilen çözünürlük",
"vi-VN": "Độ phân giải", "vi-VN": "Độ phân giải",
}, },
"tc-all-games": { "tc-all-games": {
"en-US": "All games", "en-US": "All games",
"pt-BR": "Todos os jogos", "pt-BR": "Todos os jogos",
"ru-RU": "Все игры",
"tr-TR": "Tüm oyunlar",
"vi-VN": "Tất cả các game", "vi-VN": "Tất cả các game",
}, },
"tc-all-white": { "tc-all-white": {
"en-US": "All white", "en-US": "All white",
"pt-BR": "Tudo branco", "pt-BR": "Tudo branco",
"ru-RU": "Полностью белые",
"tr-TR": "Hepsi beyaz",
"vi-VN": "Trắng hoàn toàn", "vi-VN": "Trắng hoàn toàn",
}, },
"tc-availability": { "tc-availability": {
"en-US": "Availability", "en-US": "Availability",
"pt-BR": "Disponibilidade", "pt-BR": "Disponibilidade",
"ru-RU": "В каких играх включить",
"tr-TR": "Uygunluk durumu",
"vi-VN": "Khả dụng", "vi-VN": "Khả dụng",
}, },
"tc-custom-layout-style": { "tc-custom-layout-style": {
"en-US": "Custom layout's button style", "en-US": "Custom layout's button style",
"pt-BR": "Estilo de botão do layout personalizado", "pt-BR": "Estilo de botão do layout personalizado",
"ru-RU": "Пользовательский стиль кнопок",
"tr-TR": "Özelleştirilmiş düğme düzeninin biçimi",
"vi-VN": "Màu của bố cục tùy chọn", "vi-VN": "Màu của bố cục tùy chọn",
}, },
"tc-muted-colors": { "tc-muted-colors": {
"en-US": "Muted colors", "en-US": "Muted colors",
"pt-BR": "Cores silenciadas", "pt-BR": "Cores silenciadas",
"ru-RU": "Приглушенные цвета",
"tr-TR": "Yumuşak renkler",
"vi-VN": "Màu câm", "vi-VN": "Màu câm",
}, },
"tc-standard-layout-style": { "tc-standard-layout-style": {
"en-US": "Standard layout's button style", "en-US": "Standard layout's button style",
"pt-BR": "Estilo padrão de botões do layout", "pt-BR": "Estilo padrão de botões do layout",
"ru-RU": "Стандартный стиль кнопок",
"tr-TR": "Varsayılan düğme düzeninin biçimi",
"vi-VN": "Màu của bố cục tiêu chuẩn", "vi-VN": "Màu của bố cục tiêu chuẩn",
}, },
"text-size": { "text-size": {
"en-US": "Text size", "en-US": "Text size",
"pt-BR": "Tamanho do texto", "pt-BR": "Tamanho do texto",
"ru-RU": "Размер текста",
"tr-TR": "Metin boyutu",
"vi-VN": "Cỡ chữ", "vi-VN": "Cỡ chữ",
}, },
"top-center": { "top-center": {
"en-US": "Top-center", "en-US": "Top-center",
"pt-BR": "Superior-centralizado", "pt-BR": "Superior-centralizado",
"ru-RU": "Сверху",
"tr-TR": "Orta üst",
"vi-VN": "Chính giữa phía trên", "vi-VN": "Chính giữa phía trên",
}, },
"top-left": { "top-left": {
"en-US": "Top-left", "en-US": "Top-left",
"pt-BR": "Superior-esquerdo", "pt-BR": "Superior-esquerdo",
"ru-RU": "Левый верхний угол",
"tr-TR": "Sol üst",
"vi-VN": "Phía trên bên trái", "vi-VN": "Phía trên bên trái",
}, },
"top-right": { "top-right": {
"en-US": "Top-right", "en-US": "Top-right",
"pt-BR": "Superior-direito", "pt-BR": "Superior-direito",
"ru-RU": "Справа",
"tr-TR": "Sağ üst",
"vi-VN": "Phía trên bên phải", "vi-VN": "Phía trên bên phải",
}, },
"touch-controller": { "touch-controller": {
"en-US": "Touch controller", "en-US": "Touch controller",
"pt-BR": "Controle de toque", "pt-BR": "Controle de toque",
"ru-RU": "Сенсорные кнопки",
"tr-TR": "Dokunmatik oyun kumandası",
"vi-VN": "Bộ điều khiển cảm ứng", "vi-VN": "Bộ điều khiển cảm ứng",
}, },
"transparent-background": { "transparent-background": {
"en-US": "Transparent background", "en-US": "Transparent background",
"pt-BR": "Fundo transparente", "pt-BR": "Fundo transparente",
"ru-RU": "Прозрачный фон",
"tr-TR": "Saydam arka plan",
"vi-VN": "Trong suốt màu nền", "vi-VN": "Trong suốt màu nền",
}, },
"ui": { "ui": {
"en-US": "UI", "en-US": "UI",
"pt-BR": "Interface", "pt-BR": "Interface",
"ru-RU": "Интерфейс",
"tr-TR": "Kullanıcı arayüzü",
"vi-VN": "Giao diện", "vi-VN": "Giao diện",
}, },
"user-agent-profile": { "user-agent-profile": {
"en-US": "User-Agent profile", "en-US": "User-Agent profile",
"pt-BR": "Perfil do User-Agent", "pt-BR": "Perfil do User-Agent",
"ru-RU": "Профиль устройства",
"tr-TR": "Kullanıcı aracısı profili",
"vi-VN": "User-Agent", "vi-VN": "User-Agent",
}, },
"video": { "video": {
"en-US": "Video", "en-US": "Video",
"pt-BR": "Vídeo", "pt-BR": "Vídeo",
"ru-RU": "Видео",
"tr-TR": "Görüntü",
"vi-VN": "Hình ảnh", "vi-VN": "Hình ảnh",
}, },
"visual-quality": { "visual-quality": {
"en-US": "Visual quality", "en-US": "Visual quality",
"pt-BR": "Qualidade visual", "pt-BR": "Qualidade visual",
"ru-RU": "Качество видеопотока",
"tr-TR": "Görüntü kalitesi",
"vi-VN": "Chất lượng hình ảnh", "vi-VN": "Chất lượng hình ảnh",
}, },
"visual-quality-high": { "visual-quality-high": {
"en-US": "High", "en-US": "High",
"pt-BR": "Alto", "pt-BR": "Alto",
"ru-RU": "Высокое",
"tr-TR": "Yüksek",
"vi-VN": "Cao", "vi-VN": "Cao",
}, },
"visual-quality-low": { "visual-quality-low": {
"en-US": "Low", "en-US": "Low",
"pt-BR": "Baixo", "pt-BR": "Baixo",
"ru-RU": "Низкое",
"tr-TR": "Düşük",
"vi-VN": "Thấp", "vi-VN": "Thấp",
}, },
"visual-quality-normal": { "visual-quality-normal": {
"en-US": "Normal", "en-US": "Normal",
"pt-BR": "Normal", "pt-BR": "Normal",
"ru-RU": "Среднее",
"tr-TR": "Normal",
"vi-VN": "Thường", "vi-VN": "Thường",
}, },
"volume": { "volume": {
"en-US": "Volume", "en-US": "Volume",
"pt-BR": "Volume", "pt-BR": "Volume",
"ru-RU": "Громкость",
"tr-TR": "Ses düzeyi",
"vi-VN": "Âm lượng", "vi-VN": "Âm lượng",
}, },
"wait-time-countdown": { "wait-time-countdown": {
"en-US": "Countdown", "en-US": "Countdown",
"pt-BR": "Contagem regressiva", "pt-BR": "Contagem regressiva",
"ru-RU": "Время до запуска",
"tr-TR": "Geri sayım",
"vi-VN": "Đếm ngược", "vi-VN": "Đếm ngược",
}, },
"wait-time-estimated": { "wait-time-estimated": {
"en-US": "Estimated finish time", "en-US": "Estimated finish time",
"pt-BR": "Tempo estimado de conclusão", "pt-BR": "Tempo estimado de conclusão",
"ru-RU": "Примерное время запуска",
"tr-TR": "Tahminî bitiş süresi",
"vi-VN": "Thời gian hoàn thành dự kiến", "vi-VN": "Thời gian hoàn thành dự kiến",
}, },
} }
@ -1670,6 +1868,7 @@ class Preferences {
static get VIDEO_SATURATION() { return 'video_saturation'; } static get VIDEO_SATURATION() { return 'video_saturation'; }
static get AUDIO_MIC_ON_PLAYING() { return 'audio_mic_on_playing'; } static get AUDIO_MIC_ON_PLAYING() { return 'audio_mic_on_playing'; }
static get AUDIO_ENABLE_VOLUME_CONTROL() { return 'audio_enable_volume_control'; }
static get AUDIO_VOLUME() { return 'audio_volume'; } static get AUDIO_VOLUME() { return 'audio_volume'; }
static get STATS_ITEMS() { return 'stats_items'; }; static get STATS_ITEMS() { return 'stats_items'; };
@ -1699,6 +1898,8 @@ class Preferences {
'options': { 'options': {
'en-US': 'English (United States)', 'en-US': 'English (United States)',
'pt-BR': 'portugu\xeas (Brasil)', 'pt-BR': 'portugu\xeas (Brasil)',
'ru-RU': '\u0440\u0443\u0441\u0441\u043a\u0438\u0439',
'tr-TR': 'T\xfcrk\xe7e',
'vi-VN': 'Tiếng Việt', 'vi-VN': 'Tiếng Việt',
}, },
}, },
@ -1927,6 +2128,9 @@ class Preferences {
[Preferences.AUDIO_MIC_ON_PLAYING]: { [Preferences.AUDIO_MIC_ON_PLAYING]: {
'default': false, 'default': false,
}, },
[Preferences.AUDIO_ENABLE_VOLUME_CONTROL]: {
'default': true,
},
[Preferences.AUDIO_VOLUME]: { [Preferences.AUDIO_VOLUME]: {
'default': 100, 'default': 100,
'min': 0, 'min': 0,
@ -2182,6 +2386,9 @@ class Preferences {
const setting = Preferences.SETTINGS[key] const setting = Preferences.SETTINGS[key]
let value = PREFS.get(key); let value = PREFS.get(key);
if (options.disabled) {
value = Preferences.SETTINGS[key].default;
}
let $text, $decBtn, $incBtn, $range; let $text, $decBtn, $incBtn, $range;
@ -3487,6 +3694,7 @@ function injectSettingsButton($parent) {
[Preferences.STREAM_TARGET_RESOLUTION]: __('target-resolution'), [Preferences.STREAM_TARGET_RESOLUTION]: __('target-resolution'),
[Preferences.STREAM_CODEC_PROFILE]: __('visual-quality'), [Preferences.STREAM_CODEC_PROFILE]: __('visual-quality'),
[Preferences.DISABLE_BANDWIDTH_CHECKING]: __('disable-bandwidth-checking'), [Preferences.DISABLE_BANDWIDTH_CHECKING]: __('disable-bandwidth-checking'),
[Preferences.AUDIO_ENABLE_VOLUME_CONTROL]: __('enable-volume-control'),
[Preferences.AUDIO_MIC_ON_PLAYING]: __('enable-mic-on-startup'), [Preferences.AUDIO_MIC_ON_PLAYING]: __('enable-mic-on-startup'),
[Preferences.STREAM_HIDE_IDLE_CURSOR]: __('hide-idle-cursor'), [Preferences.STREAM_HIDE_IDLE_CURSOR]: __('hide-idle-cursor'),
}, },
@ -3990,7 +4198,7 @@ function setupVideoSettingsBar() {
CE('label', {}, __('volume')), CE('label', {}, __('volume')),
PREFS.toNumberStepper(Preferences.AUDIO_VOLUME, (e, value) => { PREFS.toNumberStepper(Preferences.AUDIO_VOLUME, (e, value) => {
STREAM_AUDIO_GAIN_NODE && (STREAM_AUDIO_GAIN_NODE.gain.value = (value / 100).toFixed(2)); STREAM_AUDIO_GAIN_NODE && (STREAM_AUDIO_GAIN_NODE.gain.value = (value / 100).toFixed(2));
}, {suffix: '%', ticks: 100})), }, {suffix: '%', ticks: 100, disabled: !PREFS.get(Preferences.AUDIO_ENABLE_VOLUME_CONTROL)})),
CE('h2', {}, __('video')), CE('h2', {}, __('video')),
CE('div', {'class': 'bx-clarity-boost-warning'}, `⚠️ ${__('clarity-boost-warning')}`), CE('div', {'class': 'bx-clarity-boost-warning'}, `⚠️ ${__('clarity-boost-warning')}`),
@ -4259,7 +4467,8 @@ if (PREFS.get(Preferences.DISABLE_BANDWIDTH_CHECKING)) {
checkForUpdate(); checkForUpdate();
// Monkey patches // Monkey patches
if (UserAgent.isSafari(true)) { if (PREFS.get(Preferences.AUDIO_ENABLE_VOLUME_CONTROL)) {
if (UserAgent.isSafari(true)) {
window.AudioContext.prototype.orgCreateGain = window.AudioContext.prototype.createGain; window.AudioContext.prototype.orgCreateGain = window.AudioContext.prototype.createGain;
window.AudioContext.prototype.createGain = function() { window.AudioContext.prototype.createGain = function() {
const gainNode = this.orgCreateGain.apply(this); const gainNode = this.orgCreateGain.apply(this);
@ -4267,13 +4476,37 @@ if (UserAgent.isSafari(true)) {
STREAM_AUDIO_GAIN_NODE = gainNode; STREAM_AUDIO_GAIN_NODE = gainNode;
return gainNode; return gainNode;
} }
} }
const OrgAudioContext = window.AudioContext; const OrgAudioContext = window.AudioContext;
window.AudioContext = function() { window.AudioContext = function() {
const ctx = new OrgAudioContext(); const ctx = new OrgAudioContext();
STREAM_AUDIO_CONTEXT = ctx; STREAM_AUDIO_CONTEXT = ctx;
return ctx; return ctx;
}
HTMLAudioElement.prototype.orgPlay = HTMLAudioElement.prototype.play;
HTMLAudioElement.prototype.play = function() {
this.muted = true;
const promise = this.orgPlay.apply(this);
if (STREAM_AUDIO_GAIN_NODE) {
return promise;
}
this.addEventListener('playing', e => e.target.pause());
const audioCtx = STREAM_AUDIO_CONTEXT;
const audioStream = audioCtx.createMediaStreamSource(this.srcObject);
const gainNode = audioCtx.createGain();
audioStream.connect(gainNode);
gainNode.connect(audioCtx.destination);
gainNode.gain.value = (PREFS.get(Preferences.AUDIO_VOLUME) / 100).toFixed(2);
STREAM_AUDIO_GAIN_NODE = gainNode;
return promise;
}
} }
RTCPeerConnection.prototype.orgAddIceCandidate = RTCPeerConnection.prototype.addIceCandidate; RTCPeerConnection.prototype.orgAddIceCandidate = RTCPeerConnection.prototype.addIceCandidate;
@ -4293,39 +4526,6 @@ if (PREFS.get(Preferences.STREAM_TOUCH_CONTROLLER) === 'all') {
const OrgRTCPeerConnection = window.RTCPeerConnection; const OrgRTCPeerConnection = window.RTCPeerConnection;
window.RTCPeerConnection = function() { window.RTCPeerConnection = function() {
const peer = new OrgRTCPeerConnection(); const peer = new OrgRTCPeerConnection();
peer.addEventListener('track', e => {
if (e.track.kind !== 'audio') {
return;
}
const $audio = document.querySelector('#game-stream audio');
if (!$audio) {
return;
}
try {
// Prevent double sounds
$audio.muted = true;
const audioCtx = STREAM_AUDIO_CONTEXT;
const audioStream = audioCtx.createMediaStreamSource(e.streams[0]);
const gainNode = audioCtx.createGain();
audioStream.connect(gainNode);
gainNode.connect(audioCtx.destination);
gainNode.gain.value = (PREFS.get(Preferences.AUDIO_VOLUME) / 100).toFixed(2);
STREAM_AUDIO_GAIN_NODE = gainNode;
$audio.pause();
$audio.addEventListener('play', e => {
$audio.pause();
});
} catch (e) {
$audio && ($audio.muted = false);
}
});
STREAM_WEBRTC = peer; STREAM_WEBRTC = peer;
return peer; return peer;
} }