Skip to content

Commit

Permalink
stream.py: Hide interactive UI elements
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
oxzi committed May 11, 2022
1 parent c4fee4b commit c941aa3
Showing 1 changed file with 25 additions and 5 deletions.
30 changes: 25 additions & 5 deletions stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit c941aa3

Please sign in to comment.