From 94bddb07406c0886b7036ff8d95f09749fafa152 Mon Sep 17 00:00:00 2001 From: redphx <96280+redphx@users.noreply.github.com> Date: Wed, 13 Mar 2024 16:52:01 +0700 Subject: [PATCH] Support vibrating using Android API --- better-xcloud.user.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/better-xcloud.user.js b/better-xcloud.user.js index b9eb6e9..d21cb69 100644 --- a/better-xcloud.user.js +++ b/better-xcloud.user.js @@ -6173,6 +6173,11 @@ class VibrationManager { static #playDeviceVibration(data) { // console.log(+new Date, data); + if ('AndroidInterface' in window) { + AndroidInterface.vibrate(JSON.stringify(data), window.BX_VIBRATION_INTENSITY); + return; + } + const intensity = Math.min(100, data.leftMotorPercent + data.rightMotorPercent / 2) * window.BX_VIBRATION_INTENSITY; if (intensity === 0 || intensity === 100) { // Stop vibration @@ -10544,6 +10549,7 @@ div[data-testid="media-container"] { #game-stream video { margin: 0 auto; align-self: center; + background: #000; ${videoCss} } `;