Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Bookmarklet for BigBlueButton to mute while only one participant is in the room
javascript:(function(){function mute() { if (document.querySelectorAll('.participantsList--1MvMwF').length <= 1) { document.getElementById('remote-media').muted = true; console.log('Audio muted because there is only one participant.'); } else { console.log('Audio unmuted because there is more than one participant.'); document.getElementById('remote-media').muted = false; }}; mute(); const targetNode = document.getElementsByClassName('userListColumn--6vKQL')[0]; const config = { attributes: true, childList: true, subtree: true }; const callback = function(mutationsList, observer) { for(let mutation of mutationsList) { if (mutation.type === 'childList') { mute() } else if (mutation.type === 'attributes') { console.log('The ' + mutation.attributeName + ' attribute was modified.'); } } }; const observer = new MutationObserver(callback); observer.observe(targetNode, config);})();
@blipp

This comment has been minimized.

Copy link
Owner Author

blipp commented Apr 29, 2020

Mute BigBlueButton background music

The free and open source video conferencing system BigBlueButton [1] allows to configure a background music to be streamed when only one person is in a session [2]. The above JavaScript bookmarklet allows to mute sound of the room while only one person is in the room, and thus cutting off the background music. It has only been tested in Firefox, but might work in any other browser.

How to use

  • Create a new bookmark and put the code above in its location field. The best is to place this bookmark in a well-reachable position, like in your bookmark toolbar.
  • Click on the bookmark as soon as you entered the room and if you hear the music. If someone joins the room, audio will turn on again.

This is implemented by simply watching the part of the website's DOM which lists the users in the left sidebar. It's not perfect, you might hear several seconds of the background music before and after someone joins. If it does not work for you, try to find out if the CSS selectors still match those actually used by the page.

[1] https://bigbluebutton.org/
[2] https://docs.bigbluebutton.org/2.2/customize.html#enable-background-music-when-only-one-person-is-in-a-session

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.