From c941aa32a2e07ef04f38142835a0cd00e2c4daca Mon Sep 17 00:00:00 2001 From: Alvar Penning Date: Mon, 25 Apr 2022 12:33:20 +0200 Subject: [PATCH] stream.py: Hide interactive UI elements This commit hides more interactive UI elements which are unnecessary for a video stream, e.g., buttons. All elements from the top navbar were removed except the meeting's title. Furthermore, some CSS was added to hide both "fullscreen" and "hide" buttons from presentations, webcam videos, and screen shares. Other interactive elements like notification toasts and the poll window - not the results - were also marked as hidden. By adding those rules through CSS, they will also apply to elements spawned after the recording was started. --- stream.py | 30 +++++++++++++++++++++++++----- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/stream.py b/stream.py index 61fb309..0ce6f7e 100644 --- a/stream.py +++ b/stream.py @@ -191,12 +191,32 @@ def bbb_browser(): except ElementClickInterceptedException: logging.info("could not find users and messages toggle") - try: - browser.execute_script("document.querySelector('[aria-label=\"Users and messages toggle\"]').style.display='none';") - except JavascriptException: - browser.execute_script("document.querySelector('[aria-label=\"Users and messages toggle with new message notification\"]').style.display='none';") - browser.execute_script("document.querySelector('[aria-label=\"Options\"]').style.display='none';") + # Remove everything from the top bar, except the meeting's title. + browser.execute_script("document.querySelector('div[class^=\"navbar\"] > div[class^=\"top\"] > div[class^=\"left\"]').style.display='none';") + browser.execute_script("document.querySelectorAll('div[class^=\"navbar\"] > div[class^=\"top\"] > div[class^=\"center\"] > :not(h1)').forEach((ele) => ele.style.display='none');") + browser.execute_script("document.querySelector('div[class^=\"navbar\"] > div[class^=\"top\"] > div[class^=\"right\"]').style.display='none';") + browser.execute_script("document.querySelector('[aria-label=\"Actions bar\"]').style.display='none';") + + browser.execute_script(""" + const hideDecoratorsStyle = document.createElement("style"); + hideDecoratorsStyle.innerText = ` + /* Presentation hide minus button */ + button[aria-label="Hide presentation"], + /* Fullscreen button, both for presentations and webcams */ + button[aria-label^="Make "][aria-label$=" fullscreen"], + /* Drop down menu next to user names for webcam videos */ + div[class^="videoCanvas"] span[class^="dropdownTrigger"]::after, + /* Interactive poll window */ + div[class^="pollingContainer"], + /* Notification toasts */ + div[class="Toastify"] { + display: none; + } + `; + document.head.appendChild(hideDecoratorsStyle); + """) + try: browser.execute_script("document.getElementById('container').setAttribute('style','margin-bottom:30px');") except JavascriptException: