maltejur / discord-screenaudio

A custom discord client that supports streaming with audio on Linux.
1.09k stars 35 forks source link

Crashes when trying to join a voice call #196

Closed Ringtail-Jax closed 8 months ago

Ringtail-Jax commented 8 months ago

Hello! When trying to join any voice channels the client seems to hang for a minute giving the discord loading screen then crashes outright. Here is the output on console, a constant error keeps popping up about the mute/deafen/settings button container. Made sure to reinstall the client and rebooted computer, not sure what to try next.

image

alissonsleal commented 8 months ago

Yes, I had a similar issue with the official Discord client on Flatpak right now. It might be related. I fixed the official client by updating it, but discord-screenaudio still doesn't work.

jvyden commented 8 months ago

It seems they pushed some updates to theming and other internal things, and a bunch of the CSS class names have changed which causes the userscript to fail to find a bunch of things. Additionally, they seem to be using Object.hasOwn which isn't available in the current qt5-webview. I haven't found most of the new ones, but I found the ones responsible for screen sharing. Here's my patchset for others to work off of:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index beebe20..8240b40 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,8 +17,8 @@ set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
 string(TIMESTAMP TIMESTAMP %s)
 # set(CMAKE_AUTOUIC ON)

-option(PREFER_QT6 "Prefer Qt6 over Qt5" OFF)
-option(SKIP_KDE "Do not include features requiring KDE Frameworks (notifications, global shortcuts)" OFF)
+option(PREFER_QT6 "Prefer Qt6 over Qt5" ON)
+option(SKIP_KDE "Do not include features requiring KDE Frameworks (notifications, global shortcuts)" ON)

 if(NOT PREFER_QT6)
   find_package(Qt5 COMPONENTS Widgets QUIET)
diff --git a/assets/userscript.js b/assets/userscript.js
index be5cb64..ff26fc3 100644
--- a/assets/userscript.js
+++ b/assets/userscript.js
@@ -213,10 +213,10 @@ let userscriptPromise;
         hiddenElements.length = 0;
       } else {
         for (const el of [
-          document.getElementsByClassName("actionButtons-1DmM2g")?.[0]
+          document.getElementsByClassName("actionButtons_b58cbb")?.[0]
             ?.children[1],
           document.querySelector(
-            ".wrapper-3t3Yqv > div > div > div > div > .controlButton-2PMNom"
+            ".wrapper__3f3a7 > div > div > div > div > .controlButton_ab2899"
           ),
         ]) {
           if (!el) continue;
@@ -294,7 +294,7 @@ let userscriptPromise;
       }

       const buttonContainer =
-        document.getElementsByClassName("container-1CH86i")[0];
+        document.getElementsByClassName("container_ca50b9")[0];
       if (!buttonContainer) {
         userscript.log("Cannot locate Mute/Deafen/Settings button container");
       }
Ringtail-Jax commented 8 months ago

Yur a badass brother, ty ty for tracking most (hopefully soon to be) all <3

sim590 commented 8 months ago

The patch by @jvyden seems to have fixed it for me. As far as I can tell after testing it quickly.

tinyCatzilla commented 8 months ago

Hi, @jvyden, is there a location to implement this path (other than rebuilding the whole package)? Ty in advance

jvyden commented 8 months ago

Unfortunately not, as far as I'm aware. I'd just wait for an official patch if you're unwilling to self-build.

Do note though that the version of the webview I had to use is technically considered unstable as of this moment, so perhaps a polyfill for hasOwn can be used in the meantime.

I'll work on a full pull request tomorrow. :+1: