Skip to content

Instantly share code, notes, and snippets.

@cketti
Created January 27, 2021 11:49
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cketti/f0ed9b722d04618b33a7269d030e1072 to your computer and use it in GitHub Desktop.
Save cketti/f0ed9b722d04618b33a7269d030e1072 to your computer and use it in GitHub Desktop.
Jitsi Meet startWithAudioMuted/startWithVideoMuted temporary fix
# …
# Allow access to /etc/jitsi/meet/start_muted.html
<Directory "/etc/jitsi/meet">
<FilesMatch "start_muted.html">
Require all granted
</FilesMatch>
</Directory>
RewriteEngine on
# Rewrite all room URLs that don't contain a query parameter named 'start_muted_fix'
RewriteCond %{QUERY_STRING} !start_muted_fix
RewriteRule ^/([a-zA-Z0-9]+)$ /etc/jitsi/meet/start_muted.html [L]
RewriteRule ^/([a-zA-Z0-9]+)$ /index.html
# …
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
</head>
<body>
<script>
const url = new URL(window.location.href);
const extraHash = 'config.startWithAudioMuted=true&config.startWithVideoMuted=true';
const extraQueryParam = 'start_muted_fix';
url.search = url.search == '' ? '?' + extraQueryParam : url.search + '&' + extraQueryParam;
url.hash = url.hash == '' ? '#' + extraHash : url.hash + '&' + extraHash;
window.location.replace(url.toString());
</script>
</body>
</html>
@agross
Copy link

agross commented Feb 15, 2021

For docker-based setups the following seems to work.

${CONFIG}/web/nginx/meet.config

--- meet-orig.conf      2021-02-16 00:12:40.195587205 +0100
+++ meet.conf   2021-02-16 00:06:59.231998470 +0100
@@ -66,6 +66,18 @@
     tcp_nodelay on;
 }

+location = /start_muted.html {
+    alias /config/start_muted.html;
+}
+
+location ~ ^/([a-zA-Z0-9-]+)$ {
+    if ($arg_start_muted_fix = '') {
+        rewrite ^/(.*)$ /start_muted.html last;
+    }
+
+    try_files $uri @root_path;
+}
+
 location ~ ^/([^/?&:'"]+)$ {
     try_files $uri @root_path;
 }

I placed start_muted.html in ${CONFIG}/web and needed to add a value to start_muted_fix to make the if above work.

-- start_muted-orig.html        2021-02-16 00:10:43.466935109 +0100
+++ start_muted.html    2021-02-15 23:48:25.304599530 +0100
@@ -8,7 +8,7 @@
       const url = new URL(window.location.href);

       const extraHash = 'config.startWithAudioMuted=true&config.startWithVideoMuted=true';
-      const extraQueryParam = 'start_muted_fix';
+      const extraQueryParam = 'start_muted_fix=42';

       url.search = url.search == '' ? '?' +  extraQueryParam : url.search + '&' + extraQueryParam;
       url.hash = url.hash == '' ? '#' + extraHash : url.hash + '&' + extraHash;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment