mirror of
https://github.com/vector-im/element-call.git
synced 2026-11-16 01:22:29 +00:00
Compare commits
183
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3c4379ce9f | ||
|
|
5399d2bec1 | ||
|
|
ede29bdf1b | ||
|
|
b5b2bd2193 | ||
|
|
21ca382306 | ||
|
|
25e379546e | ||
|
|
0443ef55d1 | ||
|
|
465c413691 | ||
|
|
6cf0e1df51 | ||
|
|
bfa20ef747 | ||
|
|
5955d22c1b | ||
|
|
ce4426858b | ||
|
|
4ec75ecda4 | ||
|
|
b51a33c4e1 | ||
|
|
c3837464a3 | ||
|
|
e7372d4c03 | ||
|
|
69eddd7846 | ||
|
|
de3e4c6a78 | ||
|
|
3abc5a0435 | ||
|
|
8e20d48b1d | ||
|
|
ff57c217aa | ||
|
|
b60e7452b7 | ||
|
|
1c03ad335c | ||
|
|
87873b726f | ||
|
|
3448a3a2ef | ||
|
|
c625fb8845 | ||
|
|
cab9698fc7 | ||
|
|
7410bd8a82 | ||
|
|
f17670b731 | ||
|
|
33a0653ea5 | ||
|
|
b1c29e9a41 | ||
|
|
ad92892063 | ||
|
|
1a827e0930 | ||
|
|
a1b37bb3c9 | ||
|
|
061d25a54c | ||
|
|
b554fa63d1 | ||
|
|
b5bcb9aeed | ||
|
|
3d3e6dcdcc | ||
|
|
43ce68e80a | ||
|
|
6d5f698357 | ||
|
|
64a5b2ee5c | ||
|
|
c0d5f2d470 | ||
|
|
4a5141406e | ||
|
|
b036d1c0c0 | ||
|
|
0cfe6cb03d | ||
|
|
8be8cf08bf | ||
|
|
9a772131b6 | ||
|
|
1cdd5d8db0 | ||
|
|
fc9e13c922 | ||
|
|
580897730a | ||
|
|
6f7dac31d6 | ||
|
|
78e4881c37 | ||
|
|
1bb342e9e1 | ||
|
|
7ca68fb5bd | ||
|
|
72e7e0f406 | ||
|
|
94a1d87813 | ||
|
|
fee54a09c3 | ||
|
|
72a327f12f | ||
|
|
7f8d8027dc | ||
|
|
cbc12b0365 | ||
|
|
414ae266ab | ||
|
|
ecca5e1e13 | ||
|
|
1d12e10628 | ||
|
|
89cabf9fa2 | ||
|
|
7ca8059b0f | ||
|
|
29ea90f800 | ||
|
|
426ea30fe1 | ||
|
|
7d6a0da6a9 | ||
|
|
ea31f073a7 | ||
|
|
b0d08cb0b5 | ||
|
|
88e5a5badb | ||
|
|
296c735500 | ||
|
|
341c508a42 | ||
|
|
78e585c5f4 | ||
|
|
81da4c9093 | ||
|
|
064a88b9c7 | ||
|
|
14fd8c179b | ||
|
|
4a146ebada | ||
|
|
a6a02778a1 | ||
|
|
662259154a | ||
|
|
978ffee183 | ||
|
|
3ace4ab5a3 | ||
|
|
2d64cf4b30 | ||
|
|
87aee1c02c | ||
|
|
f7cf674152 | ||
|
|
9d5ca297e3 | ||
|
|
c90d1d8dda | ||
|
|
dd59519a85 | ||
|
|
33fc8997f8 | ||
|
|
8aead74ab9 | ||
|
|
1e128c4da0 | ||
|
|
eb65a28a75 | ||
|
|
9d400323d0 | ||
|
|
6d7d3093b3 | ||
|
|
2b07e9e822 | ||
|
|
7ae1fc6cd8 | ||
|
|
e1df71817a | ||
|
|
608695fc95 | ||
|
|
a08a577e18 | ||
|
|
55b2d2b130 | ||
|
|
5b84b2c04d | ||
|
|
3af0744324 | ||
|
|
07567ed31d | ||
|
|
d6e097476e | ||
|
|
540eb306f4 | ||
|
|
f62428ba0d | ||
|
|
d579169d54 | ||
|
|
8daaa649eb | ||
|
|
2d5a4eefec | ||
|
|
d550430c8a | ||
|
|
78724acfcf | ||
|
|
20c7112812 | ||
|
|
a7c996f3ea | ||
|
|
4fbcbb4849 | ||
|
|
74102ac6c2 | ||
|
|
11a6fa9b45 | ||
|
|
507a6f29a5 | ||
|
|
e725bc5de3 | ||
|
|
c15d4c50a1 | ||
|
|
e1bc4a096b | ||
|
|
b524de9298 | ||
|
|
bfb5fb922f | ||
|
|
3f4d55343a | ||
|
|
73d8d2c2c3 | ||
|
|
fcfe73c50d | ||
|
|
ffb6b0a5f6 | ||
|
|
5564015a8b | ||
|
|
62eeb10d38 | ||
|
|
2de7fdde10 | ||
|
|
5a96d1769e | ||
|
|
a443a55bec | ||
|
|
9b2d9fdd1f | ||
|
|
05ad9b2475 | ||
|
|
7962d02be5 | ||
|
|
5c35288162 | ||
|
|
aa6732da19 | ||
|
|
65ac11e952 | ||
|
|
0b21cff020 | ||
|
|
062e0a00fb | ||
|
|
53ae78c609 | ||
|
|
b046c4b569 | ||
|
|
46cb89b232 | ||
|
|
e20abb19fb | ||
|
|
bf76f47357 | ||
|
|
9c2d3d067d | ||
|
|
ae7ede3201 | ||
|
|
e5ff431b7a | ||
|
|
66a676f2f5 | ||
|
|
d33dedd038 | ||
|
|
1f2837f86a | ||
|
|
927cf68110 | ||
|
|
cd72ad0008 | ||
|
|
2d2e85e340 | ||
|
|
4da1b9a02a | ||
|
|
73758f7f77 | ||
|
|
c433c36687 | ||
|
|
3e9d7b7cf7 | ||
|
|
2a56d2afb8 | ||
|
|
bff41ad66a | ||
|
|
1d088911e1 | ||
|
|
f23eb96555 | ||
|
|
0d4e7defb6 | ||
|
|
023aec22ca | ||
|
|
bf4cee9898 | ||
|
|
147ff131f4 | ||
|
|
3e5edd03a6 | ||
|
|
49a762832b | ||
|
|
3cf5cab1d2 | ||
|
|
1811b36205 | ||
|
|
9ef3499418 | ||
|
|
08d9982981 | ||
|
|
9a2fc883b6 | ||
|
|
79b9335192 | ||
|
|
dedf4e158e | ||
|
|
8642646fa7 | ||
|
|
98f63c7172 | ||
|
|
297470ac2e | ||
|
|
b043230680 | ||
|
|
bc38d15b6d | ||
|
|
342b61f633 | ||
|
|
390dc22c96 | ||
|
|
2a3271b8b3 | ||
|
|
f45aa85aef |
@@ -9,7 +9,7 @@ on:
|
|||||||
- opened
|
- opened
|
||||||
- labeled
|
- labeled
|
||||||
push:
|
push:
|
||||||
branches: [livekit]
|
branches: [main]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
versioning:
|
versioning:
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ on:
|
|||||||
|
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- livekit
|
- main
|
||||||
paths:
|
paths:
|
||||||
- .github/labels.yml
|
- .github/labels.yml
|
||||||
- .github/workflows/sync-labels.yml
|
- .github/workflows/sync-labels.yml
|
||||||
|
|
||||||
permissions: {} # We use ELEMENT_BOT_TOKEN instead
|
permissions: {} # We use LABEL_SYNC_GITHUB_TOKEN instead
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
sync-labels:
|
sync-labels:
|
||||||
@@ -20,4 +20,4 @@ jobs:
|
|||||||
DELETE: true
|
DELETE: true
|
||||||
WET: true
|
WET: true
|
||||||
secrets:
|
secrets:
|
||||||
ELEMENT_BOT_TOKEN: ${{ secrets.ELEMENT_BOT_TOKEN }}
|
ELEMENT_BOT_TOKEN: ${{ secrets.LABEL_SYNC_GITHUB_TOKEN }}
|
||||||
|
|||||||
@@ -2,15 +2,11 @@ name: Test
|
|||||||
on:
|
on:
|
||||||
pull_request: {}
|
pull_request: {}
|
||||||
push:
|
push:
|
||||||
branches: [livekit]
|
branches: [main]
|
||||||
jobs:
|
jobs:
|
||||||
vitest:
|
vitest:
|
||||||
name: Run unit tests
|
name: Run unit tests
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
# Make sure to grab the latest version of the Playwright image
|
|
||||||
# https://playwright.dev/docs/docker#pull-the-image
|
|
||||||
image: mcr.microsoft.com/playwright:v1.61.1-noble
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4
|
||||||
@@ -26,6 +22,18 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
# ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present)
|
# ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present)
|
||||||
run: "pnpm install --frozen-lockfile --ignore-pnpmfile"
|
run: "pnpm install --frozen-lockfile --ignore-pnpmfile"
|
||||||
|
- name: Get Playwright version
|
||||||
|
run: echo "PLAYWRIGHT_VERSION=$(pnpm list @playwright/test --depth=0 --json | jq -r '.[0].devDependencies["@playwright/test"].version')" >> $GITHUB_ENV
|
||||||
|
- name: Cache Playwright binaries
|
||||||
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
|
id: playwright-cache
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/ms-playwright
|
||||||
|
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
|
||||||
|
- name: Install Playwright binaries
|
||||||
|
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
||||||
|
run: pnpm playwright install --with-deps
|
||||||
- name: Vitest
|
- name: Vitest
|
||||||
run: "pnpm run test:coverage"
|
run: "pnpm run test:coverage"
|
||||||
- name: Upload to codecov
|
- name: Upload to codecov
|
||||||
@@ -52,12 +60,22 @@ jobs:
|
|||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
# ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present)
|
# ignore-pnpmfile should never be commited. Make CI crash if it happened (`pnpmfileChecksum` is present)
|
||||||
run: pnpm install --frozen-lockfile --ignore-pnpmfile
|
run: pnpm install --frozen-lockfile --ignore-pnpmfile
|
||||||
- name: Install Playwright Browsers
|
- name: Get Playwright version
|
||||||
run: pnpm exec playwright install --with-deps
|
run: echo "PLAYWRIGHT_VERSION=$(pnpm list @playwright/test --depth=0 --json | jq -r '.[0].devDependencies["@playwright/test"].version')" >> $GITHUB_ENV
|
||||||
|
- name: Cache Playwright binaries
|
||||||
|
uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6
|
||||||
|
id: playwright-cache
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
~/.cache/ms-playwright
|
||||||
|
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}
|
||||||
|
- name: Install Playwright binaries
|
||||||
|
if: steps.playwright-cache.outputs.cache-hit != 'true'
|
||||||
|
run: pnpm playwright install --with-deps
|
||||||
- name: Run backend components
|
- name: Run backend components
|
||||||
run: |
|
run: |
|
||||||
docker compose -f playwright-backend-docker-compose.yml -f playwright-backend-docker-compose.override.yml pull
|
docker compose -f docker-compose-dev.yml -f docker-compose-playwright.yml pull
|
||||||
docker compose -f playwright-backend-docker-compose.yml -f playwright-backend-docker-compose.override.yml up -d
|
docker compose -f docker-compose-dev.yml -f docker-compose-playwright.yml up -d
|
||||||
docker ps
|
docker ps
|
||||||
- name: Run Playwright tests
|
- name: Run Playwright tests
|
||||||
env:
|
env:
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ jobs:
|
|||||||
- name: Fix the owner of the downloaded files
|
- name: Fix the owner of the downloaded files
|
||||||
run: "sudo chown runner:docker -R locales"
|
run: "sudo chown runner:docker -R locales"
|
||||||
|
|
||||||
|
# Localazy doesn't write file contents in the same order that i18next-cli's
|
||||||
|
# extractor uses. We re-run the extractor after downloading to fix the order.
|
||||||
|
- name: i18n
|
||||||
|
run: pnpm i18n
|
||||||
|
|
||||||
- name: Formatting
|
- name: Formatting
|
||||||
run: pnpm format
|
run: pnpm format
|
||||||
|
|
||||||
@@ -53,7 +58,7 @@ jobs:
|
|||||||
title: Localazy Download
|
title: Localazy Download
|
||||||
commit-message: Translations updates
|
commit-message: Translations updates
|
||||||
labels: |
|
labels: |
|
||||||
T-Task
|
PR-Task
|
||||||
|
|
||||||
- name: Enable automerge
|
- name: Enable automerge
|
||||||
run: gh pr merge --merge --auto "$PR_NUMBER"
|
run: gh pr merge --merge --auto "$PR_NUMBER"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: Upload translation files to Localazy
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- livekit
|
- main
|
||||||
paths-ignore:
|
paths-ignore:
|
||||||
- ".github/**"
|
- ".github/**"
|
||||||
|
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ name: GitHub Actions Security Analysis with zizmor 🌈
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["livekit", "full-mesh"]
|
branches: ["main", "full-mesh"]
|
||||||
pull_request: {}
|
pull_request: {}
|
||||||
|
|
||||||
permissions: {}
|
permissions: {}
|
||||||
|
|||||||
@@ -115,30 +115,33 @@ For more details on the packages, see the
|
|||||||
For operating and deploying Element Call on your own server, refer to the
|
For operating and deploying Element Call on your own server, refer to the
|
||||||
[**Self-Hosting Guide**](./docs/self_hosting.md).
|
[**Self-Hosting Guide**](./docs/self_hosting.md).
|
||||||
|
|
||||||
## 🧭 MatrixRTC Backend Discovery and Selection
|
## MatrixRTC Transports
|
||||||
|
|
||||||
For proper Element Call operation each site deployment needs a MatrixRTC backend
|
For proper operation of Element Call, each deployment needs to set up a
|
||||||
setup as outlined in the [Self-Hosting Guide](./docs/self_hosting.md). A typical
|
MatrixRTC transport in the form of a LiveKit server as outlined in the
|
||||||
federated site deployment for three different sites A, B and C is depicted below.
|
[Self-Hosting Guide](./docs/self_hosting.md). A typical federated site
|
||||||
|
deployment for three different sites A, B and C is depicted below.
|
||||||
|
|
||||||
<p align="center">
|
<p align="center">
|
||||||
<img src="./docs/Federated_Setup.drawio.png" alt="Element Call federated setup">
|
<img src="./docs/Federated_Setup.drawio.png" alt="Element Call federated setup">
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
### Backend Discovery
|
### Transport Discovery
|
||||||
|
|
||||||
The MatrixRTC backend (according to
|
Element Call discovers the available MatrixRTC transports (as defined by
|
||||||
[MSC4143](https://github.com/matrix-org/matrix-spec-proposals/pull/4143)) is
|
[MSC4519](https://github.com/matrix-org/matrix-spec-proposals/pull/4519)) by
|
||||||
announced by the Matrix site's `.well-known/matrix/client` file and discovered
|
hitting the `GET /_matrix/client/unstable/org.matrix.msc4143/rtc/transports`
|
||||||
via the `org.matrix.msc4143.rtc_foci` key, e.g.:
|
endpoint of the Client-Server API. An example response:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
"org.matrix.msc4143.rtc_foci": [
|
{
|
||||||
|
"rtc_transports": [
|
||||||
{
|
{
|
||||||
"type": "livekit",
|
"type": "livekit",
|
||||||
"livekit_service_url": "https://matrix-rtc.example.com/livekit/jwt"
|
"livekit_service_url": "https://matrix-rtc.example.com/livekit/jwt"
|
||||||
},
|
}
|
||||||
]
|
]
|
||||||
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
where the format for MatrixRTC using LiveKit backend is defined in
|
where the format for MatrixRTC using LiveKit backend is defined in
|
||||||
@@ -149,7 +152,7 @@ via `livekit_service_url`.
|
|||||||
|
|
||||||
### Backend Selection
|
### Backend Selection
|
||||||
|
|
||||||
- Each call participant proposes their discovered MatrixRTC backend from
|
- Each call participant proposes their discovered MatrixRTC transport from
|
||||||
`org.matrix.msc4143.rtc_foci` in their `org.matrix.msc3401.call.member` state event.
|
`org.matrix.msc4143.rtc_foci` in their `org.matrix.msc3401.call.member` state event.
|
||||||
- For the **LiveKit** MatrixRTC backend
|
- For the **LiveKit** MatrixRTC backend
|
||||||
([MSC4195](https://github.com/hughns/matrix-spec-proposals/blob/hughns/matrixrtc-livekit/proposals/4195-matrixrtc-livekit.md)),
|
([MSC4195](https://github.com/hughns/matrix-spec-proposals/blob/hughns/matrixrtc-livekit/proposals/4195-matrixrtc-livekit.md)),
|
||||||
@@ -212,7 +215,7 @@ See also:
|
|||||||
|
|
||||||
### Backend
|
### Backend
|
||||||
|
|
||||||
A docker compose file `dev-backend-docker-compose.yml` is provided to start the
|
A docker compose file `docker-compose-dev.yml` is provided to start the
|
||||||
whole stack of components which is required for a local development environment
|
whole stack of components which is required for a local development environment
|
||||||
including federation:
|
including federation:
|
||||||
|
|
||||||
@@ -239,15 +242,14 @@ the backend components:
|
|||||||
```sh
|
```sh
|
||||||
pnpm backend
|
pnpm backend
|
||||||
# or for podman-compose:
|
# or for podman-compose:
|
||||||
# podman-compose -f dev-backend-docker-compose.yml up
|
# podman-compose -f docker-compose-dev.yml up
|
||||||
```
|
```
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
> To ensure your local development frontend functions properly, you’ll need to
|
> To ensure your local development frontend functions properly, you’ll need to
|
||||||
> add certificate exceptions in your browser for `https://localhost:3000`,
|
> add certificate exceptions in your browser for `https://localhost:3000` and
|
||||||
> `https://matrix-rtc.m.localhost/livekit/jwt/healthz` and
|
> `https://matrix-rtc.m.localhost/livekit/jwt/healthz`. This can be done either
|
||||||
> `https://synapse.m.localhost/.well-known/matrix/client`. This can be either
|
> by adding the minimum localhost CA
|
||||||
> done by adding the minimum localhost CA
|
|
||||||
> ([./backend/dev_tls_local-ca.crt](./backend/dev_tls_local-ca.crt)) to your web
|
> ([./backend/dev_tls_local-ca.crt](./backend/dev_tls_local-ca.crt)) to your web
|
||||||
> browser's trusted certificates or by simply copying and pasting each URL into
|
> browser's trusted certificates or by simply copying and pasting each URL into
|
||||||
> your browser’s address bar and follow the prompts to add the exception.
|
> your browser’s address bar and follow the prompts to add the exception.
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ experimental_features:
|
|||||||
msc4222_enabled: true
|
msc4222_enabled: true
|
||||||
# sticky events for MatrixRTC user state
|
# sticky events for MatrixRTC user state
|
||||||
msc4354_enabled: true
|
msc4354_enabled: true
|
||||||
|
# MatrixRTC
|
||||||
|
msc4143_enabled: true
|
||||||
|
|
||||||
# The maximum allowed duration by which sent events can be delayed, as
|
# The maximum allowed duration by which sent events can be delayed, as
|
||||||
# per MSC4140. Must be a positive value if set. Defaults to no
|
# per MSC4140. Must be a positive value if set. Defaults to no
|
||||||
@@ -54,7 +56,6 @@ enable_registration_without_verification: true
|
|||||||
registration_shared_secret: "test_shared_secret_for_local_dev_only"
|
registration_shared_secret: "test_shared_secret_for_local_dev_only"
|
||||||
|
|
||||||
report_stats: false
|
report_stats: false
|
||||||
serve_server_wellknown: true
|
|
||||||
|
|
||||||
# Ratelimiting settings for client actions (registration, login, messaging).
|
# Ratelimiting settings for client actions (registration, login, messaging).
|
||||||
#
|
#
|
||||||
@@ -67,3 +68,8 @@ rc_message:
|
|||||||
# Currently the heart-beat is every 5 seconds which translates into a rate of 0.2s
|
# Currently the heart-beat is every 5 seconds which translates into a rate of 0.2s
|
||||||
per_second: 0.5
|
per_second: 0.5
|
||||||
burst_count: 30
|
burst_count: 30
|
||||||
|
|
||||||
|
matrix_rtc:
|
||||||
|
transports:
|
||||||
|
- type: livekit
|
||||||
|
livekit_service_url: https://matrix-rtc.othersite.m.localhost/livekit/jwt
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ experimental_features:
|
|||||||
msc4222_enabled: true
|
msc4222_enabled: true
|
||||||
# sticky events for MatrixRTC user state
|
# sticky events for MatrixRTC user state
|
||||||
msc4354_enabled: true
|
msc4354_enabled: true
|
||||||
|
# MatrixRTC
|
||||||
|
msc4143_enabled: true
|
||||||
|
|
||||||
# The maximum allowed duration by which sent events can be delayed, as
|
# The maximum allowed duration by which sent events can be delayed, as
|
||||||
# per MSC4140. Must be a positive value if set. Defaults to no
|
# per MSC4140. Must be a positive value if set. Defaults to no
|
||||||
@@ -54,7 +56,6 @@ enable_registration_without_verification: true
|
|||||||
registration_shared_secret: "test_shared_secret_for_local_dev_only"
|
registration_shared_secret: "test_shared_secret_for_local_dev_only"
|
||||||
|
|
||||||
report_stats: false
|
report_stats: false
|
||||||
serve_server_wellknown: true
|
|
||||||
|
|
||||||
# Ratelimiting settings for client actions (registration, login, messaging).
|
# Ratelimiting settings for client actions (registration, login, messaging).
|
||||||
#
|
#
|
||||||
@@ -67,3 +68,8 @@ rc_message:
|
|||||||
# Currently the heart-beat is every 5 seconds which translates into a rate of 0.2s
|
# Currently the heart-beat is every 5 seconds which translates into a rate of 0.2s
|
||||||
per_second: 0.5
|
per_second: 0.5
|
||||||
burst_count: 30
|
burst_count: 30
|
||||||
|
|
||||||
|
matrix_rtc:
|
||||||
|
transports:
|
||||||
|
- type: livekit
|
||||||
|
livekit_service_url: https://matrix-rtc.m.localhost/livekit/jwt
|
||||||
|
|||||||
+2
-26
@@ -1,4 +1,4 @@
|
|||||||
# Synapse reverse proxy including .well-known/matrix/client
|
# Synapse reverse proxy
|
||||||
# domain synapse.m.localhost
|
# domain synapse.m.localhost
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
@@ -11,18 +11,6 @@ server {
|
|||||||
ssl_certificate /root/ssl/cert.pem;
|
ssl_certificate /root/ssl/cert.pem;
|
||||||
ssl_certificate_key /root/ssl/key.pem;
|
ssl_certificate_key /root/ssl/key.pem;
|
||||||
|
|
||||||
# well-known config adding rtc_foci backend
|
|
||||||
# Note well-known is currently not effective due to:
|
|
||||||
# https://spec.matrix.org/v1.12/client-server-api/#well-known-uri the spec
|
|
||||||
# says it must be at https://$server_name/... (implied port 443) Hence, we
|
|
||||||
# currently rely for local development environment on deprecated config.json
|
|
||||||
# setting for livekit_service_url
|
|
||||||
location /.well-known/matrix/client {
|
|
||||||
add_header Access-Control-Allow-Origin *;
|
|
||||||
return 200 '{"m.homeserver": {"base_url": "https://synapse.m.localhost"}, "org.matrix.msc4143.rtc_foci": [{"type": "livekit", "livekit_service_url": "https://matrix-rtc.m.localhost/livekit/jwt"}]}';
|
|
||||||
default_type application/json;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Reverse proxy for Matrix Synapse Homeserver
|
# Reverse proxy for Matrix Synapse Homeserver
|
||||||
# This is also required for development environment.
|
# This is also required for development environment.
|
||||||
# Reason: the lk-jwt-service uses the federation API for the openid token
|
# Reason: the lk-jwt-service uses the federation API for the openid token
|
||||||
@@ -44,7 +32,7 @@ server {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# Synapse reverse proxy including .well-known/matrix/client
|
# Synapse reverse proxy
|
||||||
# domain synapse.othersite.m.localhost
|
# domain synapse.othersite.m.localhost
|
||||||
server {
|
server {
|
||||||
listen 80;
|
listen 80;
|
||||||
@@ -57,18 +45,6 @@ server {
|
|||||||
ssl_certificate /root/ssl/cert.pem;
|
ssl_certificate /root/ssl/cert.pem;
|
||||||
ssl_certificate_key /root/ssl/key.pem;
|
ssl_certificate_key /root/ssl/key.pem;
|
||||||
|
|
||||||
# well-known config adding rtc_foci backend
|
|
||||||
# Note well-known is currently not effective due to:
|
|
||||||
# https://spec.matrix.org/v1.12/client-server-api/#well-known-uri the spec
|
|
||||||
# says it must be at https://$server_name/... (implied port 443) Hence, we
|
|
||||||
# currently rely for local development environment on deprecated config.json
|
|
||||||
# setting for livekit_service_url
|
|
||||||
location /.well-known/matrix/client {
|
|
||||||
add_header Access-Control-Allow-Origin *;
|
|
||||||
return 200 '{"m.homeserver": {"base_url": "https://synapse.othersite.m.localhost"}, "org.matrix.msc4143.rtc_foci": [{"type": "livekit", "livekit_service_url": "https://matrix-rtc.othersite.m.localhost/livekit/jwt"}]}';
|
|
||||||
default_type application/json;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Reverse proxy for Matrix Synapse Homeserver
|
# Reverse proxy for Matrix Synapse Homeserver
|
||||||
# This is also required for development environment.
|
# This is also required for development environment.
|
||||||
# Reason: the lk-jwt-service uses the federation API for the openid token
|
# Reason: the lk-jwt-service uses the federation API for the openid token
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ experimental_features:
|
|||||||
msc4222_enabled: true
|
msc4222_enabled: true
|
||||||
# sticky events for MatrixRTC user state
|
# sticky events for MatrixRTC user state
|
||||||
msc4354_enabled: true
|
msc4354_enabled: true
|
||||||
|
# MatrixRTC
|
||||||
|
msc4143_enabled: true
|
||||||
|
|
||||||
# The maximum allowed duration by which sent events can be delayed, as
|
# The maximum allowed duration by which sent events can be delayed, as
|
||||||
# per MSC4140. Must be a positive value if set. Defaults to no
|
# per MSC4140. Must be a positive value if set. Defaults to no
|
||||||
@@ -54,7 +56,6 @@ enable_registration_without_verification: true
|
|||||||
registration_shared_secret: "test_shared_secret_for_local_dev_only"
|
registration_shared_secret: "test_shared_secret_for_local_dev_only"
|
||||||
|
|
||||||
report_stats: false
|
report_stats: false
|
||||||
serve_server_wellknown: true
|
|
||||||
|
|
||||||
# Ratelimiting settings for client actions (registration, login, messaging).
|
# Ratelimiting settings for client actions (registration, login, messaging).
|
||||||
#
|
#
|
||||||
@@ -84,3 +85,8 @@ rc_login:
|
|||||||
rc_registration:
|
rc_registration:
|
||||||
per_second: 10000
|
per_second: 10000
|
||||||
burst_count: 10000
|
burst_count: 10000
|
||||||
|
|
||||||
|
matrix_rtc:
|
||||||
|
transports:
|
||||||
|
- type: livekit
|
||||||
|
livekit_service_url: https://matrix-rtc.othersite.m.localhost/livekit/jwt
|
||||||
|
|||||||
@@ -40,6 +40,8 @@ experimental_features:
|
|||||||
msc4222_enabled: true
|
msc4222_enabled: true
|
||||||
# sticky events for MatrixRTC user state
|
# sticky events for MatrixRTC user state
|
||||||
msc4354_enabled: true
|
msc4354_enabled: true
|
||||||
|
# MatrixRTC
|
||||||
|
msc4143_enabled: true
|
||||||
|
|
||||||
# The maximum allowed duration by which sent events can be delayed, as
|
# The maximum allowed duration by which sent events can be delayed, as
|
||||||
# per MSC4140. Must be a positive value if set. Defaults to no
|
# per MSC4140. Must be a positive value if set. Defaults to no
|
||||||
@@ -54,7 +56,6 @@ enable_registration_without_verification: true
|
|||||||
registration_shared_secret: "test_shared_secret_for_local_dev_only"
|
registration_shared_secret: "test_shared_secret_for_local_dev_only"
|
||||||
|
|
||||||
report_stats: false
|
report_stats: false
|
||||||
serve_server_wellknown: true
|
|
||||||
|
|
||||||
# Ratelimiting settings for client actions (registration, login, messaging).
|
# Ratelimiting settings for client actions (registration, login, messaging).
|
||||||
#
|
#
|
||||||
@@ -84,3 +85,8 @@ rc_login:
|
|||||||
rc_registration:
|
rc_registration:
|
||||||
per_second: 10000
|
per_second: 10000
|
||||||
burst_count: 10000
|
burst_count: 10000
|
||||||
|
|
||||||
|
matrix_rtc:
|
||||||
|
transports:
|
||||||
|
- type: livekit
|
||||||
|
livekit_service_url: https://matrix-rtc.m.localhost/livekit/jwt
|
||||||
|
|||||||
@@ -5,9 +5,6 @@
|
|||||||
"server_name": "synapse.m.localhost"
|
"server_name": "synapse.m.localhost"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"features": {
|
|
||||||
"feature_use_device_session_member_events": true
|
|
||||||
},
|
|
||||||
"ssla": "https://static.element.io/legal/element-software-and-services-license-agreement-uk-1.pdf",
|
"ssla": "https://static.element.io/legal/element-software-and-services-license-agreement-uk-1.pdf",
|
||||||
"matrix_rtc_session": {
|
"matrix_rtc_session": {
|
||||||
"wait_for_key_rotation_ms": 3000,
|
"wait_for_key_rotation_ms": 3000,
|
||||||
|
|||||||
@@ -8,9 +8,6 @@
|
|||||||
"livekit": {
|
"livekit": {
|
||||||
"livekit_service_url": "https://livekit-jwt.mydomain.com"
|
"livekit_service_url": "https://livekit-jwt.mydomain.com"
|
||||||
},
|
},
|
||||||
"features": {
|
|
||||||
"feature_use_device_session_member_events": true
|
|
||||||
},
|
|
||||||
"ssla": "https://static.element.io/legal/element-software-and-services-license-agreement-uk-1.pdf",
|
"ssla": "https://static.element.io/legal/element-software-and-services-license-agreement-uk-1.pdf",
|
||||||
"matrix_rtc_mode": "compatibility",
|
"matrix_rtc_mode": "compatibility",
|
||||||
"matrix_rtc_session": {
|
"matrix_rtc_session": {
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ services:
|
|||||||
- ecbackend
|
- ecbackend
|
||||||
|
|
||||||
livekit:
|
livekit:
|
||||||
image: livekit/livekit-server:v1.10.1
|
image: livekit/livekit-server:v1.13.4
|
||||||
pull_policy: always
|
pull_policy: always
|
||||||
hostname: livekit-sfu
|
hostname: livekit-sfu
|
||||||
command: --dev --config /etc/livekit.yaml
|
command: --dev --config /etc/livekit.yaml
|
||||||
@@ -70,7 +70,7 @@ services:
|
|||||||
- ecbackend
|
- ecbackend
|
||||||
|
|
||||||
livekit-1:
|
livekit-1:
|
||||||
image: livekit/livekit-server:v1.10.1
|
image: livekit/livekit-server:v1.13.4
|
||||||
pull_policy: always
|
pull_policy: always
|
||||||
hostname: livekit-sfu-1
|
hostname: livekit-sfu-1
|
||||||
command: --dev --config /etc/livekit.yaml
|
command: --dev --config /etc/livekit.yaml
|
||||||
@@ -156,7 +156,7 @@ services:
|
|||||||
nginx:
|
nginx:
|
||||||
# see backend/dev_tls_setup for how to generate the tls certs
|
# see backend/dev_tls_setup for how to generate the tls certs
|
||||||
hostname: synapse.m.localhost
|
hostname: synapse.m.localhost
|
||||||
image: nginx:latest
|
image: nginx:latest@sha256:4ae259ae64fbedb67918c07d167fdcb0e05855a1615480ca445bea485e7d65ff
|
||||||
pull_policy: always
|
pull_policy: always
|
||||||
volumes:
|
volumes:
|
||||||
- ./backend/dev_nginx.conf:/etc/nginx/conf.d/default.conf:Z
|
- ./backend/dev_nginx.conf:/etc/nginx/conf.d/default.conf:Z
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# This file contains overrides to docker-compose-dev.yml and should
|
||||||
|
# only be used in combination with that file.
|
||||||
|
services:
|
||||||
|
synapse:
|
||||||
|
# Pin to a SHA so that upstream cannot break our tests. Renovate handles regular updates.
|
||||||
|
image: ghcr.io/element-hq/synapse:latest@sha256:da325af40104051923899e5f5a2f1d537e6e3ccf2f0f38285689ae9bbfdb190a
|
||||||
|
volumes:
|
||||||
|
- ./backend/playwright_homeserver.yaml:/data/cfg/homeserver.yaml:Z
|
||||||
|
synapse-1:
|
||||||
|
# Pin to a SHA so that upstream cannot break our tests. Renovate handles regular updates.
|
||||||
|
image: ghcr.io/element-hq/synapse:latest@sha256:da325af40104051923899e5f5a2f1d537e6e3ccf2f0f38285689ae9bbfdb190a
|
||||||
|
volumes:
|
||||||
|
- ./backend/playwright_homeserver-othersite.yaml:/data/cfg/homeserver.yaml:Z
|
||||||
|
element-web:
|
||||||
|
# Pin to a SHA so that upstream cannot break our tests. Renovate handles regular updates.
|
||||||
|
image: ghcr.io/element-hq/element-web:develop@sha256:0332028836603e91689053f157847b4deef9342bd19e3195eeb81793b7e4046e
|
||||||
|
element-web-1:
|
||||||
|
# Pin to a SHA so that upstream cannot break our tests. Renovate handles regular updates.
|
||||||
|
image: ghcr.io/element-hq/element-web:develop@sha256:0332028836603e91689053f157847b4deef9342bd19e3195eeb81793b7e4046e
|
||||||
@@ -5,5 +5,6 @@ This folder contains documentation for setup, usage, and development of Element
|
|||||||
- [Embedded vs standalone mode](./embedded_standalone.md)
|
- [Embedded vs standalone mode](./embedded_standalone.md)
|
||||||
- [Url format and parameters](./url_params.md)
|
- [Url format and parameters](./url_params.md)
|
||||||
- [Global JS controls](./controls.md)
|
- [Global JS controls](./controls.md)
|
||||||
|
- [MatrixRTC modes](./matrix_rtc_modes.md)
|
||||||
- [Self-Hosting](./self_hosting.md)
|
- [Self-Hosting](./self_hosting.md)
|
||||||
- [Developing with linked packages](./linking.md)
|
- [Developing with linked packages](./linking.md)
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
# MatrixRTC modes
|
||||||
|
|
||||||
|
Element Call is in the middle of a transition of how a call session is
|
||||||
|
represented: from room _state_ events (`org.matrix.msc3401.call.member`) to
|
||||||
|
_sticky_ events
|
||||||
|
([MSC4354](https://github.com/matrix-org/matrix-spec-proposals/pull/4354)),
|
||||||
|
which are a much better fit for the short lived, per-device nature of call
|
||||||
|
memberships.
|
||||||
|
|
||||||
|
Not every homeserver supports sticky events yet. The two MatrixRTC modes
|
||||||
|
controls whether Element Call uses them.
|
||||||
|
|
||||||
|
## The modes
|
||||||
|
|
||||||
|
| Mode | Membership events | SFU selection | JWT endpoint |
|
||||||
|
| --------------- | ----------------- | ------------- | ---------------------------- |
|
||||||
|
| `compatibility` | state events | multi SFU | legacy |
|
||||||
|
| `matrix_2_0` | sticky events | multi SFU | Matrix 2.0 (hashed identity) |
|
||||||
|
|
||||||
|
**`compatibility`** — multi SFU, but still state events. Use it when the
|
||||||
|
homeserver does not support sticky events. This is the default.
|
||||||
|
|
||||||
|
**`matrix_2_0`** — the target state. Requires a homeserver that advertises
|
||||||
|
MSC4354 and all clients on v0.17.0 or later. The local membership requests its
|
||||||
|
token from the Matrix 2.0 JWT endpoint of the
|
||||||
|
[MatrixRTC Authorization Service](https://github.com/element-hq/lk-jwt-service)
|
||||||
|
and identifies the room by a hashed identity instead of a `livekit_alias`.
|
||||||
|
(Remote memberships always try the new endpoint first and fall back to the
|
||||||
|
legacy one, so remote participants can be on either.)
|
||||||
|
|
||||||
|
## Selecting a mode
|
||||||
|
|
||||||
|
Users can choose a mode under **Settings → Developer → MatrixRTC mode**. The
|
||||||
|
Matrix 2.0 option is disabled if the homeserver does not support sticky events.
|
||||||
|
|
||||||
|
A deployment can pin the mode for all its clients in `config.json`, which
|
||||||
|
disables the Developer Settings choice:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{
|
||||||
|
"matrix_rtc_mode": "compatibility"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
Valid values are `compatibility` and `matrix_2_0`; an invalid value is
|
||||||
|
ignored (with a warning) and the user's choice applies. Pinning `matrix_2_0` on a
|
||||||
|
homeserver without sticky event support makes joining fail with a "sticky events
|
||||||
|
required" error.
|
||||||
+28
-49
@@ -16,7 +16,7 @@
|
|||||||
The following [MSCs](https://github.com/matrix-org/matrix-spec-proposals) are
|
The following [MSCs](https://github.com/matrix-org/matrix-spec-proposals) are
|
||||||
required for Element Call to work properly:
|
required for Element Call to work properly:
|
||||||
|
|
||||||
- **[MSC3266](https://github.com/deepbluev7/matrix-doc/blob/room-summaries/proposals/3266-room-summary.md):
|
- **[MSC3266](https://github.com/deepbluev7/matrix-doc/blob/room-summaries/proposals/3266-room-summary.md)
|
||||||
Room Summary API**: In Standalone mode Element Call is able to join rooms
|
Room Summary API**: In Standalone mode Element Call is able to join rooms
|
||||||
over federation using knocking. In this context MSC3266 is required as it
|
over federation using knocking. In this context MSC3266 is required as it
|
||||||
allows to request a room summary of rooms you are not joined. The summary
|
allows to request a room summary of rooms you are not joined. The summary
|
||||||
@@ -29,19 +29,26 @@ required for Element Call to work properly:
|
|||||||
signalling. If disabled it is very likely that you end up with stuck calls in
|
signalling. If disabled it is very likely that you end up with stuck calls in
|
||||||
Matrix rooms.
|
Matrix rooms.
|
||||||
|
|
||||||
|
- **[MSC4519](https://github.com/matrix-org/matrix-spec-proposals/blob/travis/msc/voip-transports-registry/proposals/4519-rtc-transports-registry.md)
|
||||||
|
MatrixRTC Transports Registry**: Defines an endpoint that clients can use to
|
||||||
|
query the available MatrixRTC transports (i.e. find your LiveKit SFU).
|
||||||
|
|
||||||
- **[MSC4222](https://github.com/matrix-org/matrix-spec-proposals/blob/erikj/sync_v2_state_after/proposals/4222-sync-v2-state-after.md)
|
- **[MSC4222](https://github.com/matrix-org/matrix-spec-proposals/blob/erikj/sync_v2_state_after/proposals/4222-sync-v2-state-after.md)
|
||||||
Adding `state_after` to sync v2**: Allow clients to opt-in to a change of the
|
Adding `state_after` to sync v2**: Allow clients to opt-in to a change of the
|
||||||
sync v2 API that allows them to correctly track the state of the room. This is
|
sync v2 API that allows them to correctly track the state of the room. This is
|
||||||
required by Element Call to track room state reliably.
|
required by Element Call to track room state reliably.
|
||||||
|
|
||||||
If you're using [Synapse](https://github.com/element-hq/synapse/) as your
|
If you're using [Synapse](https://github.com/element-hq/synapse/) as your
|
||||||
homeserver, you'll need to additionally add the following config items to
|
homeserver, you can configure these features by adding the following entries to
|
||||||
`homeserver.yaml` to comply with Element Call:
|
`homeserver.yaml`:
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
experimental_features:
|
experimental_features:
|
||||||
# MSC3266: Room summary API. Used for knocking over federation
|
# MSC3266: Room summary API. Used for knocking over federation
|
||||||
msc3266_enabled: true
|
msc3266_enabled: true
|
||||||
|
# MSC4143: MatrixRTC. For historical reasons this flag enables the transports
|
||||||
|
# endpoint defined in MSC4519.
|
||||||
|
msc4143_enabled: true
|
||||||
# MSC4222 needed for syncv2 state_after. This allow clients to
|
# MSC4222 needed for syncv2 state_after. This allow clients to
|
||||||
# correctly track the state of the room.
|
# correctly track the state of the room.
|
||||||
msc4222_enabled: true
|
msc4222_enabled: true
|
||||||
@@ -61,6 +68,15 @@ rc_delayed_event_mgmt:
|
|||||||
# Currently the heart-beat is every 5 seconds which translates into a rate of 0.2Hz
|
# Currently the heart-beat is every 5 seconds which translates into a rate of 0.2Hz
|
||||||
per_second: 1
|
per_second: 1
|
||||||
burst_count: 20
|
burst_count: 20
|
||||||
|
|
||||||
|
matrix_rtc:
|
||||||
|
transports:
|
||||||
|
# The transport you specify will be made available to clients over the
|
||||||
|
# /_matrix/client/unstable/org.matrix.msc4143/rtc/transports endpoint as
|
||||||
|
# defined in MSC4519.
|
||||||
|
- type: livekit
|
||||||
|
# Replace this with the actual URL of your MatrixRTC Authorization Service
|
||||||
|
livekit_service_url: https://matrix-rtc.example.com/livekit/jwt
|
||||||
```
|
```
|
||||||
|
|
||||||
As a prerequisite for the
|
As a prerequisite for the
|
||||||
@@ -68,10 +84,10 @@ As a prerequisite for the
|
|||||||
make sure that your Synapse server has either a `federation` or `openid`
|
make sure that your Synapse server has either a `federation` or `openid`
|
||||||
[listener configured](https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html#listeners).
|
[listener configured](https://element-hq.github.io/synapse/latest/usage/configuration/config_documentation.html#listeners).
|
||||||
|
|
||||||
### MatrixRTC Backend
|
### LiveKit backend
|
||||||
|
|
||||||
In order to **guarantee smooth operation** of Element Call, a MatrixRTC backend is
|
In order to **guarantee smooth operation** of Element Call, a dedicated LiveKit
|
||||||
required for each site deployment.
|
backend is required for each site deployment.
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
@@ -86,10 +102,11 @@ to implement
|
|||||||
In the context of MatrixRTC, we suggest using a single hostname for backend
|
In the context of MatrixRTC, we suggest using a single hostname for backend
|
||||||
communication by implementing endpoint routing within a reverse proxy setup. For
|
communication by implementing endpoint routing within a reverse proxy setup. For
|
||||||
the example above, this results in:
|
the example above, this results in:
|
||||||
| Service | Endpoint | Example |
|
|
||||||
| -------- | ------- | ------- |
|
| Service | Endpoint | Example |
|
||||||
|
| --------------------------------------------------------------------------------- | -------------- | ------------------------------------ |
|
||||||
| [Livekit SFU](https://github.com/livekit/livekit) WebSocket signalling connection | `/livekit/sfu` | `matrix-rtc.example.com/livekit/sfu` |
|
| [Livekit SFU](https://github.com/livekit/livekit) WebSocket signalling connection | `/livekit/sfu` | `matrix-rtc.example.com/livekit/sfu` |
|
||||||
| [MatrixRTC Authorization Service](https://github.com/element-hq/lk-jwt-service) | `/livekit/jwt` | `matrix-rtc.example.com/livekit/jwt` |
|
| [MatrixRTC Authorization Service](https://github.com/element-hq/lk-jwt-service) | `/livekit/jwt` | `matrix-rtc.example.com/livekit/jwt` |
|
||||||
|
|
||||||
Using Nginx, you can achieve this by:
|
Using Nginx, you can achieve this by:
|
||||||
|
|
||||||
@@ -164,7 +181,7 @@ Using Haproxy, you can achieve this by:
|
|||||||
use_backend mxrtc_auth_backend if is_mxrtc_auth matrixrtc_domain
|
use_backend mxrtc_auth_backend if is_mxrtc_auth matrixrtc_domain
|
||||||
|
|
||||||
# Backend
|
# Backend
|
||||||
## MatrixRTC backend
|
## LiveKit backend
|
||||||
backend sfu_backend
|
backend sfu_backend
|
||||||
server livekit 127.0.0.1:7880
|
server livekit 127.0.0.1:7880
|
||||||
http-request set-path %[path,regsub(^/livekit/sfu/,/)]
|
http-request set-path %[path,regsub(^/livekit/sfu/,/)]
|
||||||
@@ -186,44 +203,6 @@ backend mxrtc_auth_backend
|
|||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### MatrixRTC backend announcement
|
|
||||||
|
|
||||||
> [!IMPORTANT]
|
|
||||||
> As defined in
|
|
||||||
> [MSC4143](https://github.com/matrix-org/matrix-spec-proposals/pull/4143),
|
|
||||||
> the MatrixRTC backend(s) must be announced to the client via your **Matrix site's
|
|
||||||
> `.well-known/matrix/client`** file (e.g.
|
|
||||||
> `example.com/.well-known/matrix/client` matching the site deployment example
|
|
||||||
> from above). The configuration is a list of Foci configs:
|
|
||||||
|
|
||||||
```json
|
|
||||||
"org.matrix.msc4143.rtc_foci": [
|
|
||||||
{
|
|
||||||
"type": "livekit",
|
|
||||||
"livekit_service_url": "https://matrix-rtc.example.com/livekit/jwt"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "livekit",
|
|
||||||
"livekit_service_url": "https://matrix-rtc-2.example.com/livekit/jwt"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
```
|
|
||||||
|
|
||||||
Make sure this file is served with the correct MIME type (`application/json`).
|
|
||||||
Additionally, ensure the appropriate CORS headers are set to allow web clients
|
|
||||||
to access it across origins. For more details, refer to the
|
|
||||||
[Matrix Client-Server API: 2. Web Browser Clients](https://spec.matrix.org/latest/client-server-api/#web-browser-clients).
|
|
||||||
|
|
||||||
```
|
|
||||||
Access-Control-Allow-Origin: *
|
|
||||||
Access-Control-Allow-Methods: GET, POST, PUT, DELETE, OPTIONS
|
|
||||||
Access-Control-Allow-Headers: X-Requested-With, Content-Type, Authorization
|
|
||||||
```
|
|
||||||
|
|
||||||
> [!NOTE]
|
|
||||||
> Most `org.matrix.msc4143.rtc_foci` configurations will only have one entry in
|
|
||||||
> the array.
|
|
||||||
|
|
||||||
## Building Element Call
|
## Building Element Call
|
||||||
|
|
||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
@@ -277,7 +256,7 @@ runtime. Documentation and default values for `public/config.json` can be found
|
|||||||
in [ConfigOptions.ts](../src/config/ConfigOptions.ts).
|
in [ConfigOptions.ts](../src/config/ConfigOptions.ts).
|
||||||
|
|
||||||
> [!CAUTION]
|
> [!CAUTION]
|
||||||
> Please note configuring MatrixRTC backend via `config.json` of
|
> Please note configuring LiveKit backend via `config.json` of
|
||||||
> Element Call is only available for developing and debug purposes. Relying on
|
> Element Call is only available for developing and debug purposes. Relying on
|
||||||
> it might break Element Call going forward!
|
> it might break Element Call going forward!
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,12 @@ export default {
|
|||||||
// This is a shell built-in.
|
// This is a shell built-in.
|
||||||
"printf",
|
"printf",
|
||||||
],
|
],
|
||||||
ignoreFiles: ["scripts/.pnpmfile.cjs"],
|
ignoreFiles: [
|
||||||
|
"scripts/.pnpmfile.cjs",
|
||||||
|
// Deliberately added prior to any component or business logic
|
||||||
|
// implementation
|
||||||
|
"src/state/ServiceInterruptionsViewModel.ts",
|
||||||
|
],
|
||||||
ignoreDependencies: [
|
ignoreDependencies: [
|
||||||
// Used in CSS
|
// Used in CSS
|
||||||
"normalize.css",
|
"normalize.css",
|
||||||
|
|||||||
@@ -102,11 +102,15 @@
|
|||||||
"connection_lost_description": "Hovor byl přerušen.",
|
"connection_lost_description": "Hovor byl přerušen.",
|
||||||
"e2ee_unsupported": "Nekompatibilní prohlížeč",
|
"e2ee_unsupported": "Nekompatibilní prohlížeč",
|
||||||
"e2ee_unsupported_description": "Váš webový prohlížeč nepodporuje šifrované hovory. Mezi podporované prohlížeče patří Chrome, Safari a Firefox 117+.",
|
"e2ee_unsupported_description": "Váš webový prohlížeč nepodporuje šifrované hovory. Mezi podporované prohlížeče patří Chrome, Safari a Firefox 117+.",
|
||||||
|
"failed_to_start_livekit": "Nepodařilo se navázat připojení k Livekitu",
|
||||||
"generic": "Něco se pokazilo.",
|
"generic": "Něco se pokazilo.",
|
||||||
"generic_description": "Odeslání protokolů ladění nám pomůže vystopovat problém.",
|
"generic_description": "Odeslání protokolů ladění nám pomůže vystopovat problém.",
|
||||||
"insufficient_capacity": "Nedostatečná kapacita",
|
"insufficient_capacity": "Nedostatečná kapacita",
|
||||||
"insufficient_capacity_description": "Server dosáhl své maximální kapacity a v tuto chvíli se nemůžete připojit k hovoru. Zkuste to později nebo se obraťte na správce serveru, pokud problém přetrvává.",
|
"insufficient_capacity_description": "Server dosáhl své maximální kapacity a v tuto chvíli se nemůžete připojit k hovoru. Zkuste to později nebo se obraťte na správce serveru, pokud problém přetrvává.",
|
||||||
"matrix_rtc_transport_missing": "Server není nakonfigurován pro práci s {{brand}}. Obraťte se na správce serveru (Doména: {{domain}}, Kód chyby: {{ errorCode }}).",
|
"matrix_rtc_transport_missing": "Server není nakonfigurován pro práci s {{brand}}. Obraťte se na správce serveru (Doména: {{domain}}, Kód chyby: {{ errorCode }}).",
|
||||||
|
"membership_manager": "Chyba Správce členství",
|
||||||
|
"membership_manager_description": "Správce členství musel být ukončen. To je způsobeno mnoha po sobě jdoucími neúspěšnými síťovými požadavky.",
|
||||||
|
"no_matrix_2_authorization_service": "Autorizační služba vašeho mediálního serveru (SFU) je zastaralá.",
|
||||||
"open_elsewhere": "Otevřeno na jiné kartě",
|
"open_elsewhere": "Otevřeno na jiné kartě",
|
||||||
"open_elsewhere_description": "{{brand}} byl otevřen v jiné záložce. Pokud to nezní správně, zkuste stránku znovu načíst.",
|
"open_elsewhere_description": "{{brand}} byl otevřen v jiné záložce. Pokud to nezní správně, zkuste stránku znovu načíst.",
|
||||||
"room_creation_restricted": "Nepodařilo se vytvořit hovor",
|
"room_creation_restricted": "Nepodařilo se vytvořit hovor",
|
||||||
@@ -141,6 +145,7 @@
|
|||||||
},
|
},
|
||||||
"layout_grid_label": "Mřížka",
|
"layout_grid_label": "Mřížka",
|
||||||
"layout_spotlight_label": "Soustředěný mód",
|
"layout_spotlight_label": "Soustředěný mód",
|
||||||
|
"layout_switch_label": "Rozvržení",
|
||||||
"lobby": {
|
"lobby": {
|
||||||
"ask_to_join": "Žádost o připojení k hovoru",
|
"ask_to_join": "Žádost o připojení k hovoru",
|
||||||
"join_as_guest": "Připojte se jako host",
|
"join_as_guest": "Připojte se jako host",
|
||||||
@@ -241,11 +246,14 @@
|
|||||||
"version": "{{productName}}verze: {{version}}",
|
"version": "{{productName}}verze: {{version}}",
|
||||||
"video_tile": {
|
"video_tile": {
|
||||||
"always_show": "Vždy zobrazit",
|
"always_show": "Vždy zobrazit",
|
||||||
|
"call_ended": "Hovor ukončen",
|
||||||
|
"calling": "Volání…",
|
||||||
"camera_starting": "Načítání videa...",
|
"camera_starting": "Načítání videa...",
|
||||||
"collapse": "Sbalit",
|
"collapse": "Sbalit",
|
||||||
"expand": "Rozbalit",
|
"expand": "Rozbalit",
|
||||||
"mute_for_me": "Pro mě ztlumit",
|
"mute_for_me": "Pro mě ztlumit",
|
||||||
"muted_for_me": "Pro mě ztlumené",
|
"muted_for_me": "Pro mě ztlumené",
|
||||||
|
"screen_share_volume": "Hlasitost sdílení obrazovky",
|
||||||
"volume": "Hlasitost",
|
"volume": "Hlasitost",
|
||||||
"waiting_for_media": "Čekání na média..."
|
"waiting_for_media": "Čekání na média..."
|
||||||
}
|
}
|
||||||
|
|||||||
+17
-6
@@ -61,7 +61,7 @@
|
|||||||
"crypto_version": "Crypto version: {{version}}",
|
"crypto_version": "Crypto version: {{version}}",
|
||||||
"custom_livekit_url": {
|
"custom_livekit_url": {
|
||||||
"current_url": "Currently set to: ",
|
"current_url": "Currently set to: ",
|
||||||
"from_config": "Currently, no overwrite is set. Url from well-known or config is used.",
|
"from_config": "Currently, no overwrite is set. Url from config is used.",
|
||||||
"label": "Custom Livekit-url",
|
"label": "Custom Livekit-url",
|
||||||
"reset": "Reset overwrite",
|
"reset": "Reset overwrite",
|
||||||
"save": "Save",
|
"save": "Save",
|
||||||
@@ -80,10 +80,6 @@
|
|||||||
"description": "Compatible with homeservers that do not support sticky events (but all other EC clients are v0.17.0 or later)",
|
"description": "Compatible with homeservers that do not support sticky events (but all other EC clients are v0.17.0 or later)",
|
||||||
"label": "Compatibility: state events & multi SFU"
|
"label": "Compatibility: state events & multi SFU"
|
||||||
},
|
},
|
||||||
"Legacy": {
|
|
||||||
"description": "Compatible with old versions of EC that do not support multi SFU",
|
|
||||||
"label": "Legacy: state events & oldest membership SFU"
|
|
||||||
},
|
|
||||||
"Matrix_2_0": {
|
"Matrix_2_0": {
|
||||||
"description": "Compatible only with homservers supporting sticky events and all EC clients v0.17.0 or later",
|
"description": "Compatible only with homservers supporting sticky events and all EC clients v0.17.0 or later",
|
||||||
"label": "Matrix 2.0: sticky events & multi SFU"
|
"label": "Matrix 2.0: sticky events & multi SFU"
|
||||||
@@ -196,13 +192,23 @@
|
|||||||
"room_auth_view_ssla_caption": "By clicking \"Join call now\", you agree to our <2>Software and Services License Agreement (SSLA)</2>",
|
"room_auth_view_ssla_caption": "By clicking \"Join call now\", you agree to our <2>Software and Services License Agreement (SSLA)</2>",
|
||||||
"screenshare_button_label": "Share screen",
|
"screenshare_button_label": "Share screen",
|
||||||
"settings": {
|
"settings": {
|
||||||
|
"advanced_camera_description": "Configure resolution, framerate, bitrate, and codec for camera video. Changes apply on next call join.",
|
||||||
|
"advanced_camera_label": "Advanced camera settings",
|
||||||
|
"advanced_screen_share_description": "Configure resolution, framerate, bitrate, and codec for screen sharing",
|
||||||
|
"advanced_screen_share_label": "Advanced screen share settings",
|
||||||
|
"audio_processing_description": "Changes apply on next call join.",
|
||||||
|
"audio_processing_header": "Audio processing",
|
||||||
"audio_tab": {
|
"audio_tab": {
|
||||||
"effect_volume_description": "Adjust the volume at which reactions and hand raised effects play.",
|
"effect_volume_description": "Adjust the volume at which reactions and hand raised effects play.",
|
||||||
"effect_volume_label": "Sound effect volume"
|
"effect_volume_label": "Sound effect volume"
|
||||||
},
|
},
|
||||||
|
"auto_gain_control_label": "Automatic gain control",
|
||||||
"background_blur_header": "Background",
|
"background_blur_header": "Background",
|
||||||
"background_blur_label": "Blur the background of the video",
|
"background_blur_label": "Blur the background of the video",
|
||||||
|
"bitrate_label": "Bitrate",
|
||||||
"blur_not_supported_by_browser": "(Background blur is not supported by this device.)",
|
"blur_not_supported_by_browser": "(Background blur is not supported by this device.)",
|
||||||
|
"camera_header": "Camera quality",
|
||||||
|
"codec_label": "Codec",
|
||||||
"developer_tab_title": "Developer",
|
"developer_tab_title": "Developer",
|
||||||
"devices": {
|
"devices": {
|
||||||
"activating": "Activating…",
|
"activating": "Activating…",
|
||||||
@@ -218,12 +224,15 @@
|
|||||||
"speaker": "Speaker",
|
"speaker": "Speaker",
|
||||||
"speaker_numbered": "Speaker {{n}}"
|
"speaker_numbered": "Speaker {{n}}"
|
||||||
},
|
},
|
||||||
|
"echo_cancellation_label": "Echo cancellation",
|
||||||
"feedback_tab_body": "If you are experiencing issues or simply would like to provide some feedback, please send us a short description below.",
|
"feedback_tab_body": "If you are experiencing issues or simply would like to provide some feedback, please send us a short description below.",
|
||||||
"feedback_tab_description_label": "Your feedback",
|
"feedback_tab_description_label": "Your feedback",
|
||||||
"feedback_tab_h4": "Submit feedback",
|
"feedback_tab_h4": "Submit feedback",
|
||||||
"feedback_tab_send_logs_label": "Include debug logs",
|
"feedback_tab_send_logs_label": "Include debug logs",
|
||||||
"feedback_tab_thank_you": "Thanks, we received your feedback!",
|
"feedback_tab_thank_you": "Thanks, we received your feedback!",
|
||||||
"feedback_tab_title": "Feedback",
|
"feedback_tab_title": "Feedback",
|
||||||
|
"framerate_label": "Framerate",
|
||||||
|
"noise_suppression_label": "Noise suppression",
|
||||||
"opt_in_description": "<0></0><1></1>You may withdraw consent by unchecking this box. If you are currently in a call, this setting will take effect at the end of the call.",
|
"opt_in_description": "<0></0><1></1>You may withdraw consent by unchecking this box. If you are currently in a call, this setting will take effect at the end of the call.",
|
||||||
"preferences_tab": {
|
"preferences_tab": {
|
||||||
"developer_mode_label": "Developer mode",
|
"developer_mode_label": "Developer mode",
|
||||||
@@ -235,7 +244,9 @@
|
|||||||
"reactions_show_label": "Show reactions",
|
"reactions_show_label": "Show reactions",
|
||||||
"show_hand_raised_timer_description": "Show a timer when a participant raises their hand",
|
"show_hand_raised_timer_description": "Show a timer when a participant raises their hand",
|
||||||
"show_hand_raised_timer_label": "Show hand raise duration"
|
"show_hand_raised_timer_label": "Show hand raise duration"
|
||||||
}
|
},
|
||||||
|
"resolution_label": "Resolution",
|
||||||
|
"screen_share_header": "Screen sharing"
|
||||||
},
|
},
|
||||||
"star_rating_input_label_one": "{{count}} star",
|
"star_rating_input_label_one": "{{count}} star",
|
||||||
"star_rating_input_label_other": "{{count}} stars",
|
"star_rating_input_label_other": "{{count}} stars",
|
||||||
|
|||||||
+27
-1
@@ -3,6 +3,7 @@
|
|||||||
"user_menu": "Kasutajamenüü"
|
"user_menu": "Kasutajamenüü"
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
|
"blur_background": "Hägusta tausta",
|
||||||
"close": "Sulge",
|
"close": "Sulge",
|
||||||
"copy_link": "Kopeeri link",
|
"copy_link": "Kopeeri link",
|
||||||
"edit": "Muuda",
|
"edit": "Muuda",
|
||||||
@@ -72,8 +73,20 @@
|
|||||||
"environment_variables": "Keskkonnamuutujad",
|
"environment_variables": "Keskkonnamuutujad",
|
||||||
"hostname": "Hosti nimi: {{hostname}}",
|
"hostname": "Hosti nimi: {{hostname}}",
|
||||||
"livekit_server_info": "LiveKiti serveri teave",
|
"livekit_server_info": "LiveKiti serveri teave",
|
||||||
"livekit_sfu": "LiveKit SFU: {{url}}",
|
"livekit_sfu": "LiveKiti meediaedastusserver (SFU): {{url}}",
|
||||||
"matrixRTCMode": {
|
"matrixRTCMode": {
|
||||||
|
"Comptibility": {
|
||||||
|
"description": "Ühildub koduserveritega, mis ei toeta määratud kestusega sündmuseid (kuid kõik teised EC kliendid on v0.17.0 või hilisemad)",
|
||||||
|
"label": "Ühilduvus: olekusündmused ja mitu meediaedastusserverit (SFU)"
|
||||||
|
},
|
||||||
|
"Legacy": {
|
||||||
|
"description": "Ühildub EC vanemate versioonidega, millel puudub mitme meediaedastusserveri (SFU) tugi",
|
||||||
|
"label": "Vana lahendus: oleku üritused ja vanim meediaedastusserver (SFU)"
|
||||||
|
},
|
||||||
|
"Matrix_2_0": {
|
||||||
|
"description": "Ühildub ainult määratud kestusega sündmuseid toetavate koduserveritega ja kõigi EC-klientidega alates versioonist 0.17.0",
|
||||||
|
"label": "Matrix 2.0: määratud kestusega sündmused ja mitu meediaedastusserverit (SFU)"
|
||||||
|
},
|
||||||
"title": "MatrixRTC režiim"
|
"title": "MatrixRTC režiim"
|
||||||
},
|
},
|
||||||
"matrix_id": "Matrixi kasutajatunnus: {{id}}",
|
"matrix_id": "Matrixi kasutajatunnus: {{id}}",
|
||||||
@@ -95,13 +108,20 @@
|
|||||||
"generic_description": "Silumis- ja vealogide saatmine võib aidata meid vea põhjuseni jõuda.",
|
"generic_description": "Silumis- ja vealogide saatmine võib aidata meid vea põhjuseni jõuda.",
|
||||||
"insufficient_capacity": "Mittepiisav jõudlus",
|
"insufficient_capacity": "Mittepiisav jõudlus",
|
||||||
"insufficient_capacity_description": "Serveri jõudluse ülempiir on hetkel ületatud ja sa ei saa hetkel selle kõnega liituda. Proovi hiljem uuesti või kui probleem kestab kauem, siis võta ühendust serveri haldajaga.",
|
"insufficient_capacity_description": "Serveri jõudluse ülempiir on hetkel ületatud ja sa ei saa hetkel selle kõnega liituda. Proovi hiljem uuesti või kui probleem kestab kauem, siis võta ühendust serveri haldajaga.",
|
||||||
|
"livekit_connection_error": "Livekiti serveriga ühendamine ei õnnestunud",
|
||||||
|
"livekit_connection_error_description": "Livekiti serveriga ühendamisel tekkis viga (<1>Põhjus: </1> <2>{{ reason }}</2>).",
|
||||||
"matrix_rtc_transport_missing": "See server pole seadistatud töötama rakendusega {{brand}}. Palun võta ühendust serveri halduriga (domeen: {{domain}}, veakood: {{ errorCode }}).",
|
"matrix_rtc_transport_missing": "See server pole seadistatud töötama rakendusega {{brand}}. Palun võta ühendust serveri halduriga (domeen: {{domain}}, veakood: {{ errorCode }}).",
|
||||||
"membership_manager": "Viga liikmelisuse haldamisel",
|
"membership_manager": "Viga liikmelisuse haldamisel",
|
||||||
"membership_manager_description": "Liikmelisuse haldur pidi oma töö lõpetama. Selle põhjuseks olid paljud järjestikused ebaõnnestunud võrgupäringud.",
|
"membership_manager_description": "Liikmelisuse haldur pidi oma töö lõpetama. Selle põhjuseks olid paljud järjestikused ebaõnnestunud võrgupäringud.",
|
||||||
|
"no_matrix_2_authorization_service": "Sinu meediaedastusserveri (SFU) autoriseerimisteenus on aegunud.",
|
||||||
"open_elsewhere": "Avatud teisel vahekaardil",
|
"open_elsewhere": "Avatud teisel vahekaardil",
|
||||||
"open_elsewhere_description": "{{brand}} on avatud teisel vahekaardil. Kui see ei tundu olema õige, proovi selle lehe uuesti laadimist.",
|
"open_elsewhere_description": "{{brand}} on avatud teisel vahekaardil. Kui see ei tundu olema õige, proovi selle lehe uuesti laadimist.",
|
||||||
|
"peer_connection_timeout": "Ühendus aegus",
|
||||||
|
"peer_connection_timeout_description": "Meediaserveriga ühenduspäring aegus. Proovi kasutada muud võrku või keelata VPN-i kasutamine. Kui probleem püsib, vaata meie <0> veaotsingu juhendit</0> või võta ühendust oma serveri peakasutajaga.",
|
||||||
"room_creation_restricted": "Kõne loomine ei õnnestunud",
|
"room_creation_restricted": "Kõne loomine ei õnnestunud",
|
||||||
"room_creation_restricted_description": "Kõne loomine võib olla lubatud ainult volitatud kasutajatele. Proovi hiljem uuesti või probleemi püsimisel võta ühendust oma serveri haldajaga.",
|
"room_creation_restricted_description": "Kõne loomine võib olla lubatud ainult volitatud kasutajatele. Proovi hiljem uuesti või probleemi püsimisel võta ühendust oma serveri haldajaga.",
|
||||||
|
"sticky_events_required": "Koduserver ei toeta Matrix 2.0 kõnesid",
|
||||||
|
"sticky_events_required_description": "See server on seadistatud kasutama Matrix 2.0 kõnerežiimi, kuid koduserver ei teata, et tal selleks vajalike sündmuste (MSC4354) tugi. Palu serveri peakasutajal see uuendada või kasuta koduserveris ühilduvat režiimi.",
|
||||||
"unexpected_ec_error": "Tekkis ootamatu viga (<0>Veakood:</0> <1>{{ errorCode }}</1>). Palun võta ühendust serveri haldajaga."
|
"unexpected_ec_error": "Tekkis ootamatu viga (<0>Veakood:</0> <1>{{ errorCode }}</1>). Palun võta ühendust serveri haldajaga."
|
||||||
},
|
},
|
||||||
"group_call_loader": {
|
"group_call_loader": {
|
||||||
@@ -132,6 +152,7 @@
|
|||||||
},
|
},
|
||||||
"layout_grid_label": "Ruudustik",
|
"layout_grid_label": "Ruudustik",
|
||||||
"layout_spotlight_label": "Rambivalgus",
|
"layout_spotlight_label": "Rambivalgus",
|
||||||
|
"layout_switch_label": "Paigutus",
|
||||||
"lobby": {
|
"lobby": {
|
||||||
"ask_to_join": "Küsi võimalust liituda kõnega",
|
"ask_to_join": "Küsi võimalust liituda kõnega",
|
||||||
"join_as_guest": "Liitu külalisena",
|
"join_as_guest": "Liitu külalisena",
|
||||||
@@ -184,6 +205,7 @@
|
|||||||
"blur_not_supported_by_browser": "(Tausta hägustamine pole selles seadmes toetatud.)",
|
"blur_not_supported_by_browser": "(Tausta hägustamine pole selles seadmes toetatud.)",
|
||||||
"developer_tab_title": "Arendaja",
|
"developer_tab_title": "Arendaja",
|
||||||
"devices": {
|
"devices": {
|
||||||
|
"activating": "Aktiveerin…",
|
||||||
"camera": "Kaamera",
|
"camera": "Kaamera",
|
||||||
"camera_numbered": "Kaamera {{n}}",
|
"camera_numbered": "Kaamera {{n}}",
|
||||||
"change_device_button": "Muuda heliseadet",
|
"change_device_button": "Muuda heliseadet",
|
||||||
@@ -223,6 +245,7 @@
|
|||||||
"stop_video_button_label": "Peata videovoog",
|
"stop_video_button_label": "Peata videovoog",
|
||||||
"submitting": "Saadan…",
|
"submitting": "Saadan…",
|
||||||
"switch_camera": "Vaheta kaamerat",
|
"switch_camera": "Vaheta kaamerat",
|
||||||
|
"technical_details": "Tehnilised üksikasjad",
|
||||||
"unauthenticated_view_body": "Sa pole veel registreerunud? <2>Loo kasutajakonto</2>",
|
"unauthenticated_view_body": "Sa pole veel registreerunud? <2>Loo kasutajakonto</2>",
|
||||||
"unauthenticated_view_login_button": "Logi oma kontosse sisse",
|
"unauthenticated_view_login_button": "Logi oma kontosse sisse",
|
||||||
"unauthenticated_view_ssla_caption": "Klõpsides „Jätka“ nõustud sa meie <2>Tarkvara ja teenuste litsentseerimise lepinguga (Software and Services License Agreement - SSLA)</2>",
|
"unauthenticated_view_ssla_caption": "Klõpsides „Jätka“ nõustud sa meie <2>Tarkvara ja teenuste litsentseerimise lepinguga (Software and Services License Agreement - SSLA)</2>",
|
||||||
@@ -230,11 +253,14 @@
|
|||||||
"version": "{{productName}}, versioon: {{version}}",
|
"version": "{{productName}}, versioon: {{version}}",
|
||||||
"video_tile": {
|
"video_tile": {
|
||||||
"always_show": "Näita alati",
|
"always_show": "Näita alati",
|
||||||
|
"call_ended": "Kõne lõppes",
|
||||||
|
"calling": "Helistan…",
|
||||||
"camera_starting": "Video on laadimisel...",
|
"camera_starting": "Video on laadimisel...",
|
||||||
"collapse": "Näita vähem",
|
"collapse": "Näita vähem",
|
||||||
"expand": "Näita rohkem",
|
"expand": "Näita rohkem",
|
||||||
"mute_for_me": "Summuta minu jaoks",
|
"mute_for_me": "Summuta minu jaoks",
|
||||||
"muted_for_me": "Minule summutatud",
|
"muted_for_me": "Minule summutatud",
|
||||||
|
"screen_share_volume": "Helivaljus ekraanijagaamisel",
|
||||||
"volume": "Helivaljus",
|
"volume": "Helivaljus",
|
||||||
"waiting_for_media": "Ootame kuni meedia on olemas..."
|
"waiting_for_media": "Ootame kuni meedia on olemas..."
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
"user_menu": "Käyttäjävalikko"
|
"user_menu": "Käyttäjävalikko"
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
|
"blur_background": "Sumenna tausta",
|
||||||
"close": "Sulje",
|
"close": "Sulje",
|
||||||
"copy_link": "Kopioi linkki",
|
"copy_link": "Kopioi linkki",
|
||||||
"edit": "Muokkaa",
|
"edit": "Muokkaa",
|
||||||
@@ -107,14 +108,20 @@
|
|||||||
"generic_description": "Vianmäärityslokien lähettäminen auttaa meitä jäljittämään ongelman.",
|
"generic_description": "Vianmäärityslokien lähettäminen auttaa meitä jäljittämään ongelman.",
|
||||||
"insufficient_capacity": "Riittämätön kapasiteetti",
|
"insufficient_capacity": "Riittämätön kapasiteetti",
|
||||||
"insufficient_capacity_description": "Palvelin on saavuttanut maksimikapasiteettinsa, etkä voi liittyä puheluun tällä hetkellä. Yritä myöhemmin uudelleen tai ota yhteyttä palvelimen ylläpitäjään, jos ongelma jatkuu.",
|
"insufficient_capacity_description": "Palvelin on saavuttanut maksimikapasiteettinsa, etkä voi liittyä puheluun tällä hetkellä. Yritä myöhemmin uudelleen tai ota yhteyttä palvelimen ylläpitäjään, jos ongelma jatkuu.",
|
||||||
|
"livekit_connection_error": "Yhteyden muodostaminen Livekit-palvelimeen epäonnistui",
|
||||||
|
"livekit_connection_error_description": "Livekit-palvelimeen yhteyden muodostamisessa tapahtui virhe (<1>Syy: </1> <2>{{ reason }}</2>).",
|
||||||
"matrix_rtc_transport_missing": "Palvelinta ei ole määritetty toimimaan {{brand}} -sovelluksen kanssa. Ota yhteyttä palvelimen ylläpitäjään (Verkkotunnus: {{domain}}, Virhekoodi: {{ errorCode }}).",
|
"matrix_rtc_transport_missing": "Palvelinta ei ole määritetty toimimaan {{brand}} -sovelluksen kanssa. Ota yhteyttä palvelimen ylläpitäjään (Verkkotunnus: {{domain}}, Virhekoodi: {{ errorCode }}).",
|
||||||
"membership_manager": "Jäsenyydenhallinnan virhe",
|
"membership_manager": "Jäsenyydenhallinnan virhe",
|
||||||
"membership_manager_description": "Jäsenyyshallinta jouduttiin sulkemaan. Tämä johtui useista peräkkäisistä epäonnistuneista verkkopyynnöistä.",
|
"membership_manager_description": "Jäsenyyshallinta jouduttiin sulkemaan. Tämä johtui useista peräkkäisistä epäonnistuneista verkkopyynnöistä.",
|
||||||
"no_matrix_2_authorization_service": "Mediapalvelimesi (SFU) valtuutuspalvelu on vanhentunut.",
|
"no_matrix_2_authorization_service": "Mediapalvelimesi (SFU) valtuutuspalvelu on vanhentunut.",
|
||||||
"open_elsewhere": "Avattu toisessa välilehdessä",
|
"open_elsewhere": "Avattu toisessa välilehdessä",
|
||||||
"open_elsewhere_description": "{{brand}} on avattu toisessa välilehdessä. Jos tämä ei kuulosta oikealta, yritä ladata sivu uudelleen.",
|
"open_elsewhere_description": "{{brand}} on avattu toisessa välilehdessä. Jos tämä ei kuulosta oikealta, yritä ladata sivu uudelleen.",
|
||||||
|
"peer_connection_timeout": "Yhteyden aikakatkaisu",
|
||||||
|
"peer_connection_timeout_description": "Yhteys mediapalvelimeen aikakatkaistiin. Kokeile vaihtaa verkkoa tai poistaa VPN käytöstä. Jos ongelma jatkuu, katso <0>vianetsintäoppaamme</0> tai ota yhteyttä palvelimesi ylläpitäjään.",
|
||||||
"room_creation_restricted": "Puhelun luominen epäonnistui",
|
"room_creation_restricted": "Puhelun luominen epäonnistui",
|
||||||
"room_creation_restricted_description": "Puheluiden luominen saattaa olla rajoitettu vain valtuutetuille käyttäjille. Yritä myöhemmin uudelleen tai ota yhteyttä palvelimen ylläpitäjään, jos ongelma jatkuu.",
|
"room_creation_restricted_description": "Puheluiden luominen saattaa olla rajoitettu vain valtuutetuille käyttäjille. Yritä myöhemmin uudelleen tai ota yhteyttä palvelimen ylläpitäjään, jos ongelma jatkuu.",
|
||||||
|
"sticky_events_required": "Kotipalvelin ei tue Matrix 2.0 -puheluita",
|
||||||
|
"sticky_events_required_description": "Tämä asennus on määritetty käyttämään Matrix 2.0 -puhelutilaa, mutta kotipalvelin ei mainosta tukea tarttuville tapahtumille (MSC4354). Pyydä palvelimen järjestelmänvalvojaa päivittämään tai vaihtamaan asennus yhteensopivaan tilaan.",
|
||||||
"unexpected_ec_error": "Tapahtui odottamaton virhe (<0>Virhekoodi:</0> <1>{{ errorCode }}</1>). Ota yhteyttä palvelimen ylläpitäjään."
|
"unexpected_ec_error": "Tapahtui odottamaton virhe (<0>Virhekoodi:</0> <1>{{ errorCode }}</1>). Ota yhteyttä palvelimen ylläpitäjään."
|
||||||
},
|
},
|
||||||
"group_call_loader": {
|
"group_call_loader": {
|
||||||
@@ -145,6 +152,7 @@
|
|||||||
},
|
},
|
||||||
"layout_grid_label": "Ruudukko",
|
"layout_grid_label": "Ruudukko",
|
||||||
"layout_spotlight_label": "Valokeila",
|
"layout_spotlight_label": "Valokeila",
|
||||||
|
"layout_switch_label": "Asettelu",
|
||||||
"lobby": {
|
"lobby": {
|
||||||
"ask_to_join": "Pyydä liittymistä puheluun",
|
"ask_to_join": "Pyydä liittymistä puheluun",
|
||||||
"join_as_guest": "Liity vieraana",
|
"join_as_guest": "Liity vieraana",
|
||||||
@@ -197,6 +205,7 @@
|
|||||||
"blur_not_supported_by_browser": "(Tämä laite ei tue taustan sumennusta.)",
|
"blur_not_supported_by_browser": "(Tämä laite ei tue taustan sumennusta.)",
|
||||||
"developer_tab_title": "Kehittäjä",
|
"developer_tab_title": "Kehittäjä",
|
||||||
"devices": {
|
"devices": {
|
||||||
|
"activating": "Aktivoidaan…",
|
||||||
"camera": "Kamera",
|
"camera": "Kamera",
|
||||||
"camera_numbered": "Kamera {{n}}",
|
"camera_numbered": "Kamera {{n}}",
|
||||||
"change_device_button": "Vaihda äänilaite",
|
"change_device_button": "Vaihda äänilaite",
|
||||||
@@ -236,6 +245,7 @@
|
|||||||
"stop_video_button_label": "Lopeta video",
|
"stop_video_button_label": "Lopeta video",
|
||||||
"submitting": "Lähetetään…",
|
"submitting": "Lähetetään…",
|
||||||
"switch_camera": "Vaihda kameraa",
|
"switch_camera": "Vaihda kameraa",
|
||||||
|
"technical_details": "Tekniset tiedot",
|
||||||
"unauthenticated_view_body": "Etkö ole vielä rekisteröitynyt? <2>Luo tili</2>",
|
"unauthenticated_view_body": "Etkö ole vielä rekisteröitynyt? <2>Luo tili</2>",
|
||||||
"unauthenticated_view_login_button": "Kirjaudu tilillesi",
|
"unauthenticated_view_login_button": "Kirjaudu tilillesi",
|
||||||
"unauthenticated_view_ssla_caption": "Klikkaamalla \"Siirry\" hyväksyt <2>ohjelmisto- ja palvelulisenssisopimuksen (SSLA)</2>",
|
"unauthenticated_view_ssla_caption": "Klikkaamalla \"Siirry\" hyväksyt <2>ohjelmisto- ja palvelulisenssisopimuksen (SSLA)</2>",
|
||||||
|
|||||||
+57
-15
@@ -3,6 +3,7 @@
|
|||||||
"user_menu": "Menu użytkownika"
|
"user_menu": "Menu użytkownika"
|
||||||
},
|
},
|
||||||
"action": {
|
"action": {
|
||||||
|
"blur_background": "Rozmycie tła",
|
||||||
"close": "Zamknij",
|
"close": "Zamknij",
|
||||||
"copy_link": "Kopiuj link",
|
"copy_link": "Kopiuj link",
|
||||||
"edit": "Edytuj",
|
"edit": "Edytuj",
|
||||||
@@ -21,7 +22,7 @@
|
|||||||
"submit": "Wyślij",
|
"submit": "Wyślij",
|
||||||
"upload_file": "Prześlij plik"
|
"upload_file": "Prześlij plik"
|
||||||
},
|
},
|
||||||
"analytics_notice": "Uczestnicząc w tej becie, upoważniasz nas do zbierania anonimowych danych, które wykorzystamy do ulepszenia produktu. Dowiedz się więcej na temat danych, które zbieramy w naszej <2>Polityce prywatności</2> i <5>Polityce ciasteczek</5>.",
|
"analytics_notice": "Biorąc udział w wersji beta, wyrażasz zgodę na gromadzenie anonimowych danych, które wykorzystujemy w celu ulepszenia naszego produktu. Więcej informacji na temat danych, które śledzimy, znajdziesz w naszej <2>Polityce prywatności</2> dla i <6>Polityce ciasteczek</6>.",
|
||||||
"call_ended_view": {
|
"call_ended_view": {
|
||||||
"create_account_button": "Utwórz konto",
|
"create_account_button": "Utwórz konto",
|
||||||
"create_account_prompt": "<0>Może zechcesz ustawić hasło, aby zachować swoje konto?</0><1>Będziesz w stanie utrzymać swoją nazwę i ustawić awatar do wyświetlania podczas połączeń w przyszłości</1>",
|
"create_account_prompt": "<0>Może zechcesz ustawić hasło, aby zachować swoje konto?</0><1>Będziesz w stanie utrzymać swoją nazwę i ustawić awatar do wyświetlania podczas połączeń w przyszłości</1>",
|
||||||
@@ -41,7 +42,7 @@
|
|||||||
"display_name": "Nazwa wyświetlana",
|
"display_name": "Nazwa wyświetlana",
|
||||||
"encrypted": "Szyfrowane",
|
"encrypted": "Szyfrowane",
|
||||||
"home": "Strona domowa",
|
"home": "Strona domowa",
|
||||||
"loading": "Ładowanie…",
|
"loading": "Wczytywanie…",
|
||||||
"next": "Dalej",
|
"next": "Dalej",
|
||||||
"options": "Opcje",
|
"options": "Opcje",
|
||||||
"password": "Hasło",
|
"password": "Hasło",
|
||||||
@@ -58,6 +59,14 @@
|
|||||||
"developer_mode": {
|
"developer_mode": {
|
||||||
"always_show_iphone_earpiece": "Pokaż opcję słuchawki iPhone na wszystkich platformach",
|
"always_show_iphone_earpiece": "Pokaż opcję słuchawki iPhone na wszystkich platformach",
|
||||||
"crypto_version": "Wersja krypto: {{version}}",
|
"crypto_version": "Wersja krypto: {{version}}",
|
||||||
|
"custom_livekit_url": {
|
||||||
|
"current_url": "Aktualnie ustawione na: ",
|
||||||
|
"from_config": "Aktualnie nie nadpisano ustawienia. Używany jest adres URL z dobrego źródła lub konfiguracji.",
|
||||||
|
"label": "Własny Livekit-url",
|
||||||
|
"reset": "Zresetuj nadpisanie",
|
||||||
|
"save": "Zapisz",
|
||||||
|
"saving": "Zapisuję..."
|
||||||
|
},
|
||||||
"debug_tile_layout_label": "Układ kafelków Debug",
|
"debug_tile_layout_label": "Układ kafelków Debug",
|
||||||
"device_id": "ID urządzenia: {{id}}",
|
"device_id": "ID urządzenia: {{id}}",
|
||||||
"duplicate_tiles_label": "Liczba dodatkowych kopii kafelków na uczestnika",
|
"duplicate_tiles_label": "Liczba dodatkowych kopii kafelków na uczestnika",
|
||||||
@@ -65,6 +74,21 @@
|
|||||||
"hostname": "Nazwa hosta: {{hostname}}",
|
"hostname": "Nazwa hosta: {{hostname}}",
|
||||||
"livekit_server_info": "Informacje serwera LiveKit",
|
"livekit_server_info": "Informacje serwera LiveKit",
|
||||||
"livekit_sfu": "LiveKit SFU: {{url}}",
|
"livekit_sfu": "LiveKit SFU: {{url}}",
|
||||||
|
"matrixRTCMode": {
|
||||||
|
"Comptibility": {
|
||||||
|
"description": "Kompatybilny z serwerami domowymi, które nie obsługują sticky events (ale wszyscy inni klienci EC mają wersję v0.17.0 lub nowszą)",
|
||||||
|
"label": "Kompatybilność: state events & multi SFU"
|
||||||
|
},
|
||||||
|
"Legacy": {
|
||||||
|
"description": "Kompatybilny ze starszymi wersjami EC, które nie wspierają multi SFU",
|
||||||
|
"label": "Przestarzałe: state events & oldest membership SFU"
|
||||||
|
},
|
||||||
|
"Matrix_2_0": {
|
||||||
|
"description": "Kompatybilny tylko z serwerami domowymi obsługującymi sticky events i wszystkimi klientami EC w wersji v0.17.0 lub nowszej",
|
||||||
|
"label": "Matrix 2.0: sticky events & multi SFU"
|
||||||
|
},
|
||||||
|
"title": "Tryb MatrixRTC"
|
||||||
|
},
|
||||||
"matrix_id": "ID Matrix: {{id}}",
|
"matrix_id": "ID Matrix: {{id}}",
|
||||||
"mute_all_audio": "Wycisz cały dźwięk (uczestnicy, reakcje, dźwięki dołączenia)",
|
"mute_all_audio": "Wycisz cały dźwięk (uczestnicy, reakcje, dźwięki dołączenia)",
|
||||||
"show_connection_stats": "Pokaż statystyki połączenia",
|
"show_connection_stats": "Pokaż statystyki połączenia",
|
||||||
@@ -74,25 +98,36 @@
|
|||||||
"error": {
|
"error": {
|
||||||
"call_is_not_supported": "Połączenie nie jest obsługiwane",
|
"call_is_not_supported": "Połączenie nie jest obsługiwane",
|
||||||
"call_not_found": "Nie znaleziono połączenia",
|
"call_not_found": "Nie znaleziono połączenia",
|
||||||
"call_not_found_description": "<0>Wygląda na to, że ten link nie należy do żadnego istniejącego połączenia. Sprawdź, czy posiadasz prawidłowy link lub <1>utwórz nowy</1>.</0>",
|
"call_not_found_description": "<0>Wygląda na to, że ten link nie należy do żadnego istniejącego połączenia. Sprawdź, czy masz prawidłowy link lub <2> utwórz nowy</2>.</0>",
|
||||||
"connection_lost": "Utracono połączenie",
|
"connection_lost": "Utracono połączenie",
|
||||||
"connection_lost_description": "Zostałeś rozłączony z rozmowy.",
|
"connection_lost_description": "Zostałeś rozłączony z rozmowy.",
|
||||||
"e2ee_unsupported": "Niekompatybilna przeglądarka",
|
"e2ee_unsupported": "Niekompatybilna przeglądarka",
|
||||||
"e2ee_unsupported_description": "Twoja przeglądarka nie wspiera szyfrowanych połączeń. Obsługiwane przeglądarki obejmują Chrome, Safari i Firefox 117+.",
|
"e2ee_unsupported_description": "Twoja przeglądarka nie wspiera szyfrowanych połączeń. Obsługiwane przeglądarki obejmują Chrome, Safari i Firefox 117+.",
|
||||||
|
"failed_to_start_livekit": "Nie udało się uruchomić połączenia Livekit",
|
||||||
"generic": "Coś poszło nie tak",
|
"generic": "Coś poszło nie tak",
|
||||||
"generic_description": "Wysłanie dziennika debug, pozwoli nam namierzyć problem.",
|
"generic_description": "Wysłanie dziennika debug, pozwoli nam namierzyć problem.",
|
||||||
"insufficient_capacity": "Za mało miejsca",
|
"insufficient_capacity": "Za mało miejsca",
|
||||||
"insufficient_capacity_description": "Serwer osiągnął maksymalną pojemność, przez co nie możesz dołączyć do połączenia. Spróbuj ponownie później lub skontaktuj się z administratorem serwera, jeśli problem nie zniknie.",
|
"insufficient_capacity_description": "Serwer osiągnął maksymalną pojemność, przez co nie możesz dołączyć do połączenia. Spróbuj ponownie później lub skontaktuj się z administratorem serwera, jeśli problem nie zniknie.",
|
||||||
|
"livekit_connection_error": "Nie udało się połączyć z serwerem Livekit",
|
||||||
|
"livekit_connection_error_description": "Wystąpił błąd podczas łączenia się z serwerem Livekit (<1>Przyczyna:</1> <2>{{ reason }}</2>).",
|
||||||
|
"matrix_rtc_transport_missing": "Serwer nie jest skonfigurowany do pracy z {{brand}}. Prosimy o kontakt z administratorem serwera (Domena: {{domain}}, Kod błędu: {{ errorCode }}).",
|
||||||
|
"membership_manager": "Błąd menedżera członkostwa",
|
||||||
|
"membership_manager_description": "Menedżer członkostwa został zamknięty przez zbyt wiele powtarzających się błędów połączenia.",
|
||||||
|
"no_matrix_2_authorization_service": "Usługa autoryzacji dla serwera multimediów (SFU) jest nieaktualna.",
|
||||||
"open_elsewhere": "Otwarto w innej karcie",
|
"open_elsewhere": "Otwarto w innej karcie",
|
||||||
"open_elsewhere_description": "{{brand}} został otwarty w innej karcie. Jeśli tak nie jest, spróbuj odświeżyć stronę.",
|
"open_elsewhere_description": "{{brand}} został otwarty w innej karcie. Jeśli tak nie jest, spróbuj odświeżyć stronę.",
|
||||||
|
"peer_connection_timeout": "Upłynął limit czasu połączenia",
|
||||||
|
"peer_connection_timeout_description": "Upłynął czas oczekiwania na połączenie z serwerem multimediów. Spróbuj połączyć się z inną siecią lub wyłączyć VPN. Jeśli problem nadal występuje, zapoznaj się z naszym <0>poradnikiem rozwiązywania problemów</0> lub skontaktuj się z administratorem serwera.",
|
||||||
"room_creation_restricted": "Nie udało się utworzyć połączenia",
|
"room_creation_restricted": "Nie udało się utworzyć połączenia",
|
||||||
"room_creation_restricted_description": "Tworzenie połączeń mogło zostać ograniczone tylko do autoryzowanych użytkowników. Spróbuj ponownie później lub skontaktuj się z administratorem serwera, jeśli problem nie minie.",
|
"room_creation_restricted_description": "Tworzenie połączeń mogło zostać ograniczone tylko do autoryzowanych użytkowników. Spróbuj ponownie później lub skontaktuj się z administratorem serwera, jeśli problem nie minie.",
|
||||||
|
"sticky_events_required": "Serwer domowy nie wspiera połączeń Matrix 2.0",
|
||||||
|
"sticky_events_required_description": "Wybrana konfiguracja została ustawiona na korzystanie z połączeń Matrix 2.0, lecz serwer domowy nie wspiera ogłaszania sticky events (MSC4354). Poproś administratora serwera o aktualizację lub zmień konfigurację.",
|
||||||
"unexpected_ec_error": "Wystąpił nieoczekiwany błąd (<0>Kod błędu:</0> <1>{{ errorCode }}</1>). Skontaktuj się z administratorem serwera."
|
"unexpected_ec_error": "Wystąpił nieoczekiwany błąd (<0>Kod błędu:</0> <1>{{ errorCode }}</1>). Skontaktuj się z administratorem serwera."
|
||||||
},
|
},
|
||||||
"group_call_loader": {
|
"group_call_loader": {
|
||||||
"banned_body": "Zostałeś zbanowany z pokoju.",
|
"banned_body": "Zostałeś zbanowany z pokoju.",
|
||||||
"banned_heading": "Zbanowany",
|
"banned_heading": "Zbanowany",
|
||||||
"call_ended_body": "Zostałeś usunięty z rozmowy.",
|
"call_ended_body": "Zostałeś usunięty z połączenia.",
|
||||||
"call_ended_heading": "Połączenie zakończone",
|
"call_ended_heading": "Połączenie zakończone",
|
||||||
"knock_reject_body": "Członkowie pokoju odrzucili Twoją prośbę o dołączenie.",
|
"knock_reject_body": "Członkowie pokoju odrzucili Twoją prośbę o dołączenie.",
|
||||||
"knock_reject_heading": "Nie możesz dołączyć",
|
"knock_reject_heading": "Nie możesz dołączyć",
|
||||||
@@ -112,17 +147,18 @@
|
|||||||
},
|
},
|
||||||
"join_existing_call_modal": {
|
"join_existing_call_modal": {
|
||||||
"join_button": "Tak, dołącz do połączenia",
|
"join_button": "Tak, dołącz do połączenia",
|
||||||
"text": "Te połączenie już istnieje, czy chcesz do niego dołączyć?",
|
"text": "Połączenie już istnieje, czy chcesz do niej dołączyć?",
|
||||||
"title": "Dołączyć do istniejącego połączenia?"
|
"title": "Dołączyć do istniejącego połączenia?"
|
||||||
},
|
},
|
||||||
"layout_grid_label": "Siatka",
|
"layout_grid_label": "Siatka",
|
||||||
"layout_spotlight_label": "Centrum uwagi",
|
"layout_spotlight_label": "Centrum uwagi",
|
||||||
|
"layout_switch_label": "Układ",
|
||||||
"lobby": {
|
"lobby": {
|
||||||
"ask_to_join": "Poproś o dołączenie do rozmowy",
|
"ask_to_join": "Poproś o dołączenie do połączenia",
|
||||||
"join_as_guest": "Dołącz jako gość",
|
"join_as_guest": "Dołącz jako gość",
|
||||||
"join_button": "Dołącz do połączenia",
|
"join_button": "Dołącz do połączenia",
|
||||||
"leave_button": "Wróć do ostatnie",
|
"leave_button": "Wróć do ostatnie",
|
||||||
"waiting_for_invite": "Żądanie wysłane"
|
"waiting_for_invite": "Prośba wysłana! Oczekiwanie na zatwierdzenie…"
|
||||||
},
|
},
|
||||||
"log_in": "Zaloguj",
|
"log_in": "Zaloguj",
|
||||||
"logging_in": "Logowanie…",
|
"logging_in": "Logowanie…",
|
||||||
@@ -162,14 +198,15 @@
|
|||||||
"screenshare_button_label": "Udostępnij ekran",
|
"screenshare_button_label": "Udostępnij ekran",
|
||||||
"settings": {
|
"settings": {
|
||||||
"audio_tab": {
|
"audio_tab": {
|
||||||
"effect_volume_description": "Dostosuj głośność, z jaką odtwarzane są efekty reakcji i podniesionej ręki",
|
"effect_volume_description": "Dostosuj głośność efektów reakcji i podniesienia ręki.",
|
||||||
"effect_volume_label": "Głośność efektu dźwiękowego"
|
"effect_volume_label": "Głośność efektów dźwiękowych"
|
||||||
},
|
},
|
||||||
"background_blur_header": "Tło",
|
"background_blur_header": "Tło",
|
||||||
"background_blur_label": "Rozmycie tła wideo",
|
"background_blur_label": "Rozmycie tła wideo",
|
||||||
"blur_not_supported_by_browser": "(Rozmycie tła nie jest wspierane przez to urządzenie.)",
|
"blur_not_supported_by_browser": "(Rozmycie tła nie jest wspierane przez to urządzenie.)",
|
||||||
"developer_tab_title": "Programista",
|
"developer_tab_title": "Programista",
|
||||||
"devices": {
|
"devices": {
|
||||||
|
"activating": "Aktywuję…",
|
||||||
"camera": "Kamera",
|
"camera": "Kamera",
|
||||||
"camera_numbered": "Kamera {{n}}",
|
"camera_numbered": "Kamera {{n}}",
|
||||||
"change_device_button": "Zmień urządzenie audio",
|
"change_device_button": "Zmień urządzenie audio",
|
||||||
@@ -192,7 +229,7 @@
|
|||||||
"preferences_tab": {
|
"preferences_tab": {
|
||||||
"developer_mode_label": "Tryb programisty",
|
"developer_mode_label": "Tryb programisty",
|
||||||
"developer_mode_label_description": "Włącz tryb programisty i wyświetl kartę ustawień programisty.",
|
"developer_mode_label_description": "Włącz tryb programisty i wyświetl kartę ustawień programisty.",
|
||||||
"introduction": "Tutaj możesz skonfigurować dodatkowe opcje dla lepszych doświadczeń.",
|
"introduction": "Tutaj możesz skonfigurować dodatkowe opcje dla lepszego komfortu użytkowania.",
|
||||||
"reactions_play_sound_description": "Odtwórz efekt dźwiękowy, gdy ktoś wyślę reakcję w trakcie połączenia.",
|
"reactions_play_sound_description": "Odtwórz efekt dźwiękowy, gdy ktoś wyślę reakcję w trakcie połączenia.",
|
||||||
"reactions_play_sound_label": "Odtwórz dźwięki reakcji",
|
"reactions_play_sound_label": "Odtwórz dźwięki reakcji",
|
||||||
"reactions_show_description": "Odtwórz animację, gdy ktoś wyślę reakcję.",
|
"reactions_show_description": "Odtwórz animację, gdy ktoś wyślę reakcję.",
|
||||||
@@ -201,26 +238,31 @@
|
|||||||
"show_hand_raised_timer_label": "Pokaż czas po podniesieniu ręki"
|
"show_hand_raised_timer_label": "Pokaż czas po podniesieniu ręki"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"star_rating_input_label_one": "{{count}} gwiazdki",
|
"star_rating_input_label_one": "{{count}} gwiazdka",
|
||||||
"star_rating_input_label_other": "{{count}} gwiazdki",
|
"star_rating_input_label_few": "{{count}} gwiazdki",
|
||||||
|
"star_rating_input_label_many": "{{count}} gwiazdek",
|
||||||
"start_new_call": "Rozpocznij nowe połączenie",
|
"start_new_call": "Rozpocznij nowe połączenie",
|
||||||
"start_video_button_label": "Rozpocznij wideo",
|
"start_video_button_label": "Rozpocznij wideo",
|
||||||
"stop_screenshare_button_label": "Udostępnianie ekranu",
|
"stop_screenshare_button_label": "Udostępnianie ekranu",
|
||||||
"stop_video_button_label": "Zakończ wideo",
|
"stop_video_button_label": "Zakończ wideo",
|
||||||
"submitting": "Wysyłanie…",
|
"submitting": "Wysyłanie…",
|
||||||
"switch_camera": "Przełącz kamerę",
|
"switch_camera": "Przełącz kamerę",
|
||||||
|
"technical_details": "Szczegóły techniczne",
|
||||||
"unauthenticated_view_body": "Nie masz konta? <2>Utwórz je</2>",
|
"unauthenticated_view_body": "Nie masz konta? <2>Utwórz je</2>",
|
||||||
"unauthenticated_view_login_button": "Zaloguj się do swojego konta",
|
"unauthenticated_view_login_button": "Zaloguj się na swoje konto",
|
||||||
"unauthenticated_view_ssla_caption": "Klikając \"Przejdź\", wyrażasz zgodę na naszą <2>Umowę licencyjną oprogramowania i usług (SSLA)</2>",
|
"unauthenticated_view_ssla_caption": "Klikając \"Przejdź\", wyrażasz zgodę na naszą <2>Umowę licencyjną oprogramowania i usług (SSLA)</2>",
|
||||||
"unmute_microphone_button_label": "Odcisz mikrofon",
|
"unmute_microphone_button_label": "Wyłącz wyciszenie mikrofonu",
|
||||||
"version": "Wersja: {{version}}",
|
"version": "{{productName}} wersja: {{version}}",
|
||||||
"video_tile": {
|
"video_tile": {
|
||||||
"always_show": "Zawsze pokazuj",
|
"always_show": "Zawsze pokazuj",
|
||||||
|
"call_ended": "Połączenie zakończone",
|
||||||
|
"calling": "Łączenie...",
|
||||||
"camera_starting": "Wczytywanie wideo...",
|
"camera_starting": "Wczytywanie wideo...",
|
||||||
"collapse": "Zwiń",
|
"collapse": "Zwiń",
|
||||||
"expand": "Rozwiń",
|
"expand": "Rozwiń",
|
||||||
"mute_for_me": "Wycisz dla mnie",
|
"mute_for_me": "Wycisz dla mnie",
|
||||||
"muted_for_me": "Wyciszone dla mnie",
|
"muted_for_me": "Wyciszone dla mnie",
|
||||||
|
"screen_share_volume": "Głośność udostępniania ekranu",
|
||||||
"volume": "Głośność",
|
"volume": "Głośność",
|
||||||
"waiting_for_media": "Oczekiwanie na media..."
|
"waiting_for_media": "Oczekiwanie na media..."
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-10
@@ -30,8 +30,8 @@
|
|||||||
"test:storybook": "vitest --project=storybook",
|
"test:storybook": "vitest --project=storybook",
|
||||||
"test:unit": "vitest --project=unit",
|
"test:unit": "vitest --project=unit",
|
||||||
"test:coverage": "vitest --coverage",
|
"test:coverage": "vitest --coverage",
|
||||||
"backend": "docker-compose -f dev-backend-docker-compose.yml up",
|
"backend": "docker-compose -f docker-compose-dev.yml up",
|
||||||
"backend-playwright": "docker-compose -f playwright-backend-docker-compose.yml -f playwright-backend-docker-compose.override.yml up",
|
"backend-playwright": "docker-compose -f docker-compose-dev.yml -f docker-compose-playwright.yml up",
|
||||||
"test:playwright": "playwright test",
|
"test:playwright": "playwright test",
|
||||||
"test:playwright:open": "pnpm test:playwright --ui",
|
"test:playwright:open": "pnpm test:playwright --ui",
|
||||||
"links:on": "cp scripts/.pnpmfile.cjs .pnpmfile.cjs & pnpm install",
|
"links:on": "cp scripts/.pnpmfile.cjs .pnpmfile.cjs & pnpm install",
|
||||||
@@ -54,6 +54,7 @@
|
|||||||
"@radix-ui/react-slider": "^1.1.2",
|
"@radix-ui/react-slider": "^1.1.2",
|
||||||
"@radix-ui/react-visually-hidden": "^1.0.3",
|
"@radix-ui/react-visually-hidden": "^1.0.3",
|
||||||
"@react-spring/web": "^10.0.0",
|
"@react-spring/web": "^10.0.0",
|
||||||
|
"@rolldown/plugin-babel": "^0.2.3",
|
||||||
"@sentry/react": "^8.0.0",
|
"@sentry/react": "^8.0.0",
|
||||||
"@sentry/vite-plugin": "^3.0.0",
|
"@sentry/vite-plugin": "^3.0.0",
|
||||||
"@storybook/addon-docs": "^10.3.6",
|
"@storybook/addon-docs": "^10.3.6",
|
||||||
@@ -76,17 +77,18 @@
|
|||||||
"@typescript-eslint/utils": "^8.61.0",
|
"@typescript-eslint/utils": "^8.61.0",
|
||||||
"@use-gesture/react": "^10.2.11",
|
"@use-gesture/react": "^10.2.11",
|
||||||
"@vector-im/compound-design-tokens": "^10.0.0",
|
"@vector-im/compound-design-tokens": "^10.0.0",
|
||||||
"@vector-im/compound-web": "^9.3.0",
|
"@vector-im/compound-web": "^10.0.0",
|
||||||
"@vitejs/plugin-react": "^6.0.2",
|
"@vitejs/plugin-react": "^6.0.2",
|
||||||
"@vitest/browser-playwright": "^4.1.5",
|
"@vitest/browser-playwright": "^4.1.5",
|
||||||
"@vitest/coverage-v8": "^4.0.18",
|
"@vitest/coverage-v8": "^4.0.18",
|
||||||
"@vitest/ui": "4.1.9",
|
"@vitest/ui": "4.1.10",
|
||||||
|
"babel-plugin-react-compiler": "^1.0.0",
|
||||||
"classnames": "^2.3.1",
|
"classnames": "^2.3.1",
|
||||||
"copy-to-clipboard": "^3.3.3",
|
"copy-to-clipboard": "^3.3.3",
|
||||||
"eslint-plugin-element-call": "link:eslint",
|
"eslint-plugin-element-call": "link:eslint",
|
||||||
"eslint-plugin-storybook": "^10.3.6",
|
"eslint-plugin-storybook": "^10.3.6",
|
||||||
"fetch-mock": "11.1.5",
|
"fetch-mock": "11.1.5",
|
||||||
"i18next": "^25.0.0",
|
"i18next": "^26.0.0",
|
||||||
"i18next-browser-languagedetector": "^8.0.0",
|
"i18next-browser-languagedetector": "^8.0.0",
|
||||||
"i18next-cli": "^1.61.0",
|
"i18next-cli": "^1.61.0",
|
||||||
"jsdom": "^26.0.0",
|
"jsdom": "^26.0.0",
|
||||||
@@ -95,17 +97,17 @@
|
|||||||
"lodash-es": "^4.17.21",
|
"lodash-es": "^4.17.21",
|
||||||
"loglevel": "^1.9.1",
|
"loglevel": "^1.9.1",
|
||||||
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
|
"matrix-js-sdk": "github:matrix-org/matrix-js-sdk#develop",
|
||||||
"matrix-widget-api": "^1.16.1",
|
"matrix-widget-api": "^1.18.0",
|
||||||
"node-stdlib-browser": "^1.3.1",
|
"node-stdlib-browser": "^1.3.1",
|
||||||
"normalize.css": "^8.0.1",
|
"normalize.css": "^8.0.1",
|
||||||
"observable-hooks": "^4.2.3",
|
"observable-hooks": "^4.2.3",
|
||||||
"oxfmt": "^0.56.0",
|
"oxfmt": "^0.61.0",
|
||||||
"oxlint": "^1.70.0",
|
"oxlint": "^1.70.0",
|
||||||
"oxlint-tsgolint": "^0.23.0",
|
"oxlint-tsgolint": "^0.25.0",
|
||||||
"pako": "^2.0.4",
|
"pako": "^2.0.4",
|
||||||
"postcss": "^8.4.41",
|
"postcss": "^8.4.41",
|
||||||
"postcss-preset-env": "^10.0.0",
|
"postcss-preset-env": "^10.0.0",
|
||||||
"posthog-js": "1.374.0",
|
"posthog-js": "1.408.2",
|
||||||
"qrcode": "^1.5.4",
|
"qrcode": "^1.5.4",
|
||||||
"react": "19",
|
"react": "19",
|
||||||
"react-dom": "19",
|
"react-dom": "19",
|
||||||
@@ -129,5 +131,5 @@
|
|||||||
"vitest": "^4.1.5",
|
"vitest": "^4.1.5",
|
||||||
"vitest-axe": "^1.0.0-pre.3"
|
"vitest-axe": "^1.0.0-pre.3"
|
||||||
},
|
},
|
||||||
"packageManager": "pnpm@11.6.0+sha512.9a36518224080c6fe5165afdcfe79bfa118c29be703f3f462b1e32efe1e98e47e8750b148e08286250aad4113cc7993ca413c4e2cd447752708c2ee5751bc95f"
|
"packageManager": "pnpm@11.21.0+sha512.521705bce689924eac72f5a3587122f362689ef6571e55ba80076fd637c11132ecffada26fad4ea79c485bfddbfd3d5a2a5b05805a77e893de71ec8a6cca3bb1"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
services:
|
|
||||||
synapse:
|
|
||||||
volumes:
|
|
||||||
- ./backend/playwright_homeserver.yaml:/data/cfg/homeserver.yaml:Z
|
|
||||||
synapse-1:
|
|
||||||
volumes:
|
|
||||||
- ./backend/playwright_homeserver-othersite.yaml:/data/cfg/homeserver.yaml:Z
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
include:
|
|
||||||
- dev-backend-docker-compose.yml
|
|
||||||
@@ -101,9 +101,7 @@ async function setRtcModeFromSettings(
|
|||||||
|
|
||||||
// Move to Developer tab now
|
// Move to Developer tab now
|
||||||
await page.getByRole("tab", { name: "Developer" }).click();
|
await page.getByRole("tab", { name: "Developer" }).click();
|
||||||
if (mode == "legacy") {
|
if (mode == "2_0") {
|
||||||
await page.getByText("Legacy: state events").click();
|
|
||||||
} else if (mode == "2_0") {
|
|
||||||
await page.getByText("Matrix 2.0").click();
|
await page.getByText("Matrix 2.0").click();
|
||||||
} else {
|
} else {
|
||||||
// compat
|
// compat
|
||||||
|
|||||||
@@ -12,9 +12,7 @@ import { HOST1, HOST2, type RtcMode, TestHelpers } from "./test-helpers";
|
|||||||
|
|
||||||
const modePairs: [RtcMode, RtcMode][] = [
|
const modePairs: [RtcMode, RtcMode][] = [
|
||||||
["compat", "compat"],
|
["compat", "compat"],
|
||||||
["legacy", "legacy"],
|
// TODO: Compatibility + Matrix 2.0?
|
||||||
["legacy", "compat"],
|
|
||||||
["compat", "legacy"],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
modePairs.forEach(([rtcMode1, rtcMode2]) => {
|
modePairs.forEach(([rtcMode1, rtcMode2]) => {
|
||||||
|
|||||||
@@ -1,85 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2026 Element Creations Ltd.
|
|
||||||
|
|
||||||
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
||||||
Please see LICENSE in the repository root for full details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { expect, test } from "@playwright/test";
|
|
||||||
|
|
||||||
import { widgetTest } from "../fixtures/widget-user";
|
|
||||||
import { HOST1, HOST2, TestHelpers } from "./test-helpers";
|
|
||||||
|
|
||||||
widgetTest(
|
|
||||||
"Bug new joiner was not publishing on correct SFU",
|
|
||||||
async ({ addUser, browserName }) => {
|
|
||||||
test.skip(
|
|
||||||
browserName === "firefox",
|
|
||||||
"This is a bug in the old widget, not a browser problem.",
|
|
||||||
);
|
|
||||||
|
|
||||||
test.slow();
|
|
||||||
|
|
||||||
// 2 users in federation
|
|
||||||
const florian = await addUser("floriant", HOST1);
|
|
||||||
const timo = await addUser("timo", HOST2);
|
|
||||||
|
|
||||||
// Florian creates a room and invites Timo to it
|
|
||||||
const roomName = "Call Room";
|
|
||||||
await TestHelpers.createRoom(roomName, florian.page, [timo.mxId]);
|
|
||||||
|
|
||||||
// Timo joins the room
|
|
||||||
await TestHelpers.acceptRoomInvite(roomName, timo.page);
|
|
||||||
|
|
||||||
// Ensure we are in legacy mode (should be the default)
|
|
||||||
await TestHelpers.openWidgetSetEmbeddedElementCallRtcModeCloseWidget(
|
|
||||||
florian.page,
|
|
||||||
"legacy",
|
|
||||||
);
|
|
||||||
await TestHelpers.openWidgetSetEmbeddedElementCallRtcModeCloseWidget(
|
|
||||||
timo.page,
|
|
||||||
"legacy",
|
|
||||||
);
|
|
||||||
|
|
||||||
// Let timo create a call
|
|
||||||
await TestHelpers.startCallInCurrentRoom(timo.page, false);
|
|
||||||
await TestHelpers.joinCallFromLobby(timo.page);
|
|
||||||
|
|
||||||
// We want to simulate that the oldest membership authentication is way slower than
|
|
||||||
// the preffered auth.
|
|
||||||
// In this setup, timo advertised$ transport will be it's own, and the active will be the one from florian
|
|
||||||
await florian.page.route(
|
|
||||||
"**/matrix-rtc.othersite.m.localhost/livekit/jwt/**",
|
|
||||||
async (route) => {
|
|
||||||
await new Promise((resolve) => setTimeout(resolve, 2000)); // 5 second delay
|
|
||||||
await route.continue();
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
// Florian joins the call
|
|
||||||
await expect(florian.page.getByTestId("join-call-button")).toBeVisible();
|
|
||||||
await florian.page.getByTestId("join-call-button").click();
|
|
||||||
await TestHelpers.joinCallFromLobby(florian.page);
|
|
||||||
|
|
||||||
await florian.page.waitForTimeout(3000);
|
|
||||||
await timo.page.waitForTimeout(3000);
|
|
||||||
|
|
||||||
// We should see 2 video tiles everywhere now
|
|
||||||
for (const user of [timo, florian]) {
|
|
||||||
const frame = user.page
|
|
||||||
.locator('iframe[title="Element Call"]')
|
|
||||||
.contentFrame();
|
|
||||||
await expect(frame.getByTestId("videoTile")).toHaveCount(2);
|
|
||||||
|
|
||||||
// No one should be waiting for media
|
|
||||||
await expect(frame.getByText("Waiting for media...")).not.toBeVisible();
|
|
||||||
|
|
||||||
// There should be 2 video elements, visible and autoplaying
|
|
||||||
await expect(frame.locator("video")).toHaveCount(2, {
|
|
||||||
timeout: 10000,
|
|
||||||
});
|
|
||||||
|
|
||||||
await TestHelpers.expectVisibleVideoCount(frame, 2);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
);
|
|
||||||
@@ -1,91 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2026 Element Creations Ltd.
|
|
||||||
|
|
||||||
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
||||||
Please see LICENSE in the repository root for full details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { expect, test } from "@playwright/test";
|
|
||||||
|
|
||||||
import { widgetTest } from "../fixtures/widget-user";
|
|
||||||
import { HOST1, HOST2, TestHelpers } from "./test-helpers";
|
|
||||||
|
|
||||||
// ## Issue
|
|
||||||
// This test reproduces an issue with the publisher.
|
|
||||||
// When switching local focus, we need to recreate the publisher.
|
|
||||||
// This failed because of a dead lock in the old publishers destruction.
|
|
||||||
//
|
|
||||||
// There are numerus ways to enforece this situation:
|
|
||||||
// - oldest member swap (manually set the oldest member focus and leave with the prev oldest member)
|
|
||||||
// This almost never happens in the real worls since clients will set their preferredFoci list to what the oldest member is.
|
|
||||||
// - switch from oldest member to multi sfu as the NOT the first joiner + the first joiner is on a different sfu than your preferred sfu.
|
|
||||||
//
|
|
||||||
// This test uses the "switch from oldest member to multi sfu" approach.
|
|
||||||
//
|
|
||||||
// It is a copy of federated-call.test.ts in the `["legacy", "legacy"]` setup,
|
|
||||||
// which once connected will make the second user switch to multi sfu.
|
|
||||||
widgetTest(
|
|
||||||
`Test swapping publisher from ${HOST1} to ${HOST2}`,
|
|
||||||
async ({ addUser, browserName }) => {
|
|
||||||
test.slow();
|
|
||||||
test.skip(
|
|
||||||
browserName === "firefox",
|
|
||||||
"The is test is not working on firefox CI environment. No mic/audio device inputs so cam/mic are disabled",
|
|
||||||
);
|
|
||||||
|
|
||||||
const florian = await addUser("floriant", HOST1);
|
|
||||||
const timo = await addUser("timo", HOST2);
|
|
||||||
|
|
||||||
const roomName = "Call Room";
|
|
||||||
|
|
||||||
await TestHelpers.createRoom(roomName, florian.page, [timo.mxId]);
|
|
||||||
|
|
||||||
await TestHelpers.acceptRoomInvite(roomName, timo.page);
|
|
||||||
|
|
||||||
await florian.page.pause();
|
|
||||||
|
|
||||||
await TestHelpers.openWidgetSetEmbeddedElementCallRtcModeCloseWidget(
|
|
||||||
florian.page,
|
|
||||||
"legacy",
|
|
||||||
);
|
|
||||||
await TestHelpers.openWidgetSetEmbeddedElementCallRtcModeCloseWidget(
|
|
||||||
timo.page,
|
|
||||||
"legacy",
|
|
||||||
);
|
|
||||||
|
|
||||||
await TestHelpers.startCallInCurrentRoom(florian.page, false);
|
|
||||||
await TestHelpers.joinCallFromLobby(florian.page);
|
|
||||||
|
|
||||||
// timo joins
|
|
||||||
await TestHelpers.joinCallInCurrentRoom(timo.page);
|
|
||||||
|
|
||||||
// We should see 2 video tiles everywhere now
|
|
||||||
for (const user of [timo, florian]) {
|
|
||||||
const frame = user.page
|
|
||||||
.locator('iframe[title="Element Call"]')
|
|
||||||
.contentFrame();
|
|
||||||
await expect(frame.getByTestId("videoTile")).toHaveCount(2);
|
|
||||||
|
|
||||||
// Wait for "Waiting for media..." to disappear (with timeout)
|
|
||||||
await expect(frame.getByText("Waiting for media...")).not.toBeVisible({
|
|
||||||
timeout: 10000, // Maximum time to wait
|
|
||||||
});
|
|
||||||
|
|
||||||
// There should be 2 video elements, visible and autoplaying
|
|
||||||
await expect(frame.locator("video")).toHaveCount(2, {
|
|
||||||
timeout: 10000,
|
|
||||||
});
|
|
||||||
|
|
||||||
await TestHelpers.expectVisibleVideoCount(frame, 2);
|
|
||||||
}
|
|
||||||
|
|
||||||
// now we switch the mode for timo (second joiner on multi-sfu HOST2 but currently HOST1)
|
|
||||||
await TestHelpers.setEmbeddedElementCallRtcMode(timo.page, "compat");
|
|
||||||
await timo.page.waitForTimeout(3000);
|
|
||||||
|
|
||||||
await TestHelpers.expectVisibleVideoCount(
|
|
||||||
timo.page.locator('iframe[title="Element Call"]').contentFrame(),
|
|
||||||
2,
|
|
||||||
);
|
|
||||||
},
|
|
||||||
);
|
|
||||||
@@ -36,6 +36,7 @@ widgetTest("Footer interaction in PiP", async ({ addUser, browserName }) => {
|
|||||||
await valere.page.waitForTimeout(600);
|
await valere.page.waitForTimeout(600);
|
||||||
|
|
||||||
// Switch to the other room, the call should go to PIP
|
// Switch to the other room, the call should go to PIP
|
||||||
|
await TestHelpers.expandRoomList(valere.page);
|
||||||
await TestHelpers.switchToRoomNamed(valere.page, "OtherRoom");
|
await TestHelpers.switchToRoomNamed(valere.page, "OtherRoom");
|
||||||
|
|
||||||
// We should see the PIP overlay
|
// We should see the PIP overlay
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ widgetTest("Put call in PIP", async ({ addUser, browserName }) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Switch to the other room, the call should go to PIP
|
// Switch to the other room, the call should go to PIP
|
||||||
|
await TestHelpers.expandRoomList(valere.page);
|
||||||
await TestHelpers.switchToRoomNamed(valere.page, "DoubleTask");
|
await TestHelpers.switchToRoomNamed(valere.page, "DoubleTask");
|
||||||
|
|
||||||
// We should see the PIP overlay
|
// We should see the PIP overlay
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ const PASSWORD = "foobarbaz1!";
|
|||||||
export const HOST1 = "https://app.m.localhost/#/welcome";
|
export const HOST1 = "https://app.m.localhost/#/welcome";
|
||||||
export const HOST2 = "https://app.othersite.m.localhost/#/welcome";
|
export const HOST2 = "https://app.othersite.m.localhost/#/welcome";
|
||||||
|
|
||||||
export type RtcMode = "legacy" | "compat" | "2_0";
|
export type RtcMode = "compat" | "2_0";
|
||||||
|
|
||||||
export class TestHelpers {
|
export class TestHelpers {
|
||||||
public static async startCallInCurrentRoom(
|
public static async startCallInCurrentRoom(
|
||||||
@@ -73,9 +73,6 @@ export class TestHelpers {
|
|||||||
audioOnly: boolean = false,
|
audioOnly: boolean = false,
|
||||||
isDM: boolean = false,
|
isDM: boolean = false,
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
// XXX This using the notification toast to join the room.
|
|
||||||
// Not the button in the header
|
|
||||||
|
|
||||||
await page.waitForTimeout(3000);
|
await page.waitForTimeout(3000);
|
||||||
const label = isDM
|
const label = isDM
|
||||||
? audioOnly
|
? audioOnly
|
||||||
@@ -85,7 +82,9 @@ export class TestHelpers {
|
|||||||
await expect(page.getByText(label)).toBeVisible({
|
await expect(page.getByText(label)).toBeVisible({
|
||||||
timeout: 10000,
|
timeout: 10000,
|
||||||
});
|
});
|
||||||
await page.getByRole("button", { name: "Join" }).click({
|
// XXX This using the notification toast to join the room.
|
||||||
|
// Not the buttons in the header or timeline
|
||||||
|
await page.getByRole("alert").getByRole("button", { name: "Join" }).click({
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -310,9 +309,7 @@ export class TestHelpers {
|
|||||||
|
|
||||||
// Move to Developer tab now
|
// Move to Developer tab now
|
||||||
await iframe.getByRole("tab", { name: "Developer" }).click();
|
await iframe.getByRole("tab", { name: "Developer" }).click();
|
||||||
if (mode == "legacy") {
|
if (mode == "2_0") {
|
||||||
await iframe.getByText("Legacy: state events").click();
|
|
||||||
} else if (mode == "2_0") {
|
|
||||||
await iframe.getByText("Matrix 2.0").click();
|
await iframe.getByText("Matrix 2.0").click();
|
||||||
} else {
|
} else {
|
||||||
// compat
|
// compat
|
||||||
@@ -347,6 +344,12 @@ export class TestHelpers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static async expandRoomList(page: Page): Promise<void> {
|
||||||
|
await page
|
||||||
|
.getByRole("separator", { name: "Click or drag to expand" })
|
||||||
|
.click();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Switches to a room in the room list by its name.
|
* Switches to a room in the room list by its name.
|
||||||
* @param page - The EW page
|
* @param page - The EW page
|
||||||
|
|||||||
@@ -39,7 +39,10 @@ widgetTest(
|
|||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
|
||||||
await expect(whistler.page.getByText("Incoming voice call")).toBeVisible();
|
await expect(whistler.page.getByText("Incoming voice call")).toBeVisible();
|
||||||
await whistler.page.getByRole("button", { name: "Join" }).click();
|
await whistler.page
|
||||||
|
.getByRole("alert")
|
||||||
|
.getByRole("button", { name: "Join" })
|
||||||
|
.click();
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
whistler.page.locator('iframe[title="Element Call"]'),
|
whistler.page.locator('iframe[title="Element Call"]'),
|
||||||
@@ -129,7 +132,10 @@ widgetTest(
|
|||||||
).toBeVisible();
|
).toBeVisible();
|
||||||
|
|
||||||
await expect(whistler.page.getByText("Incoming video call")).toBeVisible();
|
await expect(whistler.page.getByText("Incoming video call")).toBeVisible();
|
||||||
await whistler.page.getByRole("button", { name: "Join" }).click();
|
await whistler.page
|
||||||
|
.getByRole("alert")
|
||||||
|
.getByRole("button", { name: "Join" })
|
||||||
|
.click();
|
||||||
|
|
||||||
await expect(
|
await expect(
|
||||||
whistler.page.locator('iframe[title="Element Call"]'),
|
whistler.page.locator('iframe[title="Element Call"]'),
|
||||||
|
|||||||
Generated
+2152
-2430
File diff suppressed because it is too large
Load Diff
+29
-6
@@ -1,10 +1,15 @@
|
|||||||
|
minimumReleaseAgeExclude:
|
||||||
|
- "@vector-im/compound-design-tokens"
|
||||||
|
- "@vector-im/compound-web"
|
||||||
|
- matrix-js-sdk
|
||||||
|
- matrix-widget-api
|
||||||
allowBuilds:
|
allowBuilds:
|
||||||
"@parcel/watcher": true
|
"@parcel/watcher": true
|
||||||
"@sentry/cli": true
|
"@sentry/cli": true
|
||||||
"@swc/core": true
|
"@swc/core": true
|
||||||
"core-js": true
|
"core-js": true
|
||||||
"esbuild": true
|
"esbuild": true
|
||||||
"matrix-js-sdk@https://codeload.github.com/matrix-org/matrix-js-sdk/tar.gz/8c95727b6278fe7942c20d0b9485f984dd0694b7": true
|
"matrix-js-sdk@git+https://github.com/matrix-org/matrix-js-sdk.git": true
|
||||||
"protobufjs": true
|
"protobufjs": true
|
||||||
overrides:
|
overrides:
|
||||||
# We need compatible versions of RxJS in our dependencies and LiveKit's dependencies, but
|
# We need compatible versions of RxJS in our dependencies and LiveKit's dependencies, but
|
||||||
@@ -24,12 +29,30 @@ overrides:
|
|||||||
# Security fixes:
|
# Security fixes:
|
||||||
# - https://github.com/element-hq/element-call/security/dependabot/110
|
# - https://github.com/element-hq/element-call/security/dependabot/110
|
||||||
# - https://github.com/element-hq/element-call/security/dependabot/122
|
# - https://github.com/element-hq/element-call/security/dependabot/122
|
||||||
"qs": "^6.14.1"
|
# - https://github.com/element-hq/element-call/security/dependabot/179
|
||||||
# Security fix: https://github.com/element-hq/element-call/security/dependabot/106
|
"qs": "^6.15.2"
|
||||||
"js-yaml": "^4.1.1"
|
# Security fixes:
|
||||||
|
# - https://github.com/element-hq/element-call/security/dependabot/106
|
||||||
|
# - https://github.com/element-hq/element-call/security/dependabot/203
|
||||||
|
"js-yaml": "^4.2.0"
|
||||||
# Storybook declares support for 0.27.0 only but empirically works fine with 0.28.0.
|
# Storybook declares support for 0.27.0 only but empirically works fine with 0.28.0.
|
||||||
"esbuild": "^0.28.0"
|
"esbuild": "^0.28.0"
|
||||||
# Multiple security fixes: https://github.com/nodejs/undici/releases/tag/v6.24.0
|
# Security fixes:
|
||||||
"undici": "^6.24.0"
|
# - https://github.com/nodejs/undici/releases/tag/v6.24.0
|
||||||
|
# - https://github.com/element-hq/element-call/security/dependabot/201
|
||||||
|
# - https://github.com/element-hq/element-call/security/dependabot/199
|
||||||
|
"undici": "^6.27.0"
|
||||||
# Security fix: https://github.com/advisories/GHSA-rf6f-7fwh-wjgh
|
# Security fix: https://github.com/advisories/GHSA-rf6f-7fwh-wjgh
|
||||||
"flatted": "^3.4.2"
|
"flatted": "^3.4.2"
|
||||||
|
# Security fix: https://github.com/element-hq/element-call/security/dependabot/184
|
||||||
|
"ws": "^8.21.0"
|
||||||
|
# Security fixes:
|
||||||
|
# - https://github.com/element-hq/element-call/security/dependabot/191
|
||||||
|
# - https://github.com/element-hq/element-call/security/dependabot/190
|
||||||
|
# - https://github.com/element-hq/element-call/security/dependabot/192
|
||||||
|
# - https://github.com/element-hq/element-call/security/dependabot/194
|
||||||
|
# - https://github.com/element-hq/element-call/security/dependabot/198
|
||||||
|
# - https://github.com/element-hq/element-call/security/dependabot/196
|
||||||
|
# - https://github.com/element-hq/element-call/security/dependabot/195
|
||||||
|
# - https://github.com/element-hq/element-call/security/dependabot/193
|
||||||
|
"dompurify": "^3.4.11"
|
||||||
|
|||||||
@@ -61,6 +61,15 @@
|
|||||||
{
|
{
|
||||||
"groupName": "Pnpm",
|
"groupName": "Pnpm",
|
||||||
"matchDepNames": ["pnpm"]
|
"matchDepNames": ["pnpm"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Update the element-web image digest daily, in its own PR",
|
||||||
|
"groupName": "Element Web",
|
||||||
|
"matchPackageNames": ["ghcr.io/element-hq/element-web"],
|
||||||
|
"matchUpdateTypes": ["digest"],
|
||||||
|
"schedule": ["* 0-3 * * *"],
|
||||||
|
"minimumReleaseAge": null,
|
||||||
|
"automerge": true
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"semanticCommits": "disabled",
|
"semanticCommits": "disabled",
|
||||||
|
|||||||
+14
-1
@@ -31,6 +31,11 @@ interface Props {
|
|||||||
max: number;
|
max: number;
|
||||||
step: number;
|
step: number;
|
||||||
disabled?: boolean;
|
disabled?: boolean;
|
||||||
|
/**
|
||||||
|
* Custom formatter for the tooltip label. If not provided, the value is
|
||||||
|
* displayed as a percentage.
|
||||||
|
*/
|
||||||
|
tooltipFormatter?: (value: number) => string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -46,6 +51,7 @@ export const Slider: FC<Props> = ({
|
|||||||
max,
|
max,
|
||||||
step,
|
step,
|
||||||
disabled,
|
disabled,
|
||||||
|
tooltipFormatter,
|
||||||
}) => {
|
}) => {
|
||||||
const onValueChange = useCallback(
|
const onValueChange = useCallback(
|
||||||
([v]: number[]) => onValueChangeProp(v),
|
([v]: number[]) => onValueChangeProp(v),
|
||||||
@@ -71,7 +77,14 @@ export const Slider: FC<Props> = ({
|
|||||||
<Range className={styles.highlight} />
|
<Range className={styles.highlight} />
|
||||||
</Track>
|
</Track>
|
||||||
{/* Note: This is expected not to be visible on mobile.*/}
|
{/* Note: This is expected not to be visible on mobile.*/}
|
||||||
<Tooltip placement="top" label={Math.round(value * 100).toString() + "%"}>
|
<Tooltip
|
||||||
|
placement="top"
|
||||||
|
label={
|
||||||
|
tooltipFormatter
|
||||||
|
? tooltipFormatter(value)
|
||||||
|
: Math.round(value * 100).toString() + "%"
|
||||||
|
}
|
||||||
|
>
|
||||||
<Thumb className={styles.handle} aria-label={label} />
|
<Thumb className={styles.handle} aria-label={label} />
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Root>
|
</Root>
|
||||||
|
|||||||
@@ -16,12 +16,15 @@ import {
|
|||||||
HeaderStyle,
|
HeaderStyle,
|
||||||
getUrlParams,
|
getUrlParams,
|
||||||
} from "../src/UrlParams";
|
} from "../src/UrlParams";
|
||||||
|
import { mockConfig } from "./utils/test";
|
||||||
|
|
||||||
const ROOM_NAME = "roomNameHere";
|
const ROOM_NAME = "roomNameHere";
|
||||||
const ROOM_ID = "!d45f138fsd";
|
const ROOM_ID = "!d45f138fsd";
|
||||||
const ORIGIN = "https://call.element.io";
|
const ORIGIN = "https://call.element.io";
|
||||||
const HOMESERVER = "localhost";
|
const HOMESERVER = "localhost";
|
||||||
|
|
||||||
|
mockConfig();
|
||||||
|
|
||||||
describe("UrlParams", () => {
|
describe("UrlParams", () => {
|
||||||
describe("handles URL with /room/", () => {
|
describe("handles URL with /room/", () => {
|
||||||
it("and nothing else", () => {
|
it("and nothing else", () => {
|
||||||
|
|||||||
@@ -16,10 +16,12 @@ import inCallViewStyles from "../room/InCallView.module.css";
|
|||||||
import { useStaticViewModel } from "../state/ViewModel";
|
import { useStaticViewModel } from "../state/ViewModel";
|
||||||
import { ReactionsSenderContext } from "../reactions/useReactionsSender";
|
import { ReactionsSenderContext } from "../reactions/useReactionsSender";
|
||||||
import { type ReactionOption } from "../reactions";
|
import { type ReactionOption } from "../reactions";
|
||||||
import { type GridMode } from "../state/CallViewModel/CallViewModel";
|
|
||||||
import { MediaDevicesContext } from "../MediaDevicesContext";
|
import { MediaDevicesContext } from "../MediaDevicesContext";
|
||||||
import { MediaDevices } from "../state/MediaDevices";
|
import { MediaDevices } from "../state/MediaDevices";
|
||||||
import { globalScope } from "../state/ObservableScope";
|
import { globalScope } from "../state/ObservableScope";
|
||||||
|
import { constant } from "../state/Behavior";
|
||||||
|
import { type LayoutMode } from "../state/LayoutSwitchViewModel";
|
||||||
|
|
||||||
// consts for tests
|
// consts for tests
|
||||||
const reactionIdentifier = "@user:example.com:DEVICE";
|
const reactionIdentifier = "@user:example.com:DEVICE";
|
||||||
const reactionData = {
|
const reactionData = {
|
||||||
@@ -32,6 +34,7 @@ const mediaDevices = new MediaDevices(globalScope);
|
|||||||
/**
|
/**
|
||||||
* A wrapper component that is used for:
|
* A wrapper component that is used for:
|
||||||
* - exposing the snapshot via props so the storybook documents the snapshot properties (basically unpack them form the vm)
|
* - exposing the snapshot via props so the storybook documents the snapshot properties (basically unpack them form the vm)
|
||||||
|
* - constructing the layout switch view model
|
||||||
* - Add additional react context
|
* - Add additional react context
|
||||||
* The paraeters are all params from the FooterSnapshot,
|
* The paraeters are all params from the FooterSnapshot,
|
||||||
* the Snapshot of the vm, the wrapper will create a mocked vm from it and pass it to the CallFooter.
|
* the Snapshot of the vm, the wrapper will create a mocked vm from it and pass it to the CallFooter.
|
||||||
@@ -40,11 +43,18 @@ const mediaDevices = new MediaDevices(globalScope);
|
|||||||
*/
|
*/
|
||||||
function CallFooterStoryWrapper({
|
function CallFooterStoryWrapper({
|
||||||
children,
|
children,
|
||||||
|
layout,
|
||||||
|
setLayout,
|
||||||
...vmSnapshot
|
...vmSnapshot
|
||||||
}: FooterSnapshot & {
|
}: Omit<FooterSnapshot, "layoutSwitchVm"> & {
|
||||||
children?: false | JSX.Element | JSX.Element[] | undefined;
|
children?: false | JSX.Element | JSX.Element[] | undefined;
|
||||||
|
layout: LayoutMode | null;
|
||||||
|
setLayout: (value: LayoutMode) => void;
|
||||||
}): ReactNode {
|
}): ReactNode {
|
||||||
const vm = useStaticViewModel(vmSnapshot);
|
const vm = useStaticViewModel({
|
||||||
|
...vmSnapshot,
|
||||||
|
layoutSwitchVm: layout && { layout$: constant(layout), setLayout },
|
||||||
|
});
|
||||||
return (
|
return (
|
||||||
<MediaDevicesContext value={mediaDevices}>
|
<MediaDevicesContext value={mediaDevices}>
|
||||||
<div className={inCallViewStyles.inRoom}>
|
<div className={inCallViewStyles.inRoom}>
|
||||||
@@ -62,28 +72,50 @@ function CallFooterStoryWrapper({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const meta = {
|
|
||||||
component: CallFooterStoryWrapper,
|
|
||||||
} satisfies Meta<typeof CallFooterStoryWrapper>;
|
|
||||||
|
|
||||||
export default meta;
|
|
||||||
type Story = StoryObj<typeof meta>;
|
|
||||||
|
|
||||||
const fnArgType = {
|
const fnArgType = {
|
||||||
control: { type: "select" as const },
|
control: { type: "select" as const },
|
||||||
options: ["MockedCallback", "undefined"],
|
options: ["MockedCallback", "undefined"],
|
||||||
mapping: { MockedCallback: fn(), undefined: undefined },
|
mapping: { MockedCallback: fn(), undefined: undefined },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const meta = {
|
||||||
|
component: CallFooterStoryWrapper,
|
||||||
|
argTypes: {
|
||||||
|
layout: {
|
||||||
|
control: "radio",
|
||||||
|
options: ["grid", "spotlight"] satisfies LayoutMode[],
|
||||||
|
},
|
||||||
|
audioOutputSwitcher: {
|
||||||
|
control: "select",
|
||||||
|
options: ["NoOutputCallback", "speaker", "earpiece"],
|
||||||
|
table: { defaultValue: { summary: "NoOutputCallback" } },
|
||||||
|
mapping: {
|
||||||
|
NoOutputCallback: undefined,
|
||||||
|
// This is inverersed (speaker<->earpice) because the switcher object stores the target output, not the current one.
|
||||||
|
speaker: { targetOutput: "earpiece", switch: fn() },
|
||||||
|
earpiece: { targetOutput: "speaker", switch: fn() },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
toggleScreenSharing: fnArgType,
|
||||||
|
openSettings: fnArgType,
|
||||||
|
toggleAudio: fnArgType,
|
||||||
|
toggleVideo: fnArgType,
|
||||||
|
hangup: fnArgType,
|
||||||
|
},
|
||||||
|
} satisfies Meta<typeof CallFooterStoryWrapper>;
|
||||||
|
|
||||||
|
export default meta;
|
||||||
|
type Story = StoryObj<typeof meta>;
|
||||||
|
|
||||||
export const Default: Story = {
|
export const Default: Story = {
|
||||||
args: {
|
args: {
|
||||||
showLogo: false,
|
showLogo: false,
|
||||||
layoutMode: "grid",
|
layout: "grid",
|
||||||
|
setLayout: fn(),
|
||||||
audioEnabled: true,
|
audioEnabled: true,
|
||||||
audioBusy: false,
|
audioBusy: false,
|
||||||
videoEnabled: true,
|
videoEnabled: true,
|
||||||
videoBusy: false,
|
videoBusy: false,
|
||||||
setLayoutMode: fn(),
|
|
||||||
openSettings: fn(),
|
openSettings: fn(),
|
||||||
toggleAudio: fn(),
|
toggleAudio: fn(),
|
||||||
toggleVideo: fn(),
|
toggleVideo: fn(),
|
||||||
@@ -95,6 +127,7 @@ export const Default: Story = {
|
|||||||
showFooter: true,
|
showFooter: true,
|
||||||
hideControls: false,
|
hideControls: false,
|
||||||
asOverlay: false,
|
asOverlay: false,
|
||||||
|
showModals: true,
|
||||||
sharingScreen: false,
|
sharingScreen: false,
|
||||||
audioOutputSwitcher: undefined,
|
audioOutputSwitcher: undefined,
|
||||||
reactionIdentifier: undefined,
|
reactionIdentifier: undefined,
|
||||||
@@ -111,29 +144,6 @@ export const Default: Story = {
|
|||||||
parameters: {
|
parameters: {
|
||||||
layout: "fullscreen",
|
layout: "fullscreen",
|
||||||
},
|
},
|
||||||
argTypes: {
|
|
||||||
layoutMode: {
|
|
||||||
control: "radio",
|
|
||||||
options: ["grid", "spotlight"] satisfies GridMode[],
|
|
||||||
},
|
|
||||||
audioOutputSwitcher: {
|
|
||||||
control: "select",
|
|
||||||
options: ["NoOutputCallback", "speaker", "earpiece"],
|
|
||||||
table: { defaultValue: { summary: "NoOutputCallback" } },
|
|
||||||
mapping: {
|
|
||||||
NoOutputCallback: undefined,
|
|
||||||
// This is inverersed (speaker<->earpice) because the switcher object stores the target output, not the current one.
|
|
||||||
speaker: { targetOutput: "earpiece", switch: fn() },
|
|
||||||
earpiece: { targetOutput: "speaker", switch: fn() },
|
|
||||||
},
|
|
||||||
},
|
|
||||||
toggleScreenSharing: fnArgType,
|
|
||||||
setLayoutMode: fnArgType,
|
|
||||||
openSettings: fnArgType,
|
|
||||||
toggleAudio: fnArgType,
|
|
||||||
toggleVideo: fnArgType,
|
|
||||||
hangup: fnArgType,
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const WithAudioAndVideoOptions: Story = {
|
export const WithAudioAndVideoOptions: Story = {
|
||||||
@@ -194,7 +204,7 @@ export const AudioVideoEnabled: Story = {
|
|||||||
|
|
||||||
const spotlightRadio = canvas.getByRole("radio", { name: "Spotlight" });
|
const spotlightRadio = canvas.getByRole("radio", { name: "Spotlight" });
|
||||||
await userEvent.click(spotlightRadio);
|
await userEvent.click(spotlightRadio);
|
||||||
await expect(args.setLayoutMode).toHaveBeenCalledWith("spotlight");
|
await expect(args.setLayout).toHaveBeenCalledWith("spotlight");
|
||||||
|
|
||||||
const micButtonMute = canvas.getByRole("switch", {
|
const micButtonMute = canvas.getByRole("switch", {
|
||||||
name: "Mute microphone",
|
name: "Mute microphone",
|
||||||
@@ -225,14 +235,14 @@ export const SpotlightMode: Story = {
|
|||||||
...Default,
|
...Default,
|
||||||
args: {
|
args: {
|
||||||
...Default.args,
|
...Default.args,
|
||||||
layoutMode: "spotlight",
|
layout: "spotlight",
|
||||||
},
|
},
|
||||||
play: async ({ args, canvasElement }) => {
|
play: async ({ args, canvasElement }) => {
|
||||||
const canvas = within(canvasElement);
|
const canvas = within(canvasElement);
|
||||||
|
|
||||||
const spotlightRadio = canvas.getByRole("radio", { name: "Grid" });
|
const spotlightRadio = canvas.getByRole("radio", { name: "Grid" });
|
||||||
await userEvent.click(spotlightRadio);
|
await userEvent.click(spotlightRadio);
|
||||||
await expect(args.setLayoutMode).toHaveBeenCalledWith("grid");
|
await expect(args.setLayout).toHaveBeenCalledWith("grid");
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -264,7 +274,7 @@ export const Pip: Story = {
|
|||||||
args: {
|
args: {
|
||||||
...Default.args,
|
...Default.args,
|
||||||
buttonSize: "md",
|
buttonSize: "md",
|
||||||
layoutMode: undefined,
|
layout: null,
|
||||||
},
|
},
|
||||||
play: async ({ args, canvasElement }) => {
|
play: async ({ args, canvasElement }) => {
|
||||||
const canvas = within(canvasElement);
|
const canvas = within(canvasElement);
|
||||||
@@ -348,7 +358,7 @@ export const Lobby: Story = {
|
|||||||
...Default.args,
|
...Default.args,
|
||||||
showLogo: false,
|
showLogo: false,
|
||||||
openSettings: undefined,
|
openSettings: undefined,
|
||||||
setLayoutMode: undefined,
|
layout: null,
|
||||||
toggleScreenSharing: undefined,
|
toggleScreenSharing: undefined,
|
||||||
},
|
},
|
||||||
parameters: {
|
parameters: {
|
||||||
@@ -362,7 +372,7 @@ export const LobbyMobile: Story = {
|
|||||||
...Default.args,
|
...Default.args,
|
||||||
showLogo: false,
|
showLogo: false,
|
||||||
|
|
||||||
setLayoutMode: undefined,
|
layout: null,
|
||||||
toggleScreenSharing: undefined,
|
toggleScreenSharing: undefined,
|
||||||
},
|
},
|
||||||
globals: {
|
globals: {
|
||||||
@@ -379,7 +389,7 @@ export const LobbyRecentButton: Story = {
|
|||||||
...Default.args,
|
...Default.args,
|
||||||
children: <Link>Back To Recents</Link>,
|
children: <Link>Back To Recents</Link>,
|
||||||
showLogo: false,
|
showLogo: false,
|
||||||
setLayoutMode: undefined,
|
layout: null,
|
||||||
toggleScreenSharing: undefined,
|
toggleScreenSharing: undefined,
|
||||||
},
|
},
|
||||||
parameters: {
|
parameters: {
|
||||||
@@ -393,7 +403,7 @@ export const LobbyRecentButtonMobile: Story = {
|
|||||||
...Default.args,
|
...Default.args,
|
||||||
children: <Link>Back To Recents</Link>,
|
children: <Link>Back To Recents</Link>,
|
||||||
showLogo: false,
|
showLogo: false,
|
||||||
setLayoutMode: undefined,
|
layout: null,
|
||||||
toggleScreenSharing: undefined,
|
toggleScreenSharing: undefined,
|
||||||
},
|
},
|
||||||
globals: {
|
globals: {
|
||||||
|
|||||||
@@ -7,12 +7,6 @@ Please see LICENSE in the repository root for full details.
|
|||||||
|
|
||||||
import { type FC, type JSX, type Ref, useMemo } from "react";
|
import { type FC, type JSX, type Ref, useMemo } from "react";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import {
|
|
||||||
SpotlightIcon,
|
|
||||||
GridIcon,
|
|
||||||
} from "@vector-im/compound-design-tokens/assets/web/icons";
|
|
||||||
import { Switch } from "@vector-im/compound-web";
|
|
||||||
import { t } from "i18next";
|
|
||||||
|
|
||||||
import LogoMark from "../icons/LogoMark.svg?react";
|
import LogoMark from "../icons/LogoMark.svg?react";
|
||||||
import LogoType from "../icons/LogoType.svg?react";
|
import LogoType from "../icons/LogoType.svg?react";
|
||||||
@@ -28,13 +22,15 @@ import {
|
|||||||
type ReactionData,
|
type ReactionData,
|
||||||
} from "../button";
|
} from "../button";
|
||||||
import styles from "./CallFooter.module.css";
|
import styles from "./CallFooter.module.css";
|
||||||
import { type GridMode } from "../state/CallViewModel/CallViewModel";
|
|
||||||
import {
|
import {
|
||||||
MediaMuteAndSwitchButton,
|
MediaMuteAndSwitchButton,
|
||||||
type MenuOptions,
|
type MenuOptions,
|
||||||
} from "./MediaMuteAndSwitchButton";
|
} from "./MediaMuteAndSwitchButton";
|
||||||
|
import { type Behavior } from "../state/Behavior";
|
||||||
import { type ViewModel } from "../state/ViewModel";
|
import { type ViewModel } from "../state/ViewModel";
|
||||||
import { useBehavior } from "../useBehavior";
|
import { useBehavior } from "../useBehavior";
|
||||||
|
import { type LayoutSwitchViewModel } from "../state/LayoutSwitchViewModel";
|
||||||
|
import { LayoutSwitch } from "../room/LayoutSwitch";
|
||||||
|
|
||||||
export interface AudioOutputSwitcher {
|
export interface AudioOutputSwitcher {
|
||||||
targetOutput: string;
|
targetOutput: string;
|
||||||
@@ -61,8 +57,6 @@ export interface FooterActions {
|
|||||||
/** Also controls if the videoMute button is disabled */
|
/** Also controls if the videoMute button is disabled */
|
||||||
toggleVideo: (() => void) | undefined;
|
toggleVideo: (() => void) | undefined;
|
||||||
toggleBlur: (() => void) | undefined;
|
toggleBlur: (() => void) | undefined;
|
||||||
/** Also controls if the layout button is visible */
|
|
||||||
setLayoutMode: ((mode: GridMode) => void) | undefined;
|
|
||||||
toggleScreenSharing: (() => void) | undefined;
|
toggleScreenSharing: (() => void) | undefined;
|
||||||
/** Also controls if the settings button is visible */
|
/** Also controls if the settings button is visible */
|
||||||
openSettings: (() => void) | undefined;
|
openSettings: (() => void) | undefined;
|
||||||
@@ -83,11 +77,13 @@ export interface FooterState {
|
|||||||
/** The footer should be used as an overlay.
|
/** The footer should be used as an overlay.
|
||||||
* (Over the Call Grid) This saves spaces on small screens. */
|
* (Over the Call Grid) This saves spaces on small screens. */
|
||||||
asOverlay: boolean;
|
asOverlay: boolean;
|
||||||
|
showModals: boolean;
|
||||||
|
|
||||||
buttonSize: "md" | "lg";
|
buttonSize: "md" | "lg";
|
||||||
showLogo: boolean;
|
showLogo: boolean;
|
||||||
|
|
||||||
layoutMode: GridMode | undefined;
|
/** Also controls if the layout switch is visible */
|
||||||
|
layoutSwitchVm: LayoutSwitchViewModel | null;
|
||||||
|
|
||||||
sharingScreen: boolean;
|
sharingScreen: boolean;
|
||||||
|
|
||||||
@@ -126,8 +122,8 @@ export const CallFooter: FC<FooterProps> = ({
|
|||||||
const asOverlay = useBehavior(vm.asOverlay$);
|
const asOverlay = useBehavior(vm.asOverlay$);
|
||||||
const showFooter = useBehavior(vm.showFooter$);
|
const showFooter = useBehavior(vm.showFooter$);
|
||||||
const hideControls = useBehavior(vm.hideControls$);
|
const hideControls = useBehavior(vm.hideControls$);
|
||||||
const layoutMode = useBehavior(vm.layoutMode$);
|
const showModals = useBehavior(vm.showModals$);
|
||||||
const setLayoutMode = useBehavior(vm.setLayoutMode$);
|
const layoutSwitchVm = useBehavior(vm.layoutSwitchVm$);
|
||||||
const openSettings = useBehavior(vm.openSettings$);
|
const openSettings = useBehavior(vm.openSettings$);
|
||||||
const audioEnabled = useBehavior(vm.audioEnabled$);
|
const audioEnabled = useBehavior(vm.audioEnabled$);
|
||||||
const audioBusy = useBehavior(vm.audioBusy$);
|
const audioBusy = useBehavior(vm.audioBusy$);
|
||||||
@@ -142,7 +138,6 @@ export const CallFooter: FC<FooterProps> = ({
|
|||||||
const audioOutputSwitcher = useBehavior(vm.audioOutputSwitcher$);
|
const audioOutputSwitcher = useBehavior(vm.audioOutputSwitcher$);
|
||||||
const hangup = useBehavior(vm.hangup$);
|
const hangup = useBehavior(vm.hangup$);
|
||||||
const debugTileLayout = useBehavior(vm.debugTileLayout$);
|
const debugTileLayout = useBehavior(vm.debugTileLayout$);
|
||||||
const tileStoreGeneration = useBehavior(vm.tileStoreGeneration$);
|
|
||||||
const videoOptions = useBehavior(vm.videoOptions$);
|
const videoOptions = useBehavior(vm.videoOptions$);
|
||||||
const selectedVideo = useBehavior(vm.selectedVideo$);
|
const selectedVideo = useBehavior(vm.selectedVideo$);
|
||||||
const audioOptions = useBehavior(vm.audioOptions$);
|
const audioOptions = useBehavior(vm.audioOptions$);
|
||||||
@@ -242,7 +237,8 @@ export const CallFooter: FC<FooterProps> = ({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (reactionIdentifier && reactionData) {
|
// Reaction button contains a pretty large menu, so treat it like a modal
|
||||||
|
if (reactionIdentifier && reactionData && showModals) {
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<ReactionToggleButton
|
<ReactionToggleButton
|
||||||
size={buttonSize}
|
size={buttonSize}
|
||||||
@@ -290,7 +286,9 @@ export const CallFooter: FC<FooterProps> = ({
|
|||||||
/>
|
/>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
{debugTileLayout ? `Tiles generation: ${tileStoreGeneration}` : undefined}
|
{debugTileLayout ? (
|
||||||
|
<TilesDebugInfo generation$={vm.tileStoreGeneration$} />
|
||||||
|
) : undefined}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -317,21 +315,20 @@ export const CallFooter: FC<FooterProps> = ({
|
|||||||
{(showLogo || debugTileLayout) && logoDebugContainer}
|
{(showLogo || debugTileLayout) && logoDebugContainer}
|
||||||
</div>
|
</div>
|
||||||
{!hideControls && <div className={styles.buttons}>{buttons}</div>}
|
{!hideControls && <div className={styles.buttons}>{buttons}</div>}
|
||||||
{!hideControls && setLayoutMode && layoutMode && (
|
{!hideControls && layoutSwitchVm && (
|
||||||
<Switch<"spotlight", "grid">
|
<LayoutSwitch vm={layoutSwitchVm} className={styles.layout} />
|
||||||
name="layoutMode"
|
|
||||||
aria-label={t("layout_switch_label")}
|
|
||||||
leftLabel={t("layout_spotlight_label")}
|
|
||||||
leftValue="spotlight"
|
|
||||||
leftIcon={SpotlightIcon}
|
|
||||||
rightLabel={t("layout_grid_label")}
|
|
||||||
rightValue="grid"
|
|
||||||
rightIcon={GridIcon}
|
|
||||||
className={styles.layout}
|
|
||||||
value={layoutMode}
|
|
||||||
onChange={setLayoutMode}
|
|
||||||
/>
|
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface TilesDebugInfoProps {
|
||||||
|
generation$: Behavior<number | undefined>;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Isolated in its own component since the layout generation updates frequently
|
||||||
|
// and we can avoid re-rendering the footer this way
|
||||||
|
const TilesDebugInfo: FC<TilesDebugInfoProps> = ({ generation$ }) => {
|
||||||
|
const generation = useBehavior(generation$);
|
||||||
|
return `Tiles generation: ${generation}`;
|
||||||
|
};
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ function buildMinimalCallViewModel(layout: Layout): CallViewModel {
|
|||||||
reactions$: constant({}),
|
reactions$: constant({}),
|
||||||
tileStoreGeneration$: constant(0),
|
tileStoreGeneration$: constant(0),
|
||||||
showFooter$: constant(true),
|
showFooter$: constant(true),
|
||||||
|
showModals$: constant(true),
|
||||||
settingsOpen$: constant(false),
|
settingsOpen$: constant(false),
|
||||||
setSettingsOpen$: constant(() => {}),
|
setSettingsOpen$: constant(() => {}),
|
||||||
} as unknown as CallViewModel;
|
} as unknown as CallViewModel;
|
||||||
|
|||||||
@@ -161,6 +161,7 @@ export function createCallFooterViewModel(
|
|||||||
// candidat to move into the FooterViewModel
|
// candidat to move into the FooterViewModel
|
||||||
showFooter$: callModel.showFooter$,
|
showFooter$: callModel.showFooter$,
|
||||||
hideControls$: constant(!showControls),
|
hideControls$: constant(!showControls),
|
||||||
|
showModals$: callModel.showModals$,
|
||||||
asOverlay$: callModel.edgeToEdge$,
|
asOverlay$: callModel.edgeToEdge$,
|
||||||
buttonSize$: scope.behavior(
|
buttonSize$: scope.behavior(
|
||||||
isPip$.pipe(map<boolean, "md" | "lg">((pip) => (pip ? "md" : "lg"))),
|
isPip$.pipe(map<boolean, "md" | "lg">((pip) => (pip ? "md" : "lg"))),
|
||||||
@@ -168,12 +169,12 @@ export function createCallFooterViewModel(
|
|||||||
|
|
||||||
openSettings$: scope.behavior(
|
openSettings$: scope.behavior(
|
||||||
combineLatest([
|
combineLatest([
|
||||||
isPip$,
|
callModel.showModals$,
|
||||||
callModel.showHeader$,
|
callModel.showHeader$,
|
||||||
callModel.setSettingsOpen$,
|
callModel.setSettingsOpen$,
|
||||||
]).pipe(
|
]).pipe(
|
||||||
map(([isPip, showHeader, setSettingsOpen]) =>
|
map(([showModals, showHeader, setSettingsOpen]) =>
|
||||||
!isPip && headerStyle !== HeaderStyle.AppBar && showControls
|
showModals && headerStyle !== HeaderStyle.AppBar && showControls
|
||||||
? (): void => setSettingsOpen(true)
|
? (): void => setSettingsOpen(true)
|
||||||
: undefined,
|
: undefined,
|
||||||
),
|
),
|
||||||
@@ -182,14 +183,7 @@ export function createCallFooterViewModel(
|
|||||||
|
|
||||||
showLogo$: scope.behavior(isPip$.pipe(map((isPip) => showLogo && !isPip))),
|
showLogo$: scope.behavior(isPip$.pipe(map((isPip) => showLogo && !isPip))),
|
||||||
|
|
||||||
layoutMode$: callModel.gridMode$,
|
layoutSwitchVm$: callModel.layoutSwitchVm$,
|
||||||
setLayoutMode$: scope.behavior(
|
|
||||||
isPip$.pipe(
|
|
||||||
map((isPip) =>
|
|
||||||
!isPip && showControls ? callModel.setGridMode : undefined,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
|
|
||||||
sharingScreen$: callModel.sharingScreen$,
|
sharingScreen$: callModel.sharingScreen$,
|
||||||
toggleScreenSharing$: constant(callModel.toggleScreenSharing ?? undefined),
|
toggleScreenSharing$: constant(callModel.toggleScreenSharing ?? undefined),
|
||||||
@@ -246,21 +240,20 @@ export function createLobbyFooterViewModel(
|
|||||||
showLogo,
|
showLogo,
|
||||||
hideControls: false,
|
hideControls: false,
|
||||||
asOverlay: false,
|
asOverlay: false,
|
||||||
|
showModals: true,
|
||||||
buttonSize: "lg",
|
buttonSize: "lg",
|
||||||
showLayoutSwitcher: false,
|
|
||||||
openSettings,
|
openSettings,
|
||||||
hangup,
|
hangup,
|
||||||
debugTileLayout: false,
|
debugTileLayout: false,
|
||||||
showFooter: true,
|
showFooter: true,
|
||||||
toggleAudio: undefined,
|
toggleAudio: undefined,
|
||||||
toggleVideo: undefined,
|
toggleVideo: undefined,
|
||||||
setLayoutMode: undefined,
|
|
||||||
toggleScreenSharing: undefined,
|
toggleScreenSharing: undefined,
|
||||||
audioEnabled: undefined,
|
audioEnabled: undefined,
|
||||||
audioBusy: false,
|
audioBusy: false,
|
||||||
videoEnabled: undefined,
|
videoEnabled: undefined,
|
||||||
videoBusy: false,
|
videoBusy: false,
|
||||||
layoutMode: undefined,
|
layoutSwitchVm: null,
|
||||||
sharingScreen: false,
|
sharingScreen: false,
|
||||||
audioOutputSwitcher: undefined,
|
audioOutputSwitcher: undefined,
|
||||||
reactionIdentifier: undefined,
|
reactionIdentifier: undefined,
|
||||||
|
|||||||
+90
-32
@@ -12,9 +12,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
* Settings, or pinned for a deployment via `matrix_rtc_mode` in config.json.
|
* Settings, or pinned for a deployment via `matrix_rtc_mode` in config.json.
|
||||||
*/
|
*/
|
||||||
export enum MatrixRTCMode {
|
export enum MatrixRTCMode {
|
||||||
/** Legacy single-SFU + user-keyed memberships + legacy JWT endpoint. */
|
/** Multi-SFU transport, legacy JWT endpoint, state events. */
|
||||||
Legacy = "legacy",
|
|
||||||
/** Multi-SFU transport, legacy JWT endpoint, no sticky events. */
|
|
||||||
Compatibility = "compatibility",
|
Compatibility = "compatibility",
|
||||||
/**
|
/**
|
||||||
* Multi-SFU transport with:
|
* Multi-SFU transport with:
|
||||||
@@ -74,10 +72,7 @@ export interface ConfigOptions {
|
|||||||
livekit?: {
|
livekit?: {
|
||||||
// The link to the service that returns a livekit url and token to use it.
|
// The link to the service that returns a livekit url and token to use it.
|
||||||
// This is a fallback link in case the homeserver in use does not advertise
|
// This is a fallback link in case the homeserver in use does not advertise
|
||||||
// a livekit service url in the client well-known.
|
// a livekit service url over the transports endpoint.
|
||||||
// The well known needs to be formatted like so:
|
|
||||||
// {"type":"livekit", "livekit_service_url":"https://livekit.example.com"}
|
|
||||||
// and stored under the key: "org.matrix.msc4143.rtc_foci"
|
|
||||||
livekit_service_url: string;
|
livekit_service_url: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -89,15 +84,6 @@ export interface ConfigOptions {
|
|||||||
* Allow to join group calls without audio and video.
|
* Allow to join group calls without audio and video.
|
||||||
*/
|
*/
|
||||||
feature_group_calls_without_video_and_audio?: boolean;
|
feature_group_calls_without_video_and_audio?: boolean;
|
||||||
|
|
||||||
/**
|
|
||||||
* Send device-specific call session membership state events instead of
|
|
||||||
* legacy user-specific call membership state events.
|
|
||||||
* This setting has no effect when the user joins an active call with
|
|
||||||
* legacy state events. For compatibility, Element Call will always join
|
|
||||||
* active legacy calls with legacy state events.
|
|
||||||
*/
|
|
||||||
feature_use_device_session_member_events?: boolean;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -105,6 +91,61 @@ export interface ConfigOptions {
|
|||||||
*/
|
*/
|
||||||
ssla?: string;
|
ssla?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Media quality settings for video and screen sharing.
|
||||||
|
* These override the hardcoded LiveKit defaults.
|
||||||
|
*/
|
||||||
|
media_quality?: {
|
||||||
|
/**
|
||||||
|
* Video codec preference. The server must also have the codec enabled.
|
||||||
|
* @default "vp8"
|
||||||
|
*/
|
||||||
|
video_codec?: "vp8" | "vp9" | "h264" | "av1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Camera video settings.
|
||||||
|
*/
|
||||||
|
video?: {
|
||||||
|
/** Max resolution height in pixels (e.g. 720, 1080, 1440). @default 720 */
|
||||||
|
max_resolution?: number;
|
||||||
|
/** Max bitrate in bits per second. @default 1700000 */
|
||||||
|
max_bitrate?: number;
|
||||||
|
/** Max framerate. @default 30 */
|
||||||
|
max_framerate?: number;
|
||||||
|
/**
|
||||||
|
* Simulcast layers as an array of {height, bitrate} objects,
|
||||||
|
* ordered from lowest to highest quality.
|
||||||
|
* @default [{height: 180, bitrate: 160000}, {height: 360, bitrate: 450000}]
|
||||||
|
*/
|
||||||
|
simulcast_layers?: Array<{
|
||||||
|
height: number;
|
||||||
|
bitrate: number;
|
||||||
|
}>;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Screen share settings.
|
||||||
|
*/
|
||||||
|
screen_share?: {
|
||||||
|
/** Max resolution height in pixels. @default 1080 */
|
||||||
|
max_resolution?: number;
|
||||||
|
/** Max bitrate in bits per second. @default 5000000 */
|
||||||
|
max_bitrate?: number;
|
||||||
|
/** Max framerate. @default 30 */
|
||||||
|
max_framerate?: number;
|
||||||
|
/**
|
||||||
|
* Simulcast layers for screen sharing as an array of {height, bitrate, framerate} objects,
|
||||||
|
* ordered from lowest to highest quality. If omitted, LiveKit SDK defaults apply (1 extra
|
||||||
|
* layer at half resolution).
|
||||||
|
*/
|
||||||
|
simulcast_layers?: Array<{
|
||||||
|
height: number;
|
||||||
|
bitrate: number;
|
||||||
|
framerate?: number;
|
||||||
|
}>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
media_devices?: {
|
media_devices?: {
|
||||||
/**
|
/**
|
||||||
* Defines whether participants should start with audio enabled by default.
|
* Defines whether participants should start with audio enabled by default.
|
||||||
@@ -127,7 +168,8 @@ export interface ConfigOptions {
|
|||||||
/**
|
/**
|
||||||
* Pins the {@link MatrixRTCMode} for all clients on this deployment,
|
* Pins the {@link MatrixRTCMode} for all clients on this deployment,
|
||||||
* overriding any per-user choice from the Developer Settings. If unset,
|
* overriding any per-user choice from the Developer Settings. If unset,
|
||||||
* the user's Developer Settings choice (or its default of `Legacy`) wins.
|
* the user's Developer Settings choice (or its default of `Compatibility`)
|
||||||
|
* wins.
|
||||||
*/
|
*/
|
||||||
matrix_rtc_mode?: MatrixRTCMode;
|
matrix_rtc_mode?: MatrixRTCMode;
|
||||||
|
|
||||||
@@ -183,14 +225,26 @@ export interface ConfigOptions {
|
|||||||
// Overrides members from ConfigOptions that are always provided by the
|
// Overrides members from ConfigOptions that are always provided by the
|
||||||
// default config and are therefore non-optional.
|
// default config and are therefore non-optional.
|
||||||
export interface ResolvedConfigOptions extends ConfigOptions {
|
export interface ResolvedConfigOptions extends ConfigOptions {
|
||||||
default_server_config: {
|
|
||||||
["m.homeserver"]: {
|
|
||||||
base_url: string;
|
|
||||||
server_name: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
sync_disconnect_grace_period_ms: number;
|
sync_disconnect_grace_period_ms: number;
|
||||||
ssla: string;
|
ssla: string;
|
||||||
|
media_quality: Required<
|
||||||
|
Pick<NonNullable<ConfigOptions["media_quality"]>, "video_codec">
|
||||||
|
> & {
|
||||||
|
video: Required<
|
||||||
|
Pick<
|
||||||
|
NonNullable<NonNullable<ConfigOptions["media_quality"]>["video"]>,
|
||||||
|
"max_resolution" | "max_bitrate" | "max_framerate"
|
||||||
|
>
|
||||||
|
>;
|
||||||
|
screen_share: Required<
|
||||||
|
Pick<
|
||||||
|
NonNullable<
|
||||||
|
NonNullable<ConfigOptions["media_quality"]>["screen_share"]
|
||||||
|
>,
|
||||||
|
"max_resolution" | "max_bitrate" | "max_framerate"
|
||||||
|
>
|
||||||
|
>;
|
||||||
|
};
|
||||||
matrix_rtc_session: {
|
matrix_rtc_session: {
|
||||||
wait_for_key_rotation_ms?: number;
|
wait_for_key_rotation_ms?: number;
|
||||||
delayed_leave_event_delay_ms: number;
|
delayed_leave_event_delay_ms: number;
|
||||||
@@ -202,17 +256,21 @@ export interface ResolvedConfigOptions extends ConfigOptions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const DEFAULT_CONFIG: ResolvedConfigOptions = {
|
export const DEFAULT_CONFIG: ResolvedConfigOptions = {
|
||||||
default_server_config: {
|
|
||||||
["m.homeserver"]: {
|
|
||||||
base_url: "http://localhost:8008",
|
|
||||||
server_name: "localhost",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
features: {
|
|
||||||
feature_use_device_session_member_events: true,
|
|
||||||
},
|
|
||||||
sync_disconnect_grace_period_ms: 10000,
|
sync_disconnect_grace_period_ms: 10000,
|
||||||
ssla: "https://static.element.io/legal/element-software-and-services-license-agreement-uk-1.pdf",
|
ssla: "https://static.element.io/legal/element-software-and-services-license-agreement-uk-1.pdf",
|
||||||
|
media_quality: {
|
||||||
|
video_codec: "vp8",
|
||||||
|
video: {
|
||||||
|
max_resolution: 720,
|
||||||
|
max_bitrate: 1_700_000,
|
||||||
|
max_framerate: 30,
|
||||||
|
},
|
||||||
|
screen_share: {
|
||||||
|
max_resolution: 1080,
|
||||||
|
max_bitrate: 5_000_000,
|
||||||
|
max_framerate: 30,
|
||||||
|
},
|
||||||
|
},
|
||||||
matrix_rtc_session: {
|
matrix_rtc_session: {
|
||||||
delayed_leave_event_delay_ms: 10000,
|
delayed_leave_event_delay_ms: 10000,
|
||||||
network_error_retry_ms: 1000,
|
network_error_retry_ms: 1000,
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.6 KiB |
@@ -1,16 +0,0 @@
|
|||||||
<svg width="1440" height="800" viewBox="0 0 1440 800" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<g filter="url(#filter0_f_4162_80259)">
|
|
||||||
<path d="M-37.0486 666.028C267.76 138.867 944.304 -46.1945 1477.05 260.929" stroke="url(#paint0_linear_4162_80259)" stroke-width="192" stroke-linecap="round"/>
|
|
||||||
</g>
|
|
||||||
<defs>
|
|
||||||
<filter id="filter0_f_4162_80259" x="-333.118" y="-183.694" width="2106.24" height="1145.68" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
|
|
||||||
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
|
|
||||||
<feBlend mode="normal" in="SourceGraphic" in2="BackgroundImageFix" result="shape"/>
|
|
||||||
<feGaussianBlur stdDeviation="100" result="effect1_foregroundBlur_4162_80259"/>
|
|
||||||
</filter>
|
|
||||||
<linearGradient id="paint0_linear_4162_80259" x1="1255.31" y1="320.254" x2="184.899" y2="607.497" gradientUnits="userSpaceOnUse">
|
|
||||||
<stop stop-color="#00C59E"/>
|
|
||||||
<stop offset="0.75" stop-color="#0044A5"/>
|
|
||||||
</linearGradient>
|
|
||||||
</defs>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 938 B |
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
@@ -1,86 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
|
||||||
<svg
|
|
||||||
width="1200"
|
|
||||||
height="285"
|
|
||||||
viewBox="0 0 1200 285"
|
|
||||||
fill="none"
|
|
||||||
version="1.1"
|
|
||||||
id="svg5"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:svg="http://www.w3.org/2000/svg">
|
|
||||||
<g
|
|
||||||
filter="url(#filter0_f_3970_9366)"
|
|
||||||
id="g2"
|
|
||||||
transform="translate(422.00201)">
|
|
||||||
<path
|
|
||||||
d="m -164.342,495.134 c 188.2881,-188.288 494.684,-190 684.684,0"
|
|
||||||
stroke="url(#paint0_linear_3970_9366)"
|
|
||||||
stroke-width="235.517"
|
|
||||||
stroke-linecap="round"
|
|
||||||
id="path1"
|
|
||||||
style="stroke:url(#paint0_linear_3970_9366)" />
|
|
||||||
<path
|
|
||||||
d="m -164.342,495.134 c 188.2881,-188.288 494.684,-190 684.684,0"
|
|
||||||
stroke="url(#paint1_linear_3970_9366)"
|
|
||||||
style="mix-blend-mode:overlay;stroke:url(#paint1_linear_3970_9366)"
|
|
||||||
stroke-width="235.517"
|
|
||||||
stroke-linecap="round"
|
|
||||||
id="path2" />
|
|
||||||
</g>
|
|
||||||
<defs
|
|
||||||
id="defs5">
|
|
||||||
<filter
|
|
||||||
id="filter0_f_3970_9366"
|
|
||||||
x="-517.617"
|
|
||||||
y="-0.00012207"
|
|
||||||
width="1391.23"
|
|
||||||
height="848.409"
|
|
||||||
filterUnits="userSpaceOnUse"
|
|
||||||
color-interpolation-filters="sRGB">
|
|
||||||
<feFlood
|
|
||||||
flood-opacity="0"
|
|
||||||
result="BackgroundImageFix"
|
|
||||||
id="feFlood2" />
|
|
||||||
<feBlend
|
|
||||||
mode="normal"
|
|
||||||
in="SourceGraphic"
|
|
||||||
in2="BackgroundImageFix"
|
|
||||||
result="shape"
|
|
||||||
id="feBlend2" />
|
|
||||||
<feGaussianBlur
|
|
||||||
stdDeviation="117.758"
|
|
||||||
result="effect1_foregroundBlur_3970_9366"
|
|
||||||
id="feGaussianBlur2" />
|
|
||||||
</filter>
|
|
||||||
<linearGradient
|
|
||||||
id="paint0_linear_3970_9366"
|
|
||||||
x1="349.17099"
|
|
||||||
y1="323.96301"
|
|
||||||
x2="6.82898"
|
|
||||||
y2="666.30499"
|
|
||||||
gradientUnits="userSpaceOnUse">
|
|
||||||
<stop
|
|
||||||
stop-color="#0D5CBD"
|
|
||||||
id="stop2" />
|
|
||||||
<stop
|
|
||||||
offset="0.730863"
|
|
||||||
stop-color="#0DBDA8"
|
|
||||||
id="stop3" />
|
|
||||||
</linearGradient>
|
|
||||||
<linearGradient
|
|
||||||
id="paint1_linear_3970_9366"
|
|
||||||
x1="349.17099"
|
|
||||||
y1="323.96301"
|
|
||||||
x2="6.82898"
|
|
||||||
y2="666.30499"
|
|
||||||
gradientUnits="userSpaceOnUse">
|
|
||||||
<stop
|
|
||||||
stop-color="#0D5CBD"
|
|
||||||
id="stop4" />
|
|
||||||
<stop
|
|
||||||
offset="0.730863"
|
|
||||||
stop-color="#0DBDA8"
|
|
||||||
id="stop5" />
|
|
||||||
</linearGradient>
|
|
||||||
</defs>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 2.2 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 78 B |
+12
-8
@@ -41,6 +41,8 @@ import { TileWrapper } from "./TileWrapper";
|
|||||||
import { usePrefersReducedMotion } from "../usePrefersReducedMotion";
|
import { usePrefersReducedMotion } from "../usePrefersReducedMotion";
|
||||||
import { useInitial } from "../useInitial";
|
import { useInitial } from "../useInitial";
|
||||||
|
|
||||||
|
const MAX_ANIMATED_TILES = 50; // Capped for performance reasons
|
||||||
|
|
||||||
interface Rect {
|
interface Rect {
|
||||||
x: number;
|
x: number;
|
||||||
y: number;
|
y: number;
|
||||||
@@ -285,7 +287,6 @@ export function Grid<
|
|||||||
const [visibleTilesCallback, setVisibleTilesCallback] =
|
const [visibleTilesCallback, setVisibleTilesCallback] =
|
||||||
useState<VisibleTilesCallback | null>(null);
|
useState<VisibleTilesCallback | null>(null);
|
||||||
const tiles = useInitial(() => new Map<string, Tile<TileModel>>());
|
const tiles = useInitial(() => new Map<string, Tile<TileModel>>());
|
||||||
const prefersReducedMotion = usePrefersReducedMotion();
|
|
||||||
|
|
||||||
const Slot: FC<SlotProps<TileModel>> = useMemo(
|
const Slot: FC<SlotProps<TileModel>> = useMemo(
|
||||||
() =>
|
() =>
|
||||||
@@ -372,6 +373,10 @@ export function Grid<
|
|||||||
// react-spring's imperative API during gestures to improve responsiveness
|
// react-spring's imperative API during gestures to improve responsiveness
|
||||||
const dragState = useRef<DragState | null>(null);
|
const dragState = useRef<DragState | null>(null);
|
||||||
|
|
||||||
|
// If true, disables animations
|
||||||
|
const immediate =
|
||||||
|
usePrefersReducedMotion() || placedTiles.length > MAX_ANIMATED_TILES;
|
||||||
|
|
||||||
const [tileTransitions, springRef] = useTransition(
|
const [tileTransitions, springRef] = useTransition(
|
||||||
placedTiles,
|
placedTiles,
|
||||||
() => ({
|
() => ({
|
||||||
@@ -389,9 +394,9 @@ export function Grid<
|
|||||||
y,
|
y,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
immediate: prefersReducedMotion,
|
immediate,
|
||||||
}),
|
}),
|
||||||
enter: { opacity: 1, scale: 1, immediate: prefersReducedMotion },
|
enter: { opacity: 1, scale: 1, immediate },
|
||||||
update: ({
|
update: ({
|
||||||
id,
|
id,
|
||||||
x,
|
x,
|
||||||
@@ -406,9 +411,9 @@ export function Grid<
|
|||||||
y,
|
y,
|
||||||
width,
|
width,
|
||||||
height,
|
height,
|
||||||
immediate: prefersReducedMotion,
|
immediate,
|
||||||
},
|
},
|
||||||
leave: { opacity: 0, scale: 0, immediate: prefersReducedMotion },
|
leave: { opacity: 0, scale: 0, immediate },
|
||||||
config: { mass: 0.7, tension: 252, friction: 25 },
|
config: { mass: 0.7, tension: 252, friction: 25 },
|
||||||
}),
|
}),
|
||||||
// react-spring's types are bugged and can't infer the spring type
|
// react-spring's types are bugged and can't infer the spring type
|
||||||
@@ -441,8 +446,7 @@ export function Grid<
|
|||||||
y: tile.y,
|
y: tile.y,
|
||||||
width: tile.width,
|
width: tile.width,
|
||||||
height: tile.height,
|
height: tile.height,
|
||||||
immediate:
|
immediate: immediate || ((key): boolean => key === "zIndex"),
|
||||||
prefersReducedMotion || ((key): boolean => key === "zIndex"),
|
|
||||||
// Allow the tile's position to settle before pushing its
|
// Allow the tile's position to settle before pushing its
|
||||||
// z-index back down
|
// z-index back down
|
||||||
delay: (key): number => (key === "zIndex" ? 500 : 0),
|
delay: (key): number => (key === "zIndex" ? 500 : 0),
|
||||||
@@ -453,7 +457,7 @@ export function Grid<
|
|||||||
x: tileX,
|
x: tileX,
|
||||||
y: tileY,
|
y: tileY,
|
||||||
immediate:
|
immediate:
|
||||||
prefersReducedMotion ||
|
immediate ||
|
||||||
((key): boolean =>
|
((key): boolean =>
|
||||||
key === "zIndex" || key === "x" || key === "y"),
|
key === "zIndex" || key === "x" || key === "y"),
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -10,28 +10,28 @@ import { type ReactNode, useCallback, useMemo } from "react";
|
|||||||
import { useObservableEagerState } from "observable-hooks";
|
import { useObservableEagerState } from "observable-hooks";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
|
||||||
import { type OneOnOneLandscapeLayout as OneOnOneLandscapeLayoutModel } from "../state/layout-types.ts";
|
import { type OneOnOneDesktopLayout as OneOnOneDesktopLayoutModel } from "../state/layout-types.ts";
|
||||||
import { type CallLayout, arrangeTiles } from "./CallLayout";
|
import { type CallLayout, arrangeTiles } from "./CallLayout";
|
||||||
import styles from "./OneOnOneLandscapeLayout.module.css";
|
import styles from "./OneOnOneDesktopLayout.module.css";
|
||||||
import { type DragCallback, useUpdateLayout } from "./Grid";
|
import { type DragCallback, useUpdateLayout } from "./Grid";
|
||||||
import { useBehavior } from "../useBehavior";
|
import { useBehavior } from "../useBehavior";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of the "one-on-one" layout for landscape screens, in which
|
* An implementation of the "one-on-one" layout for desktop platforms, in which
|
||||||
* the remote participant is shown at maximum size, overlaid by a small view of
|
* the remote participant is shown at maximum size, overlaid by a small view of
|
||||||
* the local participant.
|
* the local participant.
|
||||||
*/
|
*/
|
||||||
export const makeOneOnOneLandscapeLayout: CallLayout<
|
export const makeOneOnOneDesktopLayout: CallLayout<
|
||||||
OneOnOneLandscapeLayoutModel
|
OneOnOneDesktopLayoutModel
|
||||||
> = ({ minBounds$ }) => ({
|
> = ({ minBounds$ }) => ({
|
||||||
foreground: "fixed",
|
foreground: "fixed",
|
||||||
|
|
||||||
fixed: function OneOnOneLandscapeLayoutFixed({ ref }): ReactNode {
|
fixed: function OneOnOneDesktopLayoutFixed({ ref }): ReactNode {
|
||||||
useUpdateLayout();
|
useUpdateLayout();
|
||||||
return <div ref={ref} />;
|
return <div ref={ref} />;
|
||||||
},
|
},
|
||||||
|
|
||||||
scrolling: function OneOnOneLandscapeLayoutScrolling({
|
scrolling: function OneOnOneDesktopLayoutScrolling({
|
||||||
ref,
|
ref,
|
||||||
model,
|
model,
|
||||||
Slot,
|
Slot,
|
||||||
+18
-4
@@ -19,14 +19,28 @@ Please see LICENSE in the repository root for full details.
|
|||||||
inset: var(--cpd-space-4x);
|
inset: var(--cpd-space-4x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Give the PiP a landscape aspect ratio */
|
||||||
.pip[data-size="sm"] {
|
.pip[data-size="sm"] {
|
||||||
inline-size: 88px;
|
inline-size: 132px;
|
||||||
block-size: 132px;
|
block-size: 88px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pip[data-size="lg"] {
|
.pip[data-size="lg"] {
|
||||||
inline-size: 140px;
|
inline-size: 210px;
|
||||||
block-size: 210px;
|
block-size: 140px;
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (max-width: 600px) {
|
||||||
|
/* Give the PiP a portrait aspect ratio */
|
||||||
|
.pip[data-size="sm"] {
|
||||||
|
inline-size: 88px;
|
||||||
|
block-size: 132px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.pip[data-size="lg"] {
|
||||||
|
inline-size: 140px;
|
||||||
|
block-size: 210px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.pip[data-block-alignment="start"] {
|
.pip[data-block-alignment="start"] {
|
||||||
@@ -9,23 +9,23 @@ Please see LICENSE in the repository root for full details.
|
|||||||
import { type ReactNode, useCallback } from "react";
|
import { type ReactNode, useCallback } from "react";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
|
||||||
import { type OneOnOnePortraitLayout as OneOnOnePortraitLayoutModel } from "../state/layout-types.ts";
|
import { type OneOnOneMobileLayout as OneOnOneMobileLayoutModel } from "../state/layout-types.ts";
|
||||||
import { type CallLayout } from "./CallLayout";
|
import { type CallLayout } from "./CallLayout";
|
||||||
import styles from "./OneOnOnePortraitLayout.module.css";
|
import styles from "./OneOnOneMobileLayout.module.css";
|
||||||
import { type DragCallback, useUpdateLayout } from "./Grid";
|
import { type DragCallback, useUpdateLayout } from "./Grid";
|
||||||
import { useBehavior } from "../useBehavior";
|
import { useBehavior } from "../useBehavior";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of the "one-on-one" layout for portrait screens, in which
|
* An implementation of the "one-on-one" layout for mobile platforms, in which
|
||||||
* the remote participant is shown at maximum size, overlaid by a small view of
|
* the remote participant is shown at maximum size, overlaid by a small view of
|
||||||
* the local participant.
|
* the local participant.
|
||||||
*/
|
*/
|
||||||
export const makeOneOnOnePortraitLayout: CallLayout<
|
export const makeOneOnOneMobileLayout: CallLayout<
|
||||||
OneOnOnePortraitLayoutModel
|
OneOnOneMobileLayoutModel
|
||||||
> = () => ({
|
> = () => ({
|
||||||
foreground: "scrolling",
|
foreground: "scrolling",
|
||||||
|
|
||||||
fixed: function OneOnOnePortraitLayoutFixed({ ref, model, Slot }): ReactNode {
|
fixed: function OneOnOneMobileLayoutFixed({ ref, model, Slot }): ReactNode {
|
||||||
useUpdateLayout();
|
useUpdateLayout();
|
||||||
return (
|
return (
|
||||||
<div ref={ref} className={styles.layer}>
|
<div ref={ref} className={styles.layer}>
|
||||||
@@ -38,7 +38,7 @@ export const makeOneOnOnePortraitLayout: CallLayout<
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
scrolling: function OneOnOnePortraitLayoutScrolling({
|
scrolling: function OneOnOneMobileLayoutScrolling({
|
||||||
ref,
|
ref,
|
||||||
model,
|
model,
|
||||||
Slot,
|
Slot,
|
||||||
@@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { type ReactNode } from "react";
|
import { type FC, type ReactNode } from "react";
|
||||||
import { useObservableEagerState } from "observable-hooks";
|
import { useObservableEagerState } from "observable-hooks";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
|
||||||
@@ -13,6 +13,9 @@ import { type CallLayout } from "./CallLayout";
|
|||||||
import { type SpotlightLandscapeLayout as SpotlightLandscapeLayoutModel } from "../state/layout-types.ts";
|
import { type SpotlightLandscapeLayout as SpotlightLandscapeLayoutModel } from "../state/layout-types.ts";
|
||||||
import styles from "./SpotlightLandscapeLayout.module.css";
|
import styles from "./SpotlightLandscapeLayout.module.css";
|
||||||
import { useUpdateLayout, useVisibleTiles } from "./Grid";
|
import { useUpdateLayout, useVisibleTiles } from "./Grid";
|
||||||
|
import { type MediaViewModel } from "../state/media/MediaViewModel.ts";
|
||||||
|
import { type Behavior } from "../state/Behavior.ts";
|
||||||
|
import { useBehavior } from "../useBehavior.ts";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* An implementation of the "spotlight landscape" layout, in which the spotlight
|
* An implementation of the "spotlight landscape" layout, in which the spotlight
|
||||||
@@ -54,16 +57,10 @@ export const makeSpotlightLandscapeLayout: CallLayout<
|
|||||||
useUpdateLayout();
|
useUpdateLayout();
|
||||||
useVisibleTiles(model.setVisibleTiles);
|
useVisibleTiles(model.setVisibleTiles);
|
||||||
useObservableEagerState(minBounds$);
|
useObservableEagerState(minBounds$);
|
||||||
const withIndicators =
|
|
||||||
useObservableEagerState(model.spotlight.media$).length > 1;
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={ref} className={styles.layer}>
|
<div ref={ref} className={styles.layer}>
|
||||||
<div
|
<SpotlightSlot media$={model.spotlight.media$} />
|
||||||
className={classNames(styles.spotlight, {
|
|
||||||
[styles.withIndicators]: withIndicators,
|
|
||||||
})}
|
|
||||||
/>
|
|
||||||
<div className={styles.grid}>
|
<div className={styles.grid}>
|
||||||
{model.grid.map((m) => (
|
{model.grid.map((m) => (
|
||||||
<Slot key={m.id} className={styles.slot} id={m.id} model={m} />
|
<Slot key={m.id} className={styles.slot} id={m.id} model={m} />
|
||||||
@@ -73,3 +70,20 @@ export const makeSpotlightLandscapeLayout: CallLayout<
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
|
interface SpotlightSlotProps {
|
||||||
|
media$: Behavior<MediaViewModel[]>;
|
||||||
|
}
|
||||||
|
|
||||||
|
// This component isolates the subscription to the spotlight media so that it
|
||||||
|
// can change without causing the whole layout to re-render
|
||||||
|
const SpotlightSlot: FC<SpotlightSlotProps> = ({ media$ }) => {
|
||||||
|
const withIndicators = useBehavior(media$).length > 1;
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(styles.spotlight, {
|
||||||
|
[styles.withIndicators]: withIndicators,
|
||||||
|
})}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|||||||
+9
-7
@@ -15,8 +15,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
@import url("@fontsource/inconsolata/700.css");
|
@import url("@fontsource/inconsolata/700.css");
|
||||||
|
|
||||||
@import url("normalize.css/normalize.css") layer(normalize);
|
@import url("normalize.css/normalize.css") layer(normalize);
|
||||||
@import url("@vector-im/compound-design-tokens/assets/web/css/compound-design-tokens.css")
|
@import url("@vector-im/compound-design-tokens/assets/web/css/compound-design-tokens.css") layer(compound);
|
||||||
layer(compound);
|
|
||||||
@import url("@vector-im/compound-web/dist/style.css") layer(compound.components);
|
@import url("@vector-im/compound-web/dist/style.css") layer(compound.components);
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
@@ -79,16 +78,19 @@ body {
|
|||||||
body[data-background="gradient"]::before {
|
body[data-background="gradient"]::before {
|
||||||
content: "";
|
content: "";
|
||||||
position: fixed;
|
position: fixed;
|
||||||
inset: 0;
|
/* Chromium abruptly fades our images to fully transparent at the edge of
|
||||||
background-image: url("graphics/mobile-gradient.svg");
|
the element. If we just make the element a little bigger than the viewport,
|
||||||
background-size: auto;
|
this is no longer visible. */
|
||||||
|
inset: -20px;
|
||||||
|
background-image: url("graphics/mobile-gradient.png");
|
||||||
|
background-size: 1400px 305px;
|
||||||
background-position: bottom;
|
background-position: bottom;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
}
|
}
|
||||||
|
|
||||||
body[data-background="gradient"][data-platform="desktop"]::before {
|
body[data-background="gradient"][data-platform="desktop"]::before {
|
||||||
background-image: url("graphics/desktop-gradient.svg");
|
background-image: url("graphics/desktop-gradient.png");
|
||||||
background-size: calc(max(1440px, 100vw)) calc(max(800px, 100vh));
|
background-size: max(1440px, 100vw) max(1440px, 100vh);
|
||||||
background-position: center;
|
background-position: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ import {
|
|||||||
|
|
||||||
import { getUrlParams } from "./UrlParams";
|
import { getUrlParams } from "./UrlParams";
|
||||||
import { Config } from "./config/Config";
|
import { Config } from "./config/Config";
|
||||||
|
import { seedSettingsFromConfig } from "./settings/settings";
|
||||||
import { platform } from "./Platform";
|
import { platform } from "./Platform";
|
||||||
import { isFailure } from "./utils/fetch";
|
import { isFailure } from "./utils/fetch";
|
||||||
import { initializeWidget } from "./widget";
|
import { initializeWidget } from "./widget";
|
||||||
@@ -237,6 +238,7 @@ export class Initializer {
|
|||||||
this.loadStates.config = LoadState.Loading;
|
this.loadStates.config = LoadState.Loading;
|
||||||
Config.init().then(
|
Config.init().then(
|
||||||
() => {
|
() => {
|
||||||
|
seedSettingsFromConfig(Config.get().media_quality);
|
||||||
this.loadStates.config = LoadState.Loaded;
|
this.loadStates.config = LoadState.Loaded;
|
||||||
this.initStep(resolve);
|
this.initStep(resolve);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ function renderTestComponent(
|
|||||||
),
|
),
|
||||||
} as unknown as Room;
|
} as unknown as Room;
|
||||||
|
|
||||||
if (explicitTracks?.length ?? 0 > 0) {
|
if ((explicitTracks?.length ?? 0) > 0) {
|
||||||
tracks = explicitTracks!.map(({ participantId, source, kind }) => {
|
tracks = explicitTracks!.map(({ participantId, source, kind }) => {
|
||||||
const participant =
|
const participant =
|
||||||
liveKitParticipants.find((p) => p.identity === participantId) ??
|
liveKitParticipants.find((p) => p.identity === participantId) ??
|
||||||
|
|||||||
+14
-80
@@ -18,7 +18,6 @@ import {
|
|||||||
NoMatrix2AuthorizationService,
|
NoMatrix2AuthorizationService,
|
||||||
} from "../utils/errors";
|
} from "../utils/errors";
|
||||||
import { doNetworkOperationWithRetry } from "../utils/matrix";
|
import { doNetworkOperationWithRetry } from "../utils/matrix";
|
||||||
import { Config } from "../config/Config";
|
|
||||||
import { JwtEndpointVersion } from "../state/CallViewModel/localMember/LocalTransport";
|
import { JwtEndpointVersion } from "../state/CallViewModel/localMember/LocalTransport";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,8 +84,6 @@ export type OpenIDClientParts = Pick<
|
|||||||
* This function by default uses whatever is possible with the current jwt service installed next to the SFU.
|
* This function by default uses whatever is possible with the current jwt service installed next to the SFU.
|
||||||
* For remote connections this does not matter, since we will not publish there we can rely on the newest option.
|
* For remote connections this does not matter, since we will not publish there we can rely on the newest option.
|
||||||
* For our own connection we can only use the hashed version if we also send the new matrix2.0 sticky events.
|
* For our own connection we can only use the hashed version if we also send the new matrix2.0 sticky events.
|
||||||
* @param opts.delayEndpointBaseUrl The URL of the matrix homeserver.
|
|
||||||
* @param opts.delayId The delay id used for the jwt service to manage.
|
|
||||||
* @param logger optional logger.
|
* @param logger optional logger.
|
||||||
* @returns Object containing the token information
|
* @returns Object containing the token information
|
||||||
* @throws FailToGetOpenIdToken
|
* @throws FailToGetOpenIdToken
|
||||||
@@ -98,8 +95,6 @@ export async function getSFUConfigWithOpenID(
|
|||||||
roomId: string,
|
roomId: string,
|
||||||
opts?: {
|
opts?: {
|
||||||
forceJwtEndpoint?: JwtEndpointVersion;
|
forceJwtEndpoint?: JwtEndpointVersion;
|
||||||
delayEndpointBaseUrl?: string;
|
|
||||||
delayId?: string;
|
|
||||||
},
|
},
|
||||||
logger?: Logger,
|
logger?: Logger,
|
||||||
): Promise<SFUConfig> {
|
): Promise<SFUConfig> {
|
||||||
@@ -121,20 +116,18 @@ export async function getSFUConfigWithOpenID(
|
|||||||
const forceMatrix2Jwt =
|
const forceMatrix2Jwt =
|
||||||
opts?.forceJwtEndpoint === JwtEndpointVersion.Matrix_2_0;
|
opts?.forceJwtEndpoint === JwtEndpointVersion.Matrix_2_0;
|
||||||
|
|
||||||
// We want to start using the new endpoint (with optional delay delegation)
|
// We want to start using the new endpoint if we can use both or if we are
|
||||||
// if we can use both or if we are forced to use the new one.
|
// forced to use the new one.
|
||||||
if (tryBothJwtEndpoints || forceMatrix2Jwt) {
|
if (tryBothJwtEndpoints || forceMatrix2Jwt) {
|
||||||
try {
|
try {
|
||||||
logger?.info(
|
logger?.info(
|
||||||
`Trying to get JWT with delegation for focus ${serviceUrl}...`,
|
`Trying to get JWT with delegation for focus ${serviceUrl}...`,
|
||||||
);
|
);
|
||||||
const sfuConfig = await getLiveKitJWTWithDelayDelegation(
|
const sfuConfig = await getLiveKitJWT(
|
||||||
membership,
|
membership,
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
roomId,
|
roomId,
|
||||||
openIdToken,
|
openIdToken,
|
||||||
opts?.delayEndpointBaseUrl,
|
|
||||||
opts?.delayId,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
return extractFullConfigFromToken(sfuConfig);
|
return extractFullConfigFromToken(sfuConfig);
|
||||||
@@ -154,13 +147,11 @@ export async function getSFUConfigWithOpenID(
|
|||||||
logger?.info(
|
logger?.info(
|
||||||
`Trying to get JWT with legacy endpoint for focus ${serviceUrl}...`,
|
`Trying to get JWT with legacy endpoint for focus ${serviceUrl}...`,
|
||||||
);
|
);
|
||||||
sfuConfig = await getLiveKitJWT(
|
sfuConfig = await getLiveKitJWTLegacy(
|
||||||
membership.deviceId,
|
membership.deviceId,
|
||||||
serviceUrl,
|
serviceUrl,
|
||||||
roomId,
|
roomId,
|
||||||
openIdToken,
|
openIdToken,
|
||||||
opts?.delayEndpointBaseUrl,
|
|
||||||
opts?.delayId,
|
|
||||||
);
|
);
|
||||||
logger?.info(`Got JWT from call's active focus URL.`);
|
logger?.info(`Got JWT from call's active focus URL.`);
|
||||||
return extractFullConfigFromToken(sfuConfig);
|
return extractFullConfigFromToken(sfuConfig);
|
||||||
@@ -188,33 +179,14 @@ function extractFullConfigFromToken(sfuConfig: {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getLiveKitJWT(
|
async function getLiveKitJWTLegacy(
|
||||||
deviceId: string,
|
deviceId: string,
|
||||||
livekitServiceURL: string,
|
livekitServiceURL: string,
|
||||||
matrixRoomId: string,
|
matrixRoomId: string,
|
||||||
openIDToken: IOpenIDToken,
|
openIDToken: IOpenIDToken,
|
||||||
delayEndpointBaseUrl?: string,
|
|
||||||
delayId?: string,
|
|
||||||
): Promise<{ url: string; jwt: string }> {
|
): Promise<{ url: string; jwt: string }> {
|
||||||
interface IDelayParams {
|
const res = await doNetworkOperationWithRetry(async () =>
|
||||||
delay_id?: string;
|
fetch(livekitServiceURL + "/sfu/get", {
|
||||||
delay_timeout?: number;
|
|
||||||
delay_cs_api_url?: string;
|
|
||||||
}
|
|
||||||
let bodyDalayParts: IDelayParams = {};
|
|
||||||
// Also check for empty string
|
|
||||||
if (delayId && delayEndpointBaseUrl) {
|
|
||||||
const delayTimeoutMs =
|
|
||||||
Config.get().matrix_rtc_session?.delayed_leave_event_delay_ms;
|
|
||||||
bodyDalayParts = {
|
|
||||||
delay_id: delayId,
|
|
||||||
delay_timeout: delayTimeoutMs,
|
|
||||||
delay_cs_api_url: delayEndpointBaseUrl,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const makeRequest = async (delayParts: IDelayParams): Promise<Response> => {
|
|
||||||
return await fetch(livekitServiceURL + "/sfu/get", {
|
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
@@ -225,31 +197,9 @@ async function getLiveKitJWT(
|
|||||||
room: matrixRoomId,
|
room: matrixRoomId,
|
||||||
openid_token: openIDToken,
|
openid_token: openIDToken,
|
||||||
device_id: deviceId,
|
device_id: deviceId,
|
||||||
...delayParts,
|
|
||||||
}),
|
}),
|
||||||
});
|
}),
|
||||||
};
|
);
|
||||||
|
|
||||||
const res = await doNetworkOperationWithRetry(async () => {
|
|
||||||
let response = await makeRequest(bodyDalayParts);
|
|
||||||
|
|
||||||
// Old service compatibility check
|
|
||||||
const oldServiceDoesNotSupportDelayParts =
|
|
||||||
response.status === 400 && Object.keys(bodyDalayParts).length > 0;
|
|
||||||
// If http status 400 with M_BAD_JSON and we sent delay parts, retry without them
|
|
||||||
if (oldServiceDoesNotSupportDelayParts) {
|
|
||||||
try {
|
|
||||||
const errorBody = await response.json();
|
|
||||||
if (errorBody.errcode === "M_BAD_JSON") {
|
|
||||||
response = await makeRequest({});
|
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
// If we can't parse the error, treat as real error
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return response;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!res.ok) {
|
if (!res.ok) {
|
||||||
throw parseErrorResponse(res, await res.text());
|
throw parseErrorResponse(res, await res.text());
|
||||||
@@ -264,17 +214,15 @@ class NotSupportedError extends Error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getLiveKitJWTWithDelayDelegation(
|
export async function getLiveKitJWT(
|
||||||
membership: CallMembershipIdentityParts,
|
membership: CallMembershipIdentityParts,
|
||||||
livekitServiceURL: string,
|
livekitServiceURL: string,
|
||||||
matrixRoomId: string,
|
matrixRoomId: string,
|
||||||
openIDToken: IOpenIDToken,
|
openIDToken: IOpenIDToken,
|
||||||
delayEndpointBaseUrl?: string,
|
|
||||||
delayId?: string,
|
|
||||||
): Promise<{ url: string; jwt: string }> {
|
): Promise<{ url: string; jwt: string }> {
|
||||||
const { userId, deviceId, memberId } = membership;
|
const { userId, deviceId, memberId } = membership;
|
||||||
|
|
||||||
const body = {
|
const body = JSON.stringify({
|
||||||
room_id: matrixRoomId,
|
room_id: matrixRoomId,
|
||||||
slot_id: "m.call#ROOM",
|
slot_id: "m.call#ROOM",
|
||||||
openid_token: openIDToken,
|
openid_token: openIDToken,
|
||||||
@@ -283,27 +231,13 @@ export async function getLiveKitJWTWithDelayDelegation(
|
|||||||
claimed_user_id: userId,
|
claimed_user_id: userId,
|
||||||
claimed_device_id: deviceId,
|
claimed_device_id: deviceId,
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
let bodyDalayParts = {};
|
|
||||||
// Also check for empty string
|
|
||||||
if (delayId && delayEndpointBaseUrl) {
|
|
||||||
const delayTimeoutMs =
|
|
||||||
Config.get().matrix_rtc_session?.delayed_leave_event_delay_ms;
|
|
||||||
bodyDalayParts = {
|
|
||||||
delay_id: delayId,
|
|
||||||
delay_timeout: delayTimeoutMs,
|
|
||||||
delay_cs_api_url: delayEndpointBaseUrl,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const res = await doNetworkOperationWithRetry(async () => {
|
const res = await doNetworkOperationWithRetry(async () => {
|
||||||
return await fetch(livekitServiceURL + "/get_token", {
|
return await fetch(livekitServiceURL + "/get_token", {
|
||||||
method: "POST",
|
method: "POST",
|
||||||
headers: {
|
headers: { "Content-Type": "application/json" },
|
||||||
"Content-Type": "application/json",
|
body,
|
||||||
},
|
|
||||||
body: JSON.stringify({ ...body, ...bodyDalayParts }),
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,213 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2026 Element Creations Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { describe, expect, it, vi } from "vitest";
|
||||||
|
import { VideoPresets, type VideoPreset } from "livekit-client";
|
||||||
|
|
||||||
|
import { buildLiveKitOptions, getLiveKitOptions } from "./options";
|
||||||
|
import { Config } from "../config/Config";
|
||||||
|
|
||||||
|
vi.mock("../config/Config", () => ({
|
||||||
|
Config: {
|
||||||
|
get: vi.fn(),
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
|
||||||
|
describe("buildLiveKitOptions", () => {
|
||||||
|
it("returns sensible defaults with no config", () => {
|
||||||
|
const opts = buildLiveKitOptions();
|
||||||
|
expect(opts.adaptiveStream).toBe(true);
|
||||||
|
expect(opts.dynacast).toBe(true);
|
||||||
|
expect(opts.videoCaptureDefaults?.resolution).toEqual(
|
||||||
|
VideoPresets.h720.resolution,
|
||||||
|
);
|
||||||
|
expect(opts.publishDefaults?.videoCodec).toBe("vp8");
|
||||||
|
expect(opts.publishDefaults?.videoEncoding).toEqual({
|
||||||
|
maxBitrate: 1_700_000,
|
||||||
|
maxFramerate: 30,
|
||||||
|
});
|
||||||
|
expect(opts.publishDefaults?.screenShareEncoding).toEqual({
|
||||||
|
maxBitrate: 5_000_000,
|
||||||
|
maxFramerate: 30,
|
||||||
|
});
|
||||||
|
expect(opts.publishDefaults?.videoSimulcastLayers).toEqual([
|
||||||
|
VideoPresets.h180,
|
||||||
|
VideoPresets.h360,
|
||||||
|
]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("applies video codec from config", () => {
|
||||||
|
const opts = buildLiveKitOptions({ video_codec: "vp9" });
|
||||||
|
expect(opts.publishDefaults?.videoCodec).toBe("vp9");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("applies video resolution and encoding from config", () => {
|
||||||
|
const baseVideoConfig = {
|
||||||
|
max_resolution: 1080,
|
||||||
|
max_bitrate: 3_000_000,
|
||||||
|
max_framerate: 60,
|
||||||
|
};
|
||||||
|
const opts1080 = buildLiveKitOptions({
|
||||||
|
video: baseVideoConfig,
|
||||||
|
});
|
||||||
|
const opts1440 = buildLiveKitOptions({
|
||||||
|
video: { ...baseVideoConfig, max_resolution: 1440 },
|
||||||
|
});
|
||||||
|
const opts2160 = buildLiveKitOptions({
|
||||||
|
video: { ...baseVideoConfig, max_resolution: 2160 },
|
||||||
|
});
|
||||||
|
expect(opts1080.videoCaptureDefaults?.resolution).toEqual(
|
||||||
|
VideoPresets.h1080.resolution,
|
||||||
|
);
|
||||||
|
expect(opts1440.videoCaptureDefaults?.resolution).toEqual(
|
||||||
|
VideoPresets.h1440.resolution,
|
||||||
|
);
|
||||||
|
expect(opts2160.videoCaptureDefaults?.resolution).toEqual(
|
||||||
|
VideoPresets.h2160.resolution,
|
||||||
|
);
|
||||||
|
expect(opts1080.publishDefaults?.videoEncoding).toEqual({
|
||||||
|
maxBitrate: 3_000_000,
|
||||||
|
maxFramerate: 60,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("applies screen share encoding from config", () => {
|
||||||
|
const opts = buildLiveKitOptions({
|
||||||
|
screen_share: {
|
||||||
|
max_bitrate: 8_000_000,
|
||||||
|
max_framerate: 15,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(opts.publishDefaults?.screenShareEncoding).toEqual({
|
||||||
|
maxBitrate: 8_000_000,
|
||||||
|
maxFramerate: 15,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("uses DEFAULT_CONFIG defaults when only resolution is set", () => {
|
||||||
|
const opts = buildLiveKitOptions({
|
||||||
|
screen_share: {
|
||||||
|
max_resolution: 720,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
// Bitrate and framerate fall back to DEFAULT_CONFIG, not the preset
|
||||||
|
expect(opts.publishDefaults?.screenShareEncoding).toEqual({
|
||||||
|
maxBitrate: 5_000_000,
|
||||||
|
maxFramerate: 30,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("maps low resolutions to the closest preset, rounding up", () => {
|
||||||
|
const expectations: [number, VideoPreset][] = [
|
||||||
|
[180, VideoPresets.h180],
|
||||||
|
[360, VideoPresets.h360],
|
||||||
|
[480, VideoPresets.h540],
|
||||||
|
[540, VideoPresets.h540],
|
||||||
|
[720, VideoPresets.h720],
|
||||||
|
];
|
||||||
|
for (const [height, preset] of expectations) {
|
||||||
|
const opts = buildLiveKitOptions({ video: { max_resolution: height } });
|
||||||
|
expect(opts.videoCaptureDefaults?.resolution).toEqual(preset.resolution);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
it("screen share layers fall back to max_framerate, then 30", () => {
|
||||||
|
const fromMax = buildLiveKitOptions({
|
||||||
|
screen_share: {
|
||||||
|
max_framerate: 15,
|
||||||
|
simulcast_layers: [{ height: 540, bitrate: 1_000_000 }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(
|
||||||
|
fromMax.publishDefaults?.screenShareSimulcastLayers?.[0],
|
||||||
|
).toMatchObject({ encoding: { maxFramerate: 15 } });
|
||||||
|
|
||||||
|
const fromDefault = buildLiveKitOptions({
|
||||||
|
screen_share: {
|
||||||
|
simulcast_layers: [{ height: 540, bitrate: 1_000_000 }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(
|
||||||
|
fromDefault.publishDefaults?.screenShareSimulcastLayers?.[0],
|
||||||
|
).toMatchObject({ encoding: { maxFramerate: 30 } });
|
||||||
|
});
|
||||||
|
|
||||||
|
it("applies custom video simulcast layers", () => {
|
||||||
|
const opts = buildLiveKitOptions({
|
||||||
|
video: {
|
||||||
|
simulcast_layers: [
|
||||||
|
{ height: 180, bitrate: 100_000 },
|
||||||
|
{ height: 360, bitrate: 300_000 },
|
||||||
|
{ height: 540, bitrate: 600_000 },
|
||||||
|
],
|
||||||
|
max_framerate: 24,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const layers = opts.publishDefaults?.videoSimulcastLayers;
|
||||||
|
expect(layers).toHaveLength(3);
|
||||||
|
expect(layers?.[0]).toMatchObject({
|
||||||
|
width: 320,
|
||||||
|
height: 180,
|
||||||
|
encoding: { maxBitrate: 100_000, maxFramerate: 24 },
|
||||||
|
});
|
||||||
|
expect(layers?.[2]).toMatchObject({
|
||||||
|
width: 960,
|
||||||
|
height: 540,
|
||||||
|
encoding: { maxBitrate: 600_000, maxFramerate: 24 },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("applies custom screen share simulcast layers", () => {
|
||||||
|
const opts = buildLiveKitOptions({
|
||||||
|
screen_share: {
|
||||||
|
simulcast_layers: [{ height: 540, bitrate: 1_000_000, framerate: 5 }],
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const layers = opts.publishDefaults?.screenShareSimulcastLayers;
|
||||||
|
expect(layers).toHaveLength(1);
|
||||||
|
expect(layers?.[0]).toMatchObject({
|
||||||
|
width: 960,
|
||||||
|
height: 540,
|
||||||
|
encoding: { maxBitrate: 1_000_000, maxFramerate: 5 },
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not include screenShareSimulcastLayers when not configured", () => {
|
||||||
|
const opts = buildLiveKitOptions();
|
||||||
|
expect(opts.publishDefaults?.screenShareSimulcastLayers).toBeUndefined();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("backupCodec always uses stock VP8 720p encoding", () => {
|
||||||
|
const opts = buildLiveKitOptions({
|
||||||
|
video_codec: "av1",
|
||||||
|
video: { max_bitrate: 10_000_000, max_framerate: 60 },
|
||||||
|
});
|
||||||
|
const backup = opts.publishDefaults?.backupCodec as {
|
||||||
|
codec: string;
|
||||||
|
encoding: { maxBitrate: number; maxFramerate: number };
|
||||||
|
};
|
||||||
|
expect(backup.codec).toBe("vp8");
|
||||||
|
expect(backup.encoding).toEqual(VideoPresets.h720.encoding);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("getLiveKitOptions", () => {
|
||||||
|
it("reads from Config singleton", () => {
|
||||||
|
vi.mocked(Config.get).mockReturnValue({
|
||||||
|
media_quality: { video_codec: "h264" },
|
||||||
|
} as ReturnType<typeof Config.get>);
|
||||||
|
const opts = getLiveKitOptions();
|
||||||
|
expect(opts.publishDefaults?.videoCodec).toBe("h264");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("throws when Config is not initialized", () => {
|
||||||
|
vi.mocked(Config.get).mockImplementation(() => {
|
||||||
|
throw new Error("Config not initialized");
|
||||||
|
});
|
||||||
|
expect(() => getLiveKitOptions()).toThrow("Config not initialized");
|
||||||
|
});
|
||||||
|
});
|
||||||
+131
-33
@@ -9,46 +9,144 @@ import {
|
|||||||
AudioPresets,
|
AudioPresets,
|
||||||
DefaultReconnectPolicy,
|
DefaultReconnectPolicy,
|
||||||
type RoomOptions,
|
type RoomOptions,
|
||||||
ScreenSharePresets,
|
|
||||||
type TrackPublishDefaults,
|
type TrackPublishDefaults,
|
||||||
type VideoPreset,
|
type VideoPreset,
|
||||||
VideoPresets,
|
VideoPresets,
|
||||||
|
VideoPreset as VideoPresetClass,
|
||||||
} from "livekit-client";
|
} from "livekit-client";
|
||||||
|
|
||||||
const defaultLiveKitPublishOptions: TrackPublishDefaults = {
|
import { Config } from "../config/Config";
|
||||||
audioPreset: AudioPresets.music,
|
import { DEFAULT_CONFIG, type ConfigOptions } from "../config/ConfigOptions";
|
||||||
dtx: true,
|
|
||||||
// disable red because the livekit server strips out red packets for clients
|
|
||||||
// that don't support it (firefox) but of course that doesn't work with e2ee.
|
|
||||||
red: false,
|
|
||||||
forceStereo: false,
|
|
||||||
simulcast: true,
|
|
||||||
videoSimulcastLayers: [VideoPresets.h180, VideoPresets.h360] as VideoPreset[],
|
|
||||||
screenShareEncoding: ScreenSharePresets.h1080fps30.encoding,
|
|
||||||
stopMicTrackOnMute: false,
|
|
||||||
videoCodec: "vp8",
|
|
||||||
videoEncoding: VideoPresets.h720.encoding,
|
|
||||||
backupCodec: { codec: "vp8", encoding: VideoPresets.h720.encoding },
|
|
||||||
} as const;
|
|
||||||
|
|
||||||
export const defaultLiveKitOptions: RoomOptions = {
|
/**
|
||||||
// automatically manage subscribed video quality
|
* Find the closest matching VideoPreset for a given height.
|
||||||
adaptiveStream: true,
|
*/
|
||||||
|
function videoPresetForHeight(height: number): VideoPreset {
|
||||||
|
if (height <= 180) return VideoPresets.h180;
|
||||||
|
if (height <= 360) return VideoPresets.h360;
|
||||||
|
if (height <= 540) return VideoPresets.h540;
|
||||||
|
if (height <= 720) return VideoPresets.h720;
|
||||||
|
if (height <= 1080) return VideoPresets.h1080;
|
||||||
|
if (height <= 1440) return VideoPresets.h1440;
|
||||||
|
return VideoPresets.h2160;
|
||||||
|
}
|
||||||
|
|
||||||
// optimize publishing bandwidth and CPU for published tracks
|
/**
|
||||||
dynacast: true,
|
* Build LiveKit publish options from config, falling back to sensible defaults.
|
||||||
|
*/
|
||||||
|
function buildPublishOptions(
|
||||||
|
mediaQuality: ConfigOptions["media_quality"],
|
||||||
|
): TrackPublishDefaults {
|
||||||
|
const defaults = DEFAULT_CONFIG.media_quality;
|
||||||
|
const videoConf = mediaQuality?.video;
|
||||||
|
const screenConf = mediaQuality?.screen_share;
|
||||||
|
const codec = mediaQuality?.video_codec ?? defaults.video_codec;
|
||||||
|
|
||||||
// capture settings
|
// Camera video encoding
|
||||||
videoCaptureDefaults: {
|
const videoEncoding = {
|
||||||
resolution: VideoPresets.h720.resolution,
|
maxBitrate: videoConf?.max_bitrate ?? defaults.video.max_bitrate,
|
||||||
},
|
maxFramerate: videoConf?.max_framerate ?? defaults.video.max_framerate,
|
||||||
|
};
|
||||||
|
|
||||||
// publish settings
|
// Camera simulcast layers
|
||||||
publishDefaults: defaultLiveKitPublishOptions,
|
let videoSimulcastLayers: VideoPreset[];
|
||||||
|
if (videoConf?.simulcast_layers) {
|
||||||
|
videoSimulcastLayers = videoConf.simulcast_layers.map(
|
||||||
|
(layer) =>
|
||||||
|
new VideoPresetClass(
|
||||||
|
Math.round((layer.height * 16) / 9),
|
||||||
|
layer.height,
|
||||||
|
layer.bitrate,
|
||||||
|
videoConf?.max_framerate ?? defaults.video.max_framerate,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
videoSimulcastLayers = [VideoPresets.h180, VideoPresets.h360];
|
||||||
|
}
|
||||||
|
|
||||||
// default LiveKit options that seem to be sane
|
// Screen share encoding
|
||||||
stopLocalTrackOnUnpublish: true,
|
const screenShareEncoding = {
|
||||||
reconnectPolicy: new DefaultReconnectPolicy(),
|
maxBitrate: screenConf?.max_bitrate ?? defaults.screen_share.max_bitrate,
|
||||||
disconnectOnPageLeave: true,
|
maxFramerate:
|
||||||
webAudioMix: false,
|
screenConf?.max_framerate ?? defaults.screen_share.max_framerate,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Screen share simulcast layers
|
||||||
|
let screenShareSimulcastLayers: VideoPreset[] | undefined;
|
||||||
|
if (screenConf?.simulcast_layers) {
|
||||||
|
screenShareSimulcastLayers = screenConf.simulcast_layers.map(
|
||||||
|
(layer) =>
|
||||||
|
new VideoPresetClass(
|
||||||
|
Math.round((layer.height * 16) / 9),
|
||||||
|
layer.height,
|
||||||
|
layer.bitrate,
|
||||||
|
layer.framerate ?? screenConf?.max_framerate ?? 30,
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
audioPreset: AudioPresets.music,
|
||||||
|
dtx: true,
|
||||||
|
// disable red because the livekit server strips out red packets for clients
|
||||||
|
// that don't support it (firefox) but of course that doesn't work with e2ee.
|
||||||
|
red: false,
|
||||||
|
forceStereo: false,
|
||||||
|
simulcast: true,
|
||||||
|
videoSimulcastLayers: videoSimulcastLayers as VideoPreset[],
|
||||||
|
screenShareEncoding,
|
||||||
|
...(screenShareSimulcastLayers && {
|
||||||
|
screenShareSimulcastLayers: screenShareSimulcastLayers as VideoPreset[],
|
||||||
|
}),
|
||||||
|
stopMicTrackOnMute: false,
|
||||||
|
videoCodec: codec,
|
||||||
|
videoEncoding,
|
||||||
|
backupCodec: {
|
||||||
|
codec: "vp8",
|
||||||
|
encoding: VideoPresets.h720.encoding,
|
||||||
|
},
|
||||||
|
} as TrackPublishDefaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Build LiveKit RoomOptions from config.
|
||||||
|
* Call this after Config.init() has resolved.
|
||||||
|
*/
|
||||||
|
export function buildLiveKitOptions(
|
||||||
|
mediaQuality?: ConfigOptions["media_quality"],
|
||||||
|
): RoomOptions {
|
||||||
|
const videoHeight =
|
||||||
|
mediaQuality?.video?.max_resolution ??
|
||||||
|
DEFAULT_CONFIG.media_quality.video.max_resolution;
|
||||||
|
const basePreset = videoPresetForHeight(videoHeight);
|
||||||
|
|
||||||
|
return {
|
||||||
|
// automatically manage subscribed video quality
|
||||||
|
adaptiveStream: true,
|
||||||
|
|
||||||
|
// optimize publishing bandwidth and CPU for published tracks
|
||||||
|
dynacast: true,
|
||||||
|
|
||||||
|
// capture settings
|
||||||
|
videoCaptureDefaults: {
|
||||||
|
resolution: basePreset.resolution,
|
||||||
|
},
|
||||||
|
|
||||||
|
// publish settings
|
||||||
|
publishDefaults: buildPublishOptions(mediaQuality),
|
||||||
|
|
||||||
|
// default LiveKit options that seem to be sane
|
||||||
|
stopLocalTrackOnUnpublish: true,
|
||||||
|
reconnectPolicy: new DefaultReconnectPolicy(),
|
||||||
|
disconnectOnPageLeave: true,
|
||||||
|
webAudioMix: false,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get LiveKit options, reading from the loaded Config singleton.
|
||||||
|
* Requires Config.init() to have resolved first.
|
||||||
|
*/
|
||||||
|
export function getLiveKitOptions(): RoomOptions {
|
||||||
|
return buildLiveKitOptions(Config.get().media_quality);
|
||||||
|
}
|
||||||
|
|||||||
@@ -555,6 +555,9 @@ export const GroupCallView: FC<Props> = ({
|
|||||||
}}
|
}}
|
||||||
onError={(_error) => {
|
onError={(_error) => {
|
||||||
if (rtcSession.isJoined()) onLeft("error");
|
if (rtcSession.isJoined()) onLeft("error");
|
||||||
|
// If there is an error we need to be able to close the widget. This is done in `onLeft` as well
|
||||||
|
// We need it here explicitly in case rtcSession.isJoined is false.
|
||||||
|
void widget?.api.setAlwaysOnScreen(false);
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
{body}
|
{body}
|
||||||
|
|||||||
@@ -49,8 +49,8 @@ import { type EncryptionSystem } from "../e2ee/sharedKeyManagement";
|
|||||||
import { E2eeType } from "../e2ee/e2eeType";
|
import { E2eeType } from "../e2ee/e2eeType";
|
||||||
import { makeGridLayout } from "../grid/GridLayout";
|
import { makeGridLayout } from "../grid/GridLayout";
|
||||||
import { type CallLayoutOutputs } from "../grid/CallLayout";
|
import { type CallLayoutOutputs } from "../grid/CallLayout";
|
||||||
import { makeOneOnOneLandscapeLayout } from "../grid/OneOnOneLandscapeLayout";
|
import { makeOneOnOneDesktopLayout } from "../grid/OneOnOneDesktopLayout";
|
||||||
import { makeOneOnOnePortraitLayout } from "../grid/OneOnOnePortraitLayout";
|
import { makeOneOnOneMobileLayout } from "../grid/OneOnOneMobileLayout";
|
||||||
import { makeSpotlightExpandedLayout } from "../grid/SpotlightExpandedLayout";
|
import { makeSpotlightExpandedLayout } from "../grid/SpotlightExpandedLayout";
|
||||||
import { makeSpotlightLandscapeLayout } from "../grid/SpotlightLandscapeLayout";
|
import { makeSpotlightLandscapeLayout } from "../grid/SpotlightLandscapeLayout";
|
||||||
import { makeSpotlightPortraitLayout } from "../grid/SpotlightPortraitLayout";
|
import { makeSpotlightPortraitLayout } from "../grid/SpotlightPortraitLayout";
|
||||||
@@ -261,6 +261,7 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
const overflowing = useBehavior(vm.overflowing$);
|
const overflowing = useBehavior(vm.overflowing$);
|
||||||
const showNameTags = useBehavior(vm.showNameTags$);
|
const showNameTags = useBehavior(vm.showNameTags$);
|
||||||
const showHeader = useBehavior(vm.showHeader$);
|
const showHeader = useBehavior(vm.showHeader$);
|
||||||
|
const showModals = useBehavior(vm.showModals$);
|
||||||
const settingsOpen = useBehavior(vm.settingsOpen$);
|
const settingsOpen = useBehavior(vm.settingsOpen$);
|
||||||
const setSettingsOpen = useBehavior(vm.setSettingsOpen$);
|
const setSettingsOpen = useBehavior(vm.setSettingsOpen$);
|
||||||
const earpieceMode = useBehavior(vm.earpieceMode$);
|
const earpieceMode = useBehavior(vm.earpieceMode$);
|
||||||
@@ -483,8 +484,8 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
"spotlight-landscape": makeSpotlightLandscapeLayout(inputs),
|
"spotlight-landscape": makeSpotlightLandscapeLayout(inputs),
|
||||||
"spotlight-portrait": makeSpotlightPortraitLayout(inputs),
|
"spotlight-portrait": makeSpotlightPortraitLayout(inputs),
|
||||||
"spotlight-expanded": makeSpotlightExpandedLayout(inputs),
|
"spotlight-expanded": makeSpotlightExpandedLayout(inputs),
|
||||||
"one-on-one-landscape": makeOneOnOneLandscapeLayout(inputs),
|
"one-on-one-desktop": makeOneOnOneDesktopLayout(inputs),
|
||||||
"one-on-one-portrait": makeOneOnOnePortraitLayout(inputs),
|
"one-on-one-mobile": makeOneOnOneMobileLayout(inputs),
|
||||||
};
|
};
|
||||||
}, [gridBoundsObservable$]);
|
}, [gridBoundsObservable$]);
|
||||||
|
|
||||||
@@ -622,7 +623,7 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
{earpieceOverlay}
|
{earpieceOverlay}
|
||||||
<ReactionsOverlay vm={vm} />
|
<ReactionsOverlay vm={vm} />
|
||||||
{footer}
|
{footer}
|
||||||
{layout.type !== "pip" && (
|
{showModals && (
|
||||||
<>
|
<>
|
||||||
<RageshakeRequestModal {...rageshakeRequestModalProps} />
|
<RageshakeRequestModal {...rageshakeRequestModalProps} />
|
||||||
<SettingsModal
|
<SettingsModal
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2026 Element Creations Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { useId, type FC } from "react";
|
||||||
|
import {
|
||||||
|
SpotlightViewIcon,
|
||||||
|
GridIcon,
|
||||||
|
} from "@vector-im/compound-design-tokens/assets/web/icons";
|
||||||
|
|
||||||
|
import { type LayoutSwitchViewModel } from "../state/LayoutSwitchViewModel";
|
||||||
|
import { useBehavior } from "../useBehavior";
|
||||||
|
import { useTranslation } from "react-i18next";
|
||||||
|
import { Switch } from "@vector-im/compound-web";
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
vm: LayoutSwitchViewModel;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const LayoutSwitch: FC<Props> = ({ vm, className }) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const layout = useBehavior(vm.layout$);
|
||||||
|
const name = useId();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Switch<"spotlight", "grid">
|
||||||
|
name={name}
|
||||||
|
aria-label={t("layout_switch_label")}
|
||||||
|
leftLabel={t("layout_spotlight_label")}
|
||||||
|
leftValue="spotlight"
|
||||||
|
leftIcon={SpotlightViewIcon}
|
||||||
|
rightLabel={t("layout_grid_label")}
|
||||||
|
rightValue="grid"
|
||||||
|
rightIcon={GridIcon}
|
||||||
|
className={className}
|
||||||
|
value={layout}
|
||||||
|
onChange={vm.setLayout}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -10,6 +10,8 @@ Please see LICENSE in the repository root for full details.
|
|||||||
margin-right: var(--content-inset-right);
|
margin-right: var(--content-inset-right);
|
||||||
min-block-size: 0;
|
min-block-size: 0;
|
||||||
block-size: 50vh;
|
block-size: 50vh;
|
||||||
|
aspect-ratio: 16 / 9;
|
||||||
|
max-width: 100%;
|
||||||
border-radius: var(--cpd-space-4x);
|
border-radius: var(--cpd-space-4x);
|
||||||
position: relative;
|
position: relative;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
@@ -20,6 +22,9 @@ Please see LICENSE in the repository root for full details.
|
|||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: cover;
|
object-fit: cover;
|
||||||
background-color: var(--video-tile-background);
|
background-color: var(--video-tile-background);
|
||||||
|
/* In FF if you add a transform: scale/translate/matrix filter on an element,
|
||||||
|
it'll ignore the parents' border-radius, so force back the radius to avoid UI glitch*/
|
||||||
|
border-radius: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
video.mirror {
|
video.mirror {
|
||||||
@@ -66,12 +71,6 @@ video.mirror {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@media (min-aspect-ratio: 1 / 1) {
|
|
||||||
.preview > video {
|
|
||||||
aspect-ratio: 16 / 9;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media (max-width: 550px) {
|
@media (max-width: 550px) {
|
||||||
.preview {
|
.preview {
|
||||||
margin-inline: 0;
|
margin-inline: 0;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import { useTranslation } from "react-i18next";
|
|||||||
import { TileAvatar } from "../tile/TileAvatar";
|
import { TileAvatar } from "../tile/TileAvatar";
|
||||||
import styles from "./VideoPreview.module.css";
|
import styles from "./VideoPreview.module.css";
|
||||||
import { type EncryptionSystem } from "../e2ee/sharedKeyManagement";
|
import { type EncryptionSystem } from "../e2ee/sharedKeyManagement";
|
||||||
|
import videoPlaceholder from "../graphics/video-placeholder.gif";
|
||||||
|
|
||||||
export type MatrixInfo = {
|
export type MatrixInfo = {
|
||||||
userId: string;
|
userId: string;
|
||||||
@@ -74,6 +75,9 @@ export const VideoPreview: FC<Props> = ({
|
|||||||
// There's no reason for this to be focusable
|
// There's no reason for this to be focusable
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
disablePictureInPicture
|
disablePictureInPicture
|
||||||
|
// Set the placeholder to a small transparent image. (On Android web
|
||||||
|
// views the default poster image is particularly ugly.)
|
||||||
|
poster={videoPlaceholder}
|
||||||
/>
|
/>
|
||||||
{(!videoEnabled || cameraIsStarting) && (
|
{(!videoEnabled || cameraIsStarting) && (
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -87,14 +87,14 @@ exports[`InCallView > rendering > renders 1`] = `
|
|||||||
class="_scrollingGrid_4e7ff8 _grid_b0d1cd"
|
class="_scrollingGrid_4e7ff8 _grid_b0d1cd"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="_layer_b00c5f"
|
class="_layer_185815"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="_container_b00c5f _slot_b0d1cd"
|
class="_container_185815 _slot_b0d1cd"
|
||||||
data-id="1"
|
data-id="1"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="_slot_b00c5f _local_b00c5f _slot_b0d1cd"
|
class="_slot_185815 _local_185815 _slot_b0d1cd"
|
||||||
data-block-alignment="start"
|
data-block-alignment="start"
|
||||||
data-id="0"
|
data-id="0"
|
||||||
data-inline-alignment="end"
|
data-inline-alignment="end"
|
||||||
@@ -428,12 +428,12 @@ exports[`InCallView > rendering > renders 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
<fieldset
|
<fieldset
|
||||||
aria-label="Layout"
|
aria-label="Layout"
|
||||||
class="_toggle_13rnk_9 _layout_20b7b4"
|
class="_toggle_1t5ha_9 _layout_20b7b4"
|
||||||
data-size="lg"
|
data-size="lg"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
aria-labelledby="_r_19_"
|
aria-labelledby="_r_1a_"
|
||||||
name="layoutMode"
|
name="_r_19_"
|
||||||
type="radio"
|
type="radio"
|
||||||
value="spotlight"
|
value="spotlight"
|
||||||
/>
|
/>
|
||||||
@@ -446,13 +446,15 @@ exports[`InCallView > rendering > renders 1`] = `
|
|||||||
xmlns="http://www.w3.org/2000/svg"
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
>
|
>
|
||||||
<path
|
<path
|
||||||
d="M5 5h14v8h-5a1 1 0 0 0-1 1v5H5zm10 14v-4h4v4zM5 21h14a2 2 0 0 0 2-2V5a2 2 0 0 0-2-2H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2"
|
clip-rule="evenodd"
|
||||||
|
d="M20 6H4v12h16zM4 4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V6a2 2 0 0 0-2-2z"
|
||||||
|
fill-rule="evenodd"
|
||||||
/>
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
<input
|
<input
|
||||||
aria-labelledby="_r_1e_"
|
aria-labelledby="_r_1f_"
|
||||||
checked=""
|
checked=""
|
||||||
name="layoutMode"
|
name="_r_19_"
|
||||||
type="radio"
|
type="radio"
|
||||||
value="grid"
|
value="grid"
|
||||||
/>
|
/>
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ exports[`LobbyView > renders with AppBar android 1`] = `
|
|||||||
<video
|
<video
|
||||||
disablepictureinpicture=""
|
disablepictureinpicture=""
|
||||||
playsinline=""
|
playsinline=""
|
||||||
|
poster="/src/graphics/video-placeholder.gif"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
@@ -84,7 +85,7 @@ exports[`LobbyView > renders with AppBar android 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a
|
<a
|
||||||
class="_link_k9ljz_8"
|
class="_link_13esb_8"
|
||||||
data-kind="primary"
|
data-kind="primary"
|
||||||
data-size="md"
|
data-size="md"
|
||||||
href="/"
|
href="/"
|
||||||
@@ -280,6 +281,7 @@ exports[`LobbyView > renders with AppBar ios 1`] = `
|
|||||||
<video
|
<video
|
||||||
disablepictureinpicture=""
|
disablepictureinpicture=""
|
||||||
playsinline=""
|
playsinline=""
|
||||||
|
poster="/src/graphics/video-placeholder.gif"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
@@ -315,7 +317,7 @@ exports[`LobbyView > renders with AppBar ios 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a
|
<a
|
||||||
class="_link_k9ljz_8"
|
class="_link_13esb_8"
|
||||||
data-kind="primary"
|
data-kind="primary"
|
||||||
data-size="md"
|
data-size="md"
|
||||||
href="/"
|
href="/"
|
||||||
@@ -558,6 +560,7 @@ exports[`LobbyView > renders with header and participant count 1`] = `
|
|||||||
<video
|
<video
|
||||||
disablepictureinpicture=""
|
disablepictureinpicture=""
|
||||||
playsinline=""
|
playsinline=""
|
||||||
|
poster="/src/graphics/video-placeholder.gif"
|
||||||
tabindex="-1"
|
tabindex="-1"
|
||||||
/>
|
/>
|
||||||
<div
|
<div
|
||||||
@@ -592,7 +595,7 @@ exports[`LobbyView > renders with header and participant count 1`] = `
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<a
|
<a
|
||||||
class="_link_k9ljz_8"
|
class="_link_13esb_8"
|
||||||
data-kind="primary"
|
data-kind="primary"
|
||||||
data-size="md"
|
data-size="md"
|
||||||
href="/"
|
href="/"
|
||||||
|
|||||||
@@ -280,7 +280,7 @@ export const useLoadGroupCall = (
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
roomSummary === undefined ||
|
roomSummary?.join_rule === undefined ||
|
||||||
roomSummary.join_rule === JoinRule.Public
|
roomSummary.join_rule === JoinRule.Public
|
||||||
) {
|
) {
|
||||||
room = await client.joinRoom(roomId, {
|
room = await client.joinRoom(roomId, {
|
||||||
|
|||||||
@@ -317,19 +317,15 @@ describe("DeveloperSettingsTab", () => {
|
|||||||
|
|
||||||
describe("matrix rtc mode", () => {
|
describe("matrix rtc mode", () => {
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
matrixRTCModeSetting.setValue(MatrixRTCMode.Legacy);
|
matrixRTCModeSetting.setValue(MatrixRTCMode.Compatibility);
|
||||||
vi.restoreAllMocks();
|
vi.restoreAllMocks();
|
||||||
});
|
});
|
||||||
|
|
||||||
function getModeRadios(): {
|
function getModeRadios(): {
|
||||||
legacy: HTMLInputElement;
|
|
||||||
compatibility: HTMLInputElement;
|
compatibility: HTMLInputElement;
|
||||||
matrix20: HTMLInputElement;
|
matrix20: HTMLInputElement;
|
||||||
} {
|
} {
|
||||||
return {
|
return {
|
||||||
legacy: screen.getByDisplayValue(
|
|
||||||
MatrixRTCMode.Legacy,
|
|
||||||
) as HTMLInputElement,
|
|
||||||
compatibility: screen.getByDisplayValue(
|
compatibility: screen.getByDisplayValue(
|
||||||
MatrixRTCMode.Compatibility,
|
MatrixRTCMode.Compatibility,
|
||||||
) as HTMLInputElement,
|
) as HTMLInputElement,
|
||||||
@@ -359,27 +355,21 @@ describe("DeveloperSettingsTab", () => {
|
|||||||
|
|
||||||
const radios = getModeRadios();
|
const radios = getModeRadios();
|
||||||
expect(radios.compatibility).toBeChecked();
|
expect(radios.compatibility).toBeChecked();
|
||||||
expect(radios.legacy).not.toBeChecked();
|
|
||||||
expect(radios.matrix20).not.toBeChecked();
|
expect(radios.matrix20).not.toBeChecked();
|
||||||
// None are disabled by config; only Matrix_2_0 may be disabled by sticky-events support.
|
// None are disabled by config; only Matrix_2_0 may be disabled by sticky-events support.
|
||||||
expect(radios.legacy).not.toBeDisabled();
|
|
||||||
expect(radios.compatibility).not.toBeDisabled();
|
expect(radios.compatibility).not.toBeDisabled();
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([MatrixRTCMode.Compatibility, MatrixRTCMode.Matrix_2_0])(
|
||||||
MatrixRTCMode.Legacy,
|
|
||||||
MatrixRTCMode.Compatibility,
|
|
||||||
MatrixRTCMode.Matrix_2_0,
|
|
||||||
])(
|
|
||||||
"disables all radios and shows the config value (%s) as checked when matrix_rtc_mode is set",
|
"disables all radios and shows the config value (%s) as checked when matrix_rtc_mode is set",
|
||||||
async (configMode) => {
|
async (configMode) => {
|
||||||
mockConfig({ matrix_rtc_mode: configMode });
|
mockConfig({ matrix_rtc_mode: configMode });
|
||||||
// Local setting is intentionally different from the config value to
|
// Local setting is intentionally different from the config value to
|
||||||
// prove config wins.
|
// prove config wins.
|
||||||
matrixRTCModeSetting.setValue(
|
matrixRTCModeSetting.setValue(
|
||||||
configMode === MatrixRTCMode.Legacy
|
configMode === MatrixRTCMode.Compatibility
|
||||||
? MatrixRTCMode.Compatibility
|
? MatrixRTCMode.Matrix_2_0
|
||||||
: MatrixRTCMode.Legacy,
|
: MatrixRTCMode.Compatibility,
|
||||||
);
|
);
|
||||||
const client = createMockMatrixClient();
|
const client = createMockMatrixClient();
|
||||||
|
|
||||||
@@ -397,13 +387,11 @@ describe("DeveloperSettingsTab", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const radios = getModeRadios();
|
const radios = getModeRadios();
|
||||||
expect(radios.legacy).toBeDisabled();
|
|
||||||
expect(radios.compatibility).toBeDisabled();
|
expect(radios.compatibility).toBeDisabled();
|
||||||
expect(radios.matrix20).toBeDisabled();
|
expect(radios.matrix20).toBeDisabled();
|
||||||
|
|
||||||
const checkedValue = (
|
const checkedValue = (
|
||||||
{
|
{
|
||||||
[MatrixRTCMode.Legacy]: radios.legacy,
|
|
||||||
[MatrixRTCMode.Compatibility]: radios.compatibility,
|
[MatrixRTCMode.Compatibility]: radios.compatibility,
|
||||||
[MatrixRTCMode.Matrix_2_0]: radios.matrix20,
|
[MatrixRTCMode.Matrix_2_0]: radios.matrix20,
|
||||||
} as const
|
} as const
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
import {
|
import {
|
||||||
type ChangeEvent,
|
type ChangeEvent,
|
||||||
type FC,
|
type FC,
|
||||||
|
type ReactNode,
|
||||||
useCallback,
|
useCallback,
|
||||||
useEffect,
|
useEffect,
|
||||||
useMemo,
|
useMemo,
|
||||||
@@ -29,12 +30,14 @@ import {
|
|||||||
InlineField,
|
InlineField,
|
||||||
Label,
|
Label,
|
||||||
RadioControl,
|
RadioControl,
|
||||||
|
Separator,
|
||||||
} from "@vector-im/compound-web";
|
} from "@vector-im/compound-web";
|
||||||
import { type Room as LivekitRoom } from "livekit-client";
|
import { type Room as LivekitRoom } from "livekit-client";
|
||||||
|
|
||||||
import { FieldRow, InputField } from "../input/Input";
|
import { FieldRow, InputField } from "../input/Input";
|
||||||
import { Config } from "../config/Config";
|
import { Config } from "../config/Config";
|
||||||
import {
|
import {
|
||||||
|
type Setting,
|
||||||
useSetting,
|
useSetting,
|
||||||
duplicateTiles as duplicateTilesSetting,
|
duplicateTiles as duplicateTilesSetting,
|
||||||
debugTileLayout as debugTileLayoutSetting,
|
debugTileLayout as debugTileLayoutSetting,
|
||||||
@@ -43,10 +46,26 @@ import {
|
|||||||
alwaysShowIphoneEarpiece as alwaysShowIphoneEarpieceSetting,
|
alwaysShowIphoneEarpiece as alwaysShowIphoneEarpieceSetting,
|
||||||
matrixRTCMode as matrixRTCModeSetting,
|
matrixRTCMode as matrixRTCModeSetting,
|
||||||
customLivekitUrl as customLivekitUrlSetting,
|
customLivekitUrl as customLivekitUrlSetting,
|
||||||
|
advancedScreenShare as advancedScreenShareSetting,
|
||||||
|
screenShareResolution as screenShareResolutionSetting,
|
||||||
|
screenShareFramerate as screenShareFramerateSetting,
|
||||||
|
screenShareBitrate as screenShareBitrateSetting,
|
||||||
|
screenShareCodec as screenShareCodecSetting,
|
||||||
|
advancedCamera as advancedCameraSetting,
|
||||||
|
cameraResolution as cameraResolutionSetting,
|
||||||
|
cameraFramerate as cameraFramerateSetting,
|
||||||
|
cameraBitrate as cameraBitrateSetting,
|
||||||
|
cameraCodec as cameraCodecSetting,
|
||||||
|
echoCancellationSetting,
|
||||||
|
noiseSuppressionSetting,
|
||||||
|
autoGainControlSetting,
|
||||||
|
type VideoCodec,
|
||||||
enableExtendedLivekitLogs as enableExtendedLivekitLogsSetting,
|
enableExtendedLivekitLogs as enableExtendedLivekitLogsSetting,
|
||||||
} from "./settings";
|
} from "./settings";
|
||||||
import { MatrixRTCMode } from "../config/ConfigOptions";
|
import { MatrixRTCMode } from "../config/ConfigOptions";
|
||||||
import styles from "./DeveloperSettingsTab.module.css";
|
import styles from "./DeveloperSettingsTab.module.css";
|
||||||
|
import settingsStyles from "./SettingsModal.module.css";
|
||||||
|
import { Slider } from "../Slider";
|
||||||
import { useUrlParams } from "../UrlParams";
|
import { useUrlParams } from "../UrlParams";
|
||||||
import { getSFUConfigWithOpenID } from "../livekit/openIDSFU";
|
import { getSFUConfigWithOpenID } from "../livekit/openIDSFU";
|
||||||
|
|
||||||
@@ -138,6 +157,185 @@ export const DeveloperSettingsTab: FC<Props> = ({
|
|||||||
return null;
|
return null;
|
||||||
}, [livekitRooms]);
|
}, [livekitRooms]);
|
||||||
|
|
||||||
|
const MediaQualitySettings: React.FC<{
|
||||||
|
id: string;
|
||||||
|
header: string;
|
||||||
|
toggleLabel: string;
|
||||||
|
description: string;
|
||||||
|
toggleSetting: Setting<boolean>;
|
||||||
|
resolutionSetting: Setting<string>;
|
||||||
|
framerateSetting: Setting<number>;
|
||||||
|
bitrateSetting: Setting<number>;
|
||||||
|
codecSetting: Setting<VideoCodec>;
|
||||||
|
resolutionOptions: { value: string; label: string }[];
|
||||||
|
bitrateRange: { min: number; max: number; step: number };
|
||||||
|
}> = ({
|
||||||
|
id,
|
||||||
|
header,
|
||||||
|
toggleLabel,
|
||||||
|
description,
|
||||||
|
toggleSetting,
|
||||||
|
resolutionSetting,
|
||||||
|
framerateSetting,
|
||||||
|
bitrateSetting,
|
||||||
|
codecSetting,
|
||||||
|
resolutionOptions,
|
||||||
|
bitrateRange,
|
||||||
|
}): ReactNode => {
|
||||||
|
const [advancedEnabled, setAdvancedEnabled] = useSetting(toggleSetting);
|
||||||
|
const [resolution, setResolution] = useSetting(resolutionSetting);
|
||||||
|
const [framerate, setFramerate] = useSetting(framerateSetting);
|
||||||
|
const [framerateRaw, setFramerateRaw] = useState(framerate);
|
||||||
|
const [bitrate, setBitrate] = useSetting(bitrateSetting);
|
||||||
|
const [bitrateRaw, setBitrateRaw] = useState(bitrate);
|
||||||
|
const [codec, setCodec] = useSetting(codecSetting);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h4>{header}</h4>
|
||||||
|
<FieldRow>
|
||||||
|
<InputField
|
||||||
|
id={`${id}Toggle`}
|
||||||
|
label={toggleLabel}
|
||||||
|
description={description}
|
||||||
|
type="checkbox"
|
||||||
|
checked={advancedEnabled}
|
||||||
|
onChange={(e): void => setAdvancedEnabled(e.target.checked)}
|
||||||
|
/>
|
||||||
|
</FieldRow>
|
||||||
|
{advancedEnabled && (
|
||||||
|
<>
|
||||||
|
<div className={settingsStyles.volumeSlider}>
|
||||||
|
<label htmlFor={`${id}Resolution`}>
|
||||||
|
{t("settings.resolution_label", "Resolution")}
|
||||||
|
</label>
|
||||||
|
<select
|
||||||
|
id={`${id}Resolution`}
|
||||||
|
value={resolution}
|
||||||
|
onChange={(e): void => setResolution(e.target.value)}
|
||||||
|
>
|
||||||
|
{resolutionOptions.map((opt) => (
|
||||||
|
<option key={opt.value} value={opt.value}>
|
||||||
|
{opt.label}
|
||||||
|
</option>
|
||||||
|
))}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div className={settingsStyles.volumeSlider}>
|
||||||
|
<label>
|
||||||
|
{t("settings.framerate_label", "Framerate")}
|
||||||
|
{": "}
|
||||||
|
<span className={settingsStyles.settingValue}>
|
||||||
|
{framerateRaw} fps
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<Slider
|
||||||
|
label={t("settings.framerate_label", "Framerate")}
|
||||||
|
value={framerateRaw}
|
||||||
|
onValueChange={setFramerateRaw}
|
||||||
|
onValueCommit={setFramerate}
|
||||||
|
min={5}
|
||||||
|
max={60}
|
||||||
|
step={5}
|
||||||
|
tooltipFormatter={(v): string => `${v} fps`}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className={settingsStyles.volumeSlider}>
|
||||||
|
<label>
|
||||||
|
{t("settings.bitrate_label", "Bitrate")}
|
||||||
|
{": "}
|
||||||
|
<span className={settingsStyles.settingValue}>
|
||||||
|
{(bitrateRaw / 1_000_000).toFixed(1)} Mbps
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
<Slider
|
||||||
|
label={t("settings.bitrate_label", "Bitrate")}
|
||||||
|
value={bitrateRaw}
|
||||||
|
onValueChange={setBitrateRaw}
|
||||||
|
onValueCommit={setBitrate}
|
||||||
|
min={bitrateRange.min}
|
||||||
|
max={bitrateRange.max}
|
||||||
|
step={bitrateRange.step}
|
||||||
|
tooltipFormatter={(v): string =>
|
||||||
|
`${(v / 1_000_000).toFixed(1)} Mbps`
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className={settingsStyles.volumeSlider}>
|
||||||
|
<label htmlFor={`${id}Codec`}>
|
||||||
|
{t("settings.codec_label", "Codec")}
|
||||||
|
</label>
|
||||||
|
<select
|
||||||
|
id={`${id}Codec`}
|
||||||
|
value={codec}
|
||||||
|
onChange={(e): void => setCodec(e.target.value as VideoCodec)}
|
||||||
|
>
|
||||||
|
<option value="vp8">VP8</option>
|
||||||
|
<option value="vp9">VP9</option>
|
||||||
|
<option value="h264">H.264</option>
|
||||||
|
<option value="av1">AV1</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
|
const AudioProcessingSettings: React.FC = (): ReactNode => {
|
||||||
|
const [echoCancellation, setEchoCancellation] = useSetting(
|
||||||
|
echoCancellationSetting,
|
||||||
|
);
|
||||||
|
const [noiseSuppression, setNoiseSuppression] = useSetting(
|
||||||
|
noiseSuppressionSetting,
|
||||||
|
);
|
||||||
|
const [autoGainControl, setAutoGainControl] = useSetting(
|
||||||
|
autoGainControlSetting,
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<h4>{t("settings.audio_processing_header", "Audio processing")}</h4>
|
||||||
|
<p>
|
||||||
|
{t(
|
||||||
|
"settings.audio_processing_description",
|
||||||
|
"Changes apply on next call join.",
|
||||||
|
)}
|
||||||
|
</p>
|
||||||
|
<FieldRow>
|
||||||
|
<InputField
|
||||||
|
id="echoCancellation"
|
||||||
|
label={t("settings.echo_cancellation_label", "Echo cancellation")}
|
||||||
|
type="checkbox"
|
||||||
|
checked={echoCancellation}
|
||||||
|
onChange={(e): void => setEchoCancellation(e.target.checked)}
|
||||||
|
/>
|
||||||
|
</FieldRow>
|
||||||
|
<FieldRow>
|
||||||
|
<InputField
|
||||||
|
id="noiseSuppression"
|
||||||
|
label={t("settings.noise_suppression_label", "Noise suppression")}
|
||||||
|
type="checkbox"
|
||||||
|
checked={noiseSuppression}
|
||||||
|
onChange={(e): void => setNoiseSuppression(e.target.checked)}
|
||||||
|
/>
|
||||||
|
</FieldRow>
|
||||||
|
<FieldRow>
|
||||||
|
<InputField
|
||||||
|
id="autoGainControl"
|
||||||
|
label={t(
|
||||||
|
"settings.auto_gain_control_label",
|
||||||
|
"Automatic gain control",
|
||||||
|
)}
|
||||||
|
type="checkbox"
|
||||||
|
checked={autoGainControl}
|
||||||
|
onChange={(e): void => setAutoGainControl(e.target.checked)}
|
||||||
|
/>
|
||||||
|
</FieldRow>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<p>
|
<p>
|
||||||
@@ -166,6 +364,7 @@ export const DeveloperSettingsTab: FC<Props> = ({
|
|||||||
id: client.getDeviceId() || "unknown",
|
id: client.getDeviceId() || "unknown",
|
||||||
})}
|
})}
|
||||||
</p>
|
</p>
|
||||||
|
<Separator />
|
||||||
<FieldRow>
|
<FieldRow>
|
||||||
<InputField
|
<InputField
|
||||||
id="duplicateTiles"
|
id="duplicateTiles"
|
||||||
@@ -315,27 +514,12 @@ export const DeveloperSettingsTab: FC<Props> = ({
|
|||||||
<ErrorMessage>{customLivekitUrlUpdateError}</ErrorMessage>
|
<ErrorMessage>{customLivekitUrlUpdateError}</ErrorMessage>
|
||||||
)}
|
)}
|
||||||
</EditInPlace>
|
</EditInPlace>
|
||||||
|
<Separator />
|
||||||
<Heading as="h3" type="body" weight="semibold" size="lg">
|
<Heading as="h3" type="body" weight="semibold" size="lg">
|
||||||
{t("developer_mode.matrixRTCMode.title")}
|
{t("developer_mode.matrixRTCMode.title")}
|
||||||
</Heading>
|
</Heading>
|
||||||
{matrixRTCModeForced && <p>Your deployment overrides the mode.</p>}
|
{matrixRTCModeForced && <p>Your deployment overrides the mode.</p>}
|
||||||
<Form>
|
<Form>
|
||||||
<InlineField
|
|
||||||
name={matrixRTCModeRadioGroup}
|
|
||||||
control={
|
|
||||||
<RadioControl
|
|
||||||
checked={effectiveMatrixRTCMode === MatrixRTCMode.Legacy}
|
|
||||||
value={MatrixRTCMode.Legacy}
|
|
||||||
disabled={matrixRTCModeForced}
|
|
||||||
onChange={onMatrixRTCModeChange}
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
>
|
|
||||||
<Label>{t("developer_mode.matrixRTCMode.Legacy.label")}</Label>
|
|
||||||
<HelpMessage>
|
|
||||||
{t("developer_mode.matrixRTCMode.Legacy.description")}
|
|
||||||
</HelpMessage>
|
|
||||||
</InlineField>
|
|
||||||
<InlineField
|
<InlineField
|
||||||
name={matrixRTCModeRadioGroup}
|
name={matrixRTCModeRadioGroup}
|
||||||
control={
|
control={
|
||||||
@@ -403,6 +587,61 @@ export const DeveloperSettingsTab: FC<Props> = ({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
|
<Separator />
|
||||||
|
<MediaQualitySettings
|
||||||
|
id="camera"
|
||||||
|
header={t("settings.camera_header", "Camera quality")}
|
||||||
|
toggleLabel={t(
|
||||||
|
"settings.advanced_camera_label",
|
||||||
|
"Advanced camera settings",
|
||||||
|
)}
|
||||||
|
description={t(
|
||||||
|
"settings.advanced_camera_description",
|
||||||
|
"Configure resolution, framerate, bitrate, and codec for camera video. Changes apply on next call join.",
|
||||||
|
)}
|
||||||
|
toggleSetting={advancedCameraSetting}
|
||||||
|
resolutionSetting={cameraResolutionSetting}
|
||||||
|
framerateSetting={cameraFramerateSetting}
|
||||||
|
bitrateSetting={cameraBitrateSetting}
|
||||||
|
codecSetting={cameraCodecSetting}
|
||||||
|
resolutionOptions={[
|
||||||
|
{ value: "640x360", label: "360p" },
|
||||||
|
{ value: "960x540", label: "540p" },
|
||||||
|
{ value: "1280x720", label: "720p" },
|
||||||
|
{ value: "1920x1080", label: "1080p" },
|
||||||
|
{ value: "2560x1440", label: "1440p" },
|
||||||
|
]}
|
||||||
|
bitrateRange={{ min: 200_000, max: 8_000_000, step: 100_000 }}
|
||||||
|
/>
|
||||||
|
<Separator />
|
||||||
|
<MediaQualitySettings
|
||||||
|
id="screenShare"
|
||||||
|
header={t("settings.screen_share_header", "Screen sharing")}
|
||||||
|
toggleLabel={t(
|
||||||
|
"settings.advanced_screen_share_label",
|
||||||
|
"Advanced screen share settings",
|
||||||
|
)}
|
||||||
|
description={t(
|
||||||
|
"settings.advanced_screen_share_description",
|
||||||
|
"Configure resolution, framerate, bitrate, and codec for screen sharing",
|
||||||
|
)}
|
||||||
|
toggleSetting={advancedScreenShareSetting}
|
||||||
|
resolutionSetting={screenShareResolutionSetting}
|
||||||
|
framerateSetting={screenShareFramerateSetting}
|
||||||
|
bitrateSetting={screenShareBitrateSetting}
|
||||||
|
codecSetting={screenShareCodecSetting}
|
||||||
|
resolutionOptions={[
|
||||||
|
{ value: "1024x576", label: "576p" },
|
||||||
|
{ value: "1280x720", label: "720p" },
|
||||||
|
{ value: "1920x1080", label: "1080p" },
|
||||||
|
{ value: "2560x1440", label: "1440p" },
|
||||||
|
{ value: "3840x2160", label: "4K" },
|
||||||
|
]}
|
||||||
|
bitrateRange={{ min: 500_000, max: 15_000_000, step: 500_000 }}
|
||||||
|
/>
|
||||||
|
<Separator />
|
||||||
|
<AudioProcessingSettings />
|
||||||
|
<Separator />
|
||||||
<p>{t("developer_mode.environment_variables")}</p>
|
<p>{t("developer_mode.environment_variables")}</p>
|
||||||
<pre>{JSON.stringify(env, null, 2)}</pre>
|
<pre>{JSON.stringify(env, null, 2)}</pre>
|
||||||
<p>{t("developer_mode.url_params")}</p>
|
<p>{t("developer_mode.url_params")}</p>
|
||||||
|
|||||||
@@ -33,3 +33,27 @@ Please see LICENSE in the repository root for full details.
|
|||||||
.volumeSlider > p {
|
.volumeSlider > p {
|
||||||
color: var(--cpd-color-text-secondary);
|
color: var(--cpd-color-text-secondary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.volumeSlider > select {
|
||||||
|
display: block;
|
||||||
|
width: 100%;
|
||||||
|
padding: 8px 12px;
|
||||||
|
margin-top: var(--cpd-space-1x);
|
||||||
|
border: 1px solid var(--cpd-color-border-interactive-primary);
|
||||||
|
border-radius: 4px;
|
||||||
|
background-color: var(--cpd-color-bg-canvas-default);
|
||||||
|
color: var(--cpd-color-text-primary);
|
||||||
|
font-size: var(--font-size-body);
|
||||||
|
font-family: inherit;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
|
|
||||||
|
.volumeSlider > select:focus {
|
||||||
|
outline: none;
|
||||||
|
border-color: var(--cpd-color-text-link-external);
|
||||||
|
}
|
||||||
|
|
||||||
|
.settingValue {
|
||||||
|
font-weight: normal;
|
||||||
|
color: var(--cpd-color-text-secondary);
|
||||||
|
}
|
||||||
|
|||||||
@@ -152,7 +152,13 @@ export const SettingsModal: FC<Props> = ({
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
<div className={styles.volumeSlider}>
|
<div className={styles.volumeSlider}>
|
||||||
<label>{t("settings.audio_tab.effect_volume_label")}</label>
|
<label>
|
||||||
|
{t("settings.audio_tab.effect_volume_label")}
|
||||||
|
{": "}
|
||||||
|
<span className={styles.settingValue}>
|
||||||
|
{Math.round(soundVolumeRaw * 100)}%
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
<p>{t("settings.audio_tab.effect_volume_description")}</p>
|
<p>{t("settings.audio_tab.effect_volume_description")}</p>
|
||||||
<Slider
|
<Slider
|
||||||
label={t("video_tile.volume")}
|
label={t("video_tile.volume")}
|
||||||
|
|||||||
@@ -17,6 +17,12 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
|
|||||||
<p>
|
<p>
|
||||||
Device ID: DEVICE123
|
Device ID: DEVICE123
|
||||||
</p>
|
</p>
|
||||||
|
<div
|
||||||
|
class="_separator_13qwf_8"
|
||||||
|
data-kind="primary"
|
||||||
|
data-orientation="horizontal"
|
||||||
|
role="separator"
|
||||||
|
/>
|
||||||
<div
|
<div
|
||||||
class="_fieldRow_1bd8c0"
|
class="_fieldRow_1bd8c0"
|
||||||
>
|
>
|
||||||
@@ -251,10 +257,16 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
|
|||||||
class="_message_1o4d9_86 _help-message_1o4d9_92"
|
class="_message_1o4d9_86 _help-message_1o4d9_92"
|
||||||
id="radix-_r_8_"
|
id="radix-_r_8_"
|
||||||
>
|
>
|
||||||
Currently, no overwrite is set. Url from well-known or config is used.
|
Currently, no overwrite is set. Url from config is used.
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
<div
|
||||||
|
class="_separator_13qwf_8"
|
||||||
|
data-kind="primary"
|
||||||
|
data-orientation="horizontal"
|
||||||
|
role="separator"
|
||||||
|
/>
|
||||||
<h3
|
<h3
|
||||||
class="_typography_6v6n8_153 _font-body-lg-semibold_6v6n8_74"
|
class="_typography_6v6n8_153 _font-body-lg-semibold_6v6n8_74"
|
||||||
>
|
>
|
||||||
@@ -273,50 +285,10 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
|
|||||||
class="_container_1ug7n_10"
|
class="_container_1ug7n_10"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
aria-describedby="radix-_r_a_ radix-_r_c_ radix-_r_e_"
|
aria-describedby="radix-_r_a_ radix-_r_c_"
|
||||||
class="_input_1ug7n_18"
|
|
||||||
id="radix-_r_9_"
|
|
||||||
name="_r_0_"
|
|
||||||
title=""
|
|
||||||
type="radio"
|
|
||||||
value="legacy"
|
|
||||||
/>
|
|
||||||
<div
|
|
||||||
class="_ui_1ug7n_19"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="_inline-field-body_1o4d9_39"
|
|
||||||
>
|
|
||||||
<label
|
|
||||||
class="_label_1o4d9_60"
|
|
||||||
for="radix-_r_9_"
|
|
||||||
>
|
|
||||||
Legacy: state events & oldest membership SFU
|
|
||||||
</label>
|
|
||||||
<span
|
|
||||||
class="_message_1o4d9_86 _help-message_1o4d9_92"
|
|
||||||
id="radix-_r_a_"
|
|
||||||
>
|
|
||||||
Compatible with old versions of EC that do not support multi SFU
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="_inline-field_1o4d9_33"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="_inline-field-control_1o4d9_45"
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
class="_container_1ug7n_10"
|
|
||||||
>
|
|
||||||
<input
|
|
||||||
aria-describedby="radix-_r_a_ radix-_r_c_ radix-_r_e_"
|
|
||||||
checked=""
|
checked=""
|
||||||
class="_input_1ug7n_18"
|
class="_input_1ug7n_18"
|
||||||
id="radix-_r_b_"
|
id="radix-_r_9_"
|
||||||
name="_r_0_"
|
name="_r_0_"
|
||||||
title=""
|
title=""
|
||||||
type="radio"
|
type="radio"
|
||||||
@@ -332,13 +304,13 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
|
|||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="_label_1o4d9_60"
|
class="_label_1o4d9_60"
|
||||||
for="radix-_r_b_"
|
for="radix-_r_9_"
|
||||||
>
|
>
|
||||||
Compatibility: state events & multi SFU
|
Compatibility: state events & multi SFU
|
||||||
</label>
|
</label>
|
||||||
<span
|
<span
|
||||||
class="_message_1o4d9_86 _help-message_1o4d9_92"
|
class="_message_1o4d9_86 _help-message_1o4d9_92"
|
||||||
id="radix-_r_c_"
|
id="radix-_r_a_"
|
||||||
>
|
>
|
||||||
Compatible with homeservers that do not support sticky events (but all other EC clients are v0.17.0 or later)
|
Compatible with homeservers that do not support sticky events (but all other EC clients are v0.17.0 or later)
|
||||||
</span>
|
</span>
|
||||||
@@ -354,9 +326,9 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
|
|||||||
class="_container_1ug7n_10"
|
class="_container_1ug7n_10"
|
||||||
>
|
>
|
||||||
<input
|
<input
|
||||||
aria-describedby="radix-_r_a_ radix-_r_c_ radix-_r_e_"
|
aria-describedby="radix-_r_a_ radix-_r_c_"
|
||||||
class="_input_1ug7n_18"
|
class="_input_1ug7n_18"
|
||||||
id="radix-_r_d_"
|
id="radix-_r_b_"
|
||||||
name="_r_0_"
|
name="_r_0_"
|
||||||
title=""
|
title=""
|
||||||
type="radio"
|
type="radio"
|
||||||
@@ -372,13 +344,13 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
|
|||||||
>
|
>
|
||||||
<label
|
<label
|
||||||
class="_label_1o4d9_60"
|
class="_label_1o4d9_60"
|
||||||
for="radix-_r_d_"
|
for="radix-_r_b_"
|
||||||
>
|
>
|
||||||
Matrix 2.0: sticky events & multi SFU
|
Matrix 2.0: sticky events & multi SFU
|
||||||
</label>
|
</label>
|
||||||
<span
|
<span
|
||||||
class="_message_1o4d9_86 _help-message_1o4d9_92"
|
class="_message_1o4d9_86 _help-message_1o4d9_92"
|
||||||
id="radix-_r_e_"
|
id="radix-_r_c_"
|
||||||
>
|
>
|
||||||
Compatible only with homservers supporting sticky events and all EC clients v0.17.0 or later
|
Compatible only with homservers supporting sticky events and all EC clients v0.17.0 or later
|
||||||
</span>
|
</span>
|
||||||
@@ -463,6 +435,242 @@ exports[`DeveloperSettingsTab > renders and matches snapshot 1`] = `
|
|||||||
</p>
|
</p>
|
||||||
<ul />
|
<ul />
|
||||||
</div>
|
</div>
|
||||||
|
<div
|
||||||
|
class="_separator_13qwf_8"
|
||||||
|
data-kind="primary"
|
||||||
|
data-orientation="horizontal"
|
||||||
|
role="separator"
|
||||||
|
/>
|
||||||
|
<h4>
|
||||||
|
Camera quality
|
||||||
|
</h4>
|
||||||
|
<div
|
||||||
|
class="_fieldRow_1bd8c0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="_field_1bd8c0 _checkboxField_1bd8c0"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
aria-describedby="_r_i_"
|
||||||
|
id="cameraToggle"
|
||||||
|
type="checkbox"
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
for="cameraToggle"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="_checkbox_1bd8c0"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
fill="none"
|
||||||
|
height="24"
|
||||||
|
stroke="#000"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
stroke-width="2"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
width="24"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="m20 6-11 11-5-5"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
Advanced camera settings
|
||||||
|
</label>
|
||||||
|
<p
|
||||||
|
class="_description_1bd8c0"
|
||||||
|
id="_r_i_"
|
||||||
|
>
|
||||||
|
Configure resolution, framerate, bitrate, and codec for camera video. Changes apply on next call join.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="_separator_13qwf_8"
|
||||||
|
data-kind="primary"
|
||||||
|
data-orientation="horizontal"
|
||||||
|
role="separator"
|
||||||
|
/>
|
||||||
|
<h4>
|
||||||
|
Screen sharing
|
||||||
|
</h4>
|
||||||
|
<div
|
||||||
|
class="_fieldRow_1bd8c0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="_field_1bd8c0 _checkboxField_1bd8c0"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
aria-describedby="_r_j_"
|
||||||
|
id="screenShareToggle"
|
||||||
|
type="checkbox"
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
for="screenShareToggle"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="_checkbox_1bd8c0"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
fill="none"
|
||||||
|
height="24"
|
||||||
|
stroke="#000"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
stroke-width="2"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
width="24"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="m20 6-11 11-5-5"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
Advanced screen share settings
|
||||||
|
</label>
|
||||||
|
<p
|
||||||
|
class="_description_1bd8c0"
|
||||||
|
id="_r_j_"
|
||||||
|
>
|
||||||
|
Configure resolution, framerate, bitrate, and codec for screen sharing
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="_separator_13qwf_8"
|
||||||
|
data-kind="primary"
|
||||||
|
data-orientation="horizontal"
|
||||||
|
role="separator"
|
||||||
|
/>
|
||||||
|
<h4>
|
||||||
|
Audio processing
|
||||||
|
</h4>
|
||||||
|
<p>
|
||||||
|
Changes apply on next call join.
|
||||||
|
</p>
|
||||||
|
<div
|
||||||
|
class="_fieldRow_1bd8c0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="_field_1bd8c0 _checkboxField_1bd8c0"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
aria-describedby="_r_k_"
|
||||||
|
checked=""
|
||||||
|
id="echoCancellation"
|
||||||
|
type="checkbox"
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
for="echoCancellation"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="_checkbox_1bd8c0"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
fill="none"
|
||||||
|
height="24"
|
||||||
|
stroke="#000"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
stroke-width="2"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
width="24"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="m20 6-11 11-5-5"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
Echo cancellation
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="_fieldRow_1bd8c0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="_field_1bd8c0 _checkboxField_1bd8c0"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
aria-describedby="_r_l_"
|
||||||
|
checked=""
|
||||||
|
id="noiseSuppression"
|
||||||
|
type="checkbox"
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
for="noiseSuppression"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="_checkbox_1bd8c0"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
fill="none"
|
||||||
|
height="24"
|
||||||
|
stroke="#000"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
stroke-width="2"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
width="24"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="m20 6-11 11-5-5"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
Noise suppression
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="_fieldRow_1bd8c0"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="_field_1bd8c0 _checkboxField_1bd8c0"
|
||||||
|
>
|
||||||
|
<input
|
||||||
|
aria-describedby="_r_m_"
|
||||||
|
checked=""
|
||||||
|
id="autoGainControl"
|
||||||
|
type="checkbox"
|
||||||
|
/>
|
||||||
|
<label
|
||||||
|
for="autoGainControl"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="_checkbox_1bd8c0"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
fill="none"
|
||||||
|
height="24"
|
||||||
|
stroke="#000"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-linejoin="round"
|
||||||
|
stroke-width="2"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
width="24"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
d="m20 6-11 11-5-5"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
Automatic gain control
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
class="_separator_13qwf_8"
|
||||||
|
data-kind="primary"
|
||||||
|
data-orientation="horizontal"
|
||||||
|
role="separator"
|
||||||
|
/>
|
||||||
<p>
|
<p>
|
||||||
Environment variables
|
Environment variables
|
||||||
</p>
|
</p>
|
||||||
|
|||||||
@@ -0,0 +1,111 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2026 Element Creations Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { describe, expect, it, beforeEach } from "vitest";
|
||||||
|
|
||||||
|
import {
|
||||||
|
Setting,
|
||||||
|
parseResolution,
|
||||||
|
seedSettingsFromConfig,
|
||||||
|
screenShareCodec,
|
||||||
|
screenShareResolution,
|
||||||
|
screenShareFramerate,
|
||||||
|
screenShareBitrate,
|
||||||
|
cameraCodec,
|
||||||
|
cameraResolution,
|
||||||
|
cameraFramerate,
|
||||||
|
cameraBitrate,
|
||||||
|
} from "./settings";
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
localStorage.clear();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("parseResolution", () => {
|
||||||
|
it("parses a WIDTHxHEIGHT string", () => {
|
||||||
|
expect(parseResolution("1920x1080")).toEqual({
|
||||||
|
width: 1920,
|
||||||
|
height: 1080,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it("parses non-standard resolutions", () => {
|
||||||
|
expect(parseResolution("640x360")).toEqual({ width: 640, height: 360 });
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("Setting", () => {
|
||||||
|
describe("seedFromConfig", () => {
|
||||||
|
it("updates value when no localStorage value exists", () => {
|
||||||
|
const setting = new Setting<string>("test-seed", "default");
|
||||||
|
setting.seedFromConfig("from-config");
|
||||||
|
expect(setting.getValue()).toBe("from-config");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("does not override an existing localStorage value", () => {
|
||||||
|
localStorage.setItem(
|
||||||
|
"matrix-setting-test-seed-existing",
|
||||||
|
JSON.stringify("user-set"),
|
||||||
|
);
|
||||||
|
const setting = new Setting<string>("test-seed-existing", "default");
|
||||||
|
expect(setting.getValue()).toBe("user-set");
|
||||||
|
setting.seedFromConfig("from-config");
|
||||||
|
expect(setting.getValue()).toBe("user-set");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("seedSettingsFromConfig", () => {
|
||||||
|
it("does nothing when config is undefined", () => {
|
||||||
|
const codecBefore = screenShareCodec.getValue();
|
||||||
|
seedSettingsFromConfig(undefined);
|
||||||
|
expect(screenShareCodec.getValue()).toBe(codecBefore);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("seeds video codec to both camera and screen share", () => {
|
||||||
|
seedSettingsFromConfig({ video_codec: "av1" });
|
||||||
|
expect(screenShareCodec.getValue()).toBe("av1");
|
||||||
|
expect(cameraCodec.getValue()).toBe("av1");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("seeds screen share settings from config", () => {
|
||||||
|
seedSettingsFromConfig({
|
||||||
|
screen_share: {
|
||||||
|
max_resolution: 720,
|
||||||
|
max_framerate: 15,
|
||||||
|
max_bitrate: 2_000_000,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(screenShareResolution.getValue()).toBe("1280x720");
|
||||||
|
expect(screenShareFramerate.getValue()).toBe(15);
|
||||||
|
expect(screenShareBitrate.getValue()).toBe(2_000_000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("seeds camera/video settings from config", () => {
|
||||||
|
seedSettingsFromConfig({
|
||||||
|
video: {
|
||||||
|
max_resolution: 1080,
|
||||||
|
max_framerate: 60,
|
||||||
|
max_bitrate: 4_000_000,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(cameraResolution.getValue()).toBe("1920x1080");
|
||||||
|
expect(cameraFramerate.getValue()).toBe(60);
|
||||||
|
expect(cameraBitrate.getValue()).toBe(4_000_000);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("only seeds provided fields, leaves others at defaults", () => {
|
||||||
|
const defaultFramerate = screenShareFramerate.getValue();
|
||||||
|
seedSettingsFromConfig({
|
||||||
|
screen_share: {
|
||||||
|
max_bitrate: 3_000_000,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(screenShareBitrate.getValue()).toBe(3_000_000);
|
||||||
|
expect(screenShareFramerate.getValue()).toBe(defaultFramerate);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -21,6 +21,7 @@ export class Setting<T> {
|
|||||||
this.key = `matrix-setting-${key}`;
|
this.key = `matrix-setting-${key}`;
|
||||||
|
|
||||||
const storedValue = localStorage.getItem(this.key);
|
const storedValue = localStorage.getItem(this.key);
|
||||||
|
this.hasStoredValue = storedValue !== null;
|
||||||
let initialValue = defaultValue;
|
let initialValue = defaultValue;
|
||||||
if (storedValue !== null) {
|
if (storedValue !== null) {
|
||||||
try {
|
try {
|
||||||
@@ -40,6 +41,7 @@ export class Setting<T> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private readonly key: string;
|
private readonly key: string;
|
||||||
|
private readonly hasStoredValue: boolean;
|
||||||
|
|
||||||
private readonly _value$: BehaviorSubject<T>;
|
private readonly _value$: BehaviorSubject<T>;
|
||||||
private readonly _lastUpdateReason$: BehaviorSubject<string | null>;
|
private readonly _lastUpdateReason$: BehaviorSubject<string | null>;
|
||||||
@@ -54,6 +56,17 @@ export class Setting<T> {
|
|||||||
public readonly getValue = (): T => {
|
public readonly getValue = (): T => {
|
||||||
return this._value$.getValue();
|
return this._value$.getValue();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the setting's value from a config source, but only if the user
|
||||||
|
* hasn't explicitly set a value in localStorage. This lets admins set
|
||||||
|
* org-wide defaults in config.json that users can override.
|
||||||
|
*/
|
||||||
|
public seedFromConfig(value: T): void {
|
||||||
|
if (!this.hasStoredValue) {
|
||||||
|
this._value$.next(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -144,3 +157,130 @@ export const customLivekitUrl = new Setting<string | null>(
|
|||||||
"custom-livekit-url",
|
"custom-livekit-url",
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
export type VideoCodec = "vp8" | "vp9" | "h264" | "av1";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse a "WIDTHxHEIGHT" resolution string into numeric width and height.
|
||||||
|
*/
|
||||||
|
export function parseResolution(res: string): {
|
||||||
|
width: number;
|
||||||
|
height: number;
|
||||||
|
} {
|
||||||
|
const [w, h] = res.split("x").map(Number);
|
||||||
|
return { width: w, height: h };
|
||||||
|
}
|
||||||
|
|
||||||
|
export const advancedScreenShare = new Setting<boolean>(
|
||||||
|
"advanced-screen-share",
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
|
||||||
|
export const screenShareResolution = new Setting<string>(
|
||||||
|
"screen-share-resolution",
|
||||||
|
"1920x1080",
|
||||||
|
);
|
||||||
|
|
||||||
|
export const screenShareFramerate = new Setting<number>(
|
||||||
|
"screen-share-framerate",
|
||||||
|
30,
|
||||||
|
);
|
||||||
|
|
||||||
|
export const screenShareBitrate = new Setting<number>(
|
||||||
|
"screen-share-bitrate",
|
||||||
|
5_000_000,
|
||||||
|
);
|
||||||
|
|
||||||
|
export const screenShareCodec = new Setting<VideoCodec>(
|
||||||
|
"screen-share-codec",
|
||||||
|
"vp9",
|
||||||
|
);
|
||||||
|
|
||||||
|
// Camera video quality settings
|
||||||
|
export const advancedCamera = new Setting<boolean>("advanced-camera", false);
|
||||||
|
|
||||||
|
export const cameraResolution = new Setting<string>(
|
||||||
|
"camera-resolution",
|
||||||
|
"1280x720",
|
||||||
|
);
|
||||||
|
|
||||||
|
export const cameraFramerate = new Setting<number>("camera-framerate", 30);
|
||||||
|
|
||||||
|
export const cameraBitrate = new Setting<number>("camera-bitrate", 1_700_000);
|
||||||
|
|
||||||
|
export const cameraCodec = new Setting<VideoCodec>("camera-codec", "vp8");
|
||||||
|
|
||||||
|
// Audio processing settings
|
||||||
|
export const echoCancellationSetting = new Setting<boolean>(
|
||||||
|
"echo-cancellation",
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
|
||||||
|
export const noiseSuppressionSetting = new Setting<boolean>(
|
||||||
|
"noise-suppression",
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
|
||||||
|
export const autoGainControlSetting = new Setting<boolean>(
|
||||||
|
"auto-gain-control",
|
||||||
|
true,
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Seed setting defaults from config.json's media_quality section.
|
||||||
|
* Call this after Config.init() has resolved.
|
||||||
|
* Only updates settings that the user hasn't explicitly set in localStorage.
|
||||||
|
*/
|
||||||
|
export function seedSettingsFromConfig(
|
||||||
|
mediaQuality:
|
||||||
|
| {
|
||||||
|
video_codec?: VideoCodec;
|
||||||
|
video?: {
|
||||||
|
max_resolution?: number;
|
||||||
|
max_bitrate?: number;
|
||||||
|
max_framerate?: number;
|
||||||
|
};
|
||||||
|
screen_share?: {
|
||||||
|
max_resolution?: number;
|
||||||
|
max_bitrate?: number;
|
||||||
|
max_framerate?: number;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
| undefined,
|
||||||
|
): void {
|
||||||
|
if (!mediaQuality) return;
|
||||||
|
|
||||||
|
const codec = mediaQuality.video_codec;
|
||||||
|
if (codec) {
|
||||||
|
screenShareCodec.seedFromConfig(codec);
|
||||||
|
cameraCodec.seedFromConfig(codec);
|
||||||
|
}
|
||||||
|
|
||||||
|
const screen = mediaQuality.screen_share;
|
||||||
|
if (screen) {
|
||||||
|
if (screen.max_resolution) {
|
||||||
|
const width = Math.round((screen.max_resolution * 16) / 9);
|
||||||
|
screenShareResolution.seedFromConfig(`${width}x${screen.max_resolution}`);
|
||||||
|
}
|
||||||
|
if (screen.max_framerate) {
|
||||||
|
screenShareFramerate.seedFromConfig(screen.max_framerate);
|
||||||
|
}
|
||||||
|
if (screen.max_bitrate) {
|
||||||
|
screenShareBitrate.seedFromConfig(screen.max_bitrate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const video = mediaQuality.video;
|
||||||
|
if (video) {
|
||||||
|
if (video.max_resolution) {
|
||||||
|
const width = Math.round((video.max_resolution * 16) / 9);
|
||||||
|
cameraResolution.seedFromConfig(`${width}x${video.max_resolution}`);
|
||||||
|
}
|
||||||
|
if (video.max_framerate) {
|
||||||
|
cameraFramerate.seedFromConfig(video.max_framerate);
|
||||||
|
}
|
||||||
|
if (video.max_bitrate) {
|
||||||
|
cameraBitrate.seedFromConfig(video.max_bitrate);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,7 +19,10 @@ import { useClient } from "../ClientContext";
|
|||||||
import { Config } from "../config/Config";
|
import { Config } from "../config/Config";
|
||||||
import { type RageshakeRequestModal } from "../room/RageshakeRequestModal";
|
import { type RageshakeRequestModal } from "../room/RageshakeRequestModal";
|
||||||
import { getUrlParams } from "../UrlParams";
|
import { getUrlParams } from "../UrlParams";
|
||||||
|
import { deepCompare } from "matrix-js-sdk/lib/utils";
|
||||||
|
import { advancedCamera as advancedCameraSetting } from "./settings";
|
||||||
|
import { advancedScreenShare as advancedScreenShareSetting } from "./settings";
|
||||||
|
import { DEFAULT_CONFIG } from "../config/ConfigOptions";
|
||||||
const gzip = async (text: string): Promise<Blob> => {
|
const gzip = async (text: string): Promise<Blob> => {
|
||||||
// pako is relatively large (200KB), so we only import it when needed
|
// pako is relatively large (200KB), so we only import it when needed
|
||||||
const { gzip: pakoGzip } = await import("pako");
|
const { gzip: pakoGzip } = await import("pako");
|
||||||
@@ -245,6 +248,20 @@ export function useSubmitRageshake(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add custom media related information to the rageshake issue description.
|
||||||
|
// Used to quickly identify issues due to untested configurations.
|
||||||
|
if (
|
||||||
|
!deepCompare(Config.get().media_quality, DEFAULT_CONFIG.media_quality)
|
||||||
|
) {
|
||||||
|
body.append("custom_media_quality_in_config", "true");
|
||||||
|
}
|
||||||
|
if (advancedCameraSetting.getValue()) {
|
||||||
|
body.append("devTools_advancedCameraSettings", "true");
|
||||||
|
}
|
||||||
|
if (advancedScreenShareSetting.getValue()) {
|
||||||
|
body.append("devTools_advancedScreenShareSetting", "true");
|
||||||
|
}
|
||||||
|
|
||||||
if (navigator.storage && navigator.storage.estimate) {
|
if (navigator.storage && navigator.storage.estimate) {
|
||||||
try {
|
try {
|
||||||
const estimate: {
|
const estimate: {
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ import { useSubmitRageshake, getRageshakeSubmitUrl } from "./submit-rageshake";
|
|||||||
import { ClientContextProvider } from "../ClientContext";
|
import { ClientContextProvider } from "../ClientContext";
|
||||||
import { getUrlParams } from "../UrlParams";
|
import { getUrlParams } from "../UrlParams";
|
||||||
import { mockConfig } from "../utils/test";
|
import { mockConfig } from "../utils/test";
|
||||||
|
import { DEFAULT_CONFIG } from "../config/ConfigOptions";
|
||||||
|
import { advancedCamera, advancedScreenShare } from "./settings";
|
||||||
|
|
||||||
vi.mock("../UrlParams", () => ({ getUrlParams: vi.fn() }));
|
vi.mock("../UrlParams", () => ({ getUrlParams: vi.fn() }));
|
||||||
|
|
||||||
@@ -201,6 +203,60 @@ describe("useSubmitRageshake", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("media quality metadata", () => {
|
||||||
|
const submitAndGetBody = async (): Promise<FormData> => {
|
||||||
|
const fetchFn = vi.fn().mockResolvedValue({
|
||||||
|
status: 200,
|
||||||
|
});
|
||||||
|
vi.stubGlobal("fetch", fetchFn);
|
||||||
|
|
||||||
|
renderWithMockClient(() => "https://rageshake.localhost/foo", false);
|
||||||
|
screen.getByTestId("submit").click();
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByTestId("sent").textContent).toBe("true");
|
||||||
|
});
|
||||||
|
return fetchFn.mock.calls[0][1].body as FormData;
|
||||||
|
};
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
vi.unstubAllGlobals();
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
advancedCamera.setValue(advancedCamera.defaultValue);
|
||||||
|
advancedScreenShare.setValue(advancedScreenShare.defaultValue);
|
||||||
|
vi.clearAllMocks();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("omits media quality fields when config and settings are default", async () => {
|
||||||
|
mockConfig({});
|
||||||
|
const body = await submitAndGetBody();
|
||||||
|
expect(body.get("custom_media_quality_in_config")).toBeNull();
|
||||||
|
expect(body.get("devTools_advancedCameraSettings")).toBeNull();
|
||||||
|
expect(body.get("devTools_advancedScreenShareSetting")).toBeNull();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("includes custom_media_quality_in_config when media_quality differs from default", async () => {
|
||||||
|
mockConfig({
|
||||||
|
media_quality: {
|
||||||
|
...DEFAULT_CONFIG.media_quality,
|
||||||
|
video_codec: "h264",
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const body = await submitAndGetBody();
|
||||||
|
expect(body.get("custom_media_quality_in_config")).toBe("true");
|
||||||
|
});
|
||||||
|
|
||||||
|
it("includes devTools flags when advanced media settings are enabled", async () => {
|
||||||
|
mockConfig({});
|
||||||
|
advancedCamera.setValue(true);
|
||||||
|
advancedScreenShare.setValue(true);
|
||||||
|
const body = await submitAndGetBody();
|
||||||
|
expect(body.get("devTools_advancedCameraSettings")).toBe("true");
|
||||||
|
expect(body.get("devTools_advancedScreenShareSetting")).toBe("true");
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
describe("when rageshake is not available", () => {
|
describe("when rageshake is not available", () => {
|
||||||
it("starts unsent", () => {
|
it("starts unsent", () => {
|
||||||
renderWithMockClient(() => undefined, false);
|
renderWithMockClient(() => undefined, false);
|
||||||
|
|||||||
@@ -144,13 +144,13 @@ export interface SpotlightExpandedLayoutSummary {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export interface OneOnOneLandscapeLayoutSummary {
|
export interface OneOnOneLandscapeLayoutSummary {
|
||||||
type: "one-on-one-landscape";
|
type: "one-on-one-desktop";
|
||||||
spotlight: string;
|
spotlight: string;
|
||||||
pip: string;
|
pip: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface OneOnOnePortraitLayoutSummary {
|
export interface OneOnOnePortraitLayoutSummary {
|
||||||
type: "one-on-one-portrait";
|
type: "one-on-one-mobile";
|
||||||
spotlight: string[];
|
spotlight: string[];
|
||||||
pip?: string;
|
pip?: string;
|
||||||
pipSize: "sm" | "lg";
|
pipSize: "sm" | "lg";
|
||||||
@@ -205,7 +205,7 @@ function summarizeLayout$(l$: Observable<Layout>): Observable<LayoutSummary> {
|
|||||||
pip: pip?.id,
|
pip: pip?.id,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
case "one-on-one-landscape":
|
case "one-on-one-desktop":
|
||||||
return combineLatest(
|
return combineLatest(
|
||||||
[l.spotlight.media$, l.pip.media$],
|
[l.spotlight.media$, l.pip.media$],
|
||||||
(spotlight, pip) => ({
|
(spotlight, pip) => ({
|
||||||
@@ -214,7 +214,7 @@ function summarizeLayout$(l$: Observable<Layout>): Observable<LayoutSummary> {
|
|||||||
pip: pip.id,
|
pip: pip.id,
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
case "one-on-one-portrait":
|
case "one-on-one-mobile":
|
||||||
return combineLatest(
|
return combineLatest(
|
||||||
[
|
[
|
||||||
l.spotlight.media$,
|
l.spotlight.media$,
|
||||||
@@ -258,11 +258,9 @@ function mockRingEvent(
|
|||||||
} as unknown as { event_id: string } & IRTCNotificationContent;
|
} as unknown as { event_id: string } & IRTCNotificationContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
describe.each([
|
const modes = [[MatrixRTCMode.Compatibility], [MatrixRTCMode.Matrix_2_0]];
|
||||||
[MatrixRTCMode.Legacy],
|
|
||||||
[MatrixRTCMode.Compatibility],
|
describe.each(modes)("CallViewModel (%s mode)", (mode) => {
|
||||||
[MatrixRTCMode.Matrix_2_0],
|
|
||||||
])("CallViewModel (%s mode)", (mode) => {
|
|
||||||
const withCallViewModel = withCallViewModelInMode(mode);
|
const withCallViewModel = withCallViewModelInMode(mode);
|
||||||
|
|
||||||
test("participants are retained during a focus switch", () => {
|
test("participants are retained during a focus switch", () => {
|
||||||
@@ -327,8 +325,8 @@ describe.each([
|
|||||||
},
|
},
|
||||||
(vm) => {
|
(vm) => {
|
||||||
schedule(modeInputMarbles, {
|
schedule(modeInputMarbles, {
|
||||||
s: () => vm.setGridMode("spotlight"),
|
s: () => vm.layoutSwitchVm$.value!.setLayout("spotlight"),
|
||||||
g: () => vm.setGridMode("grid"),
|
g: () => vm.layoutSwitchVm$.value!.setLayout("grid"),
|
||||||
});
|
});
|
||||||
|
|
||||||
expectObservable(summarizeLayout$(vm.layout$)).toBe(
|
expectObservable(summarizeLayout$(vm.layout$)).toBe(
|
||||||
@@ -437,7 +435,7 @@ describe.each([
|
|||||||
expectedLayoutMarbles,
|
expectedLayoutMarbles,
|
||||||
{
|
{
|
||||||
a: {
|
a: {
|
||||||
type: "one-on-one-landscape",
|
type: "one-on-one-desktop",
|
||||||
pip: `${localId}:0`,
|
pip: `${localId}:0`,
|
||||||
spotlight: `${aliceId}:0`,
|
spotlight: `${aliceId}:0`,
|
||||||
},
|
},
|
||||||
@@ -453,7 +451,7 @@ describe.each([
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("one-on-one portrait layout shows local tile when video is enabled", () => {
|
test("one-on-one mobile layout shows local tile when video is enabled", () => {
|
||||||
withTestScheduler(({ behavior, schedule, expectObservable }) => {
|
withTestScheduler(({ behavior, schedule, expectObservable }) => {
|
||||||
// Local participant enables their video, then disables it
|
// Local participant enables their video, then disables it
|
||||||
const videoInputMarbles = " ny--n";
|
const videoInputMarbles = " ny--n";
|
||||||
@@ -480,19 +478,19 @@ describe.each([
|
|||||||
expectedLayoutMarbles,
|
expectedLayoutMarbles,
|
||||||
{
|
{
|
||||||
a: {
|
a: {
|
||||||
type: "one-on-one-portrait",
|
type: "one-on-one-mobile",
|
||||||
spotlight: [`${aliceId}:0`],
|
spotlight: [`${aliceId}:0`],
|
||||||
pip: undefined,
|
pip: undefined,
|
||||||
pipSize: "lg",
|
pipSize: "lg",
|
||||||
},
|
},
|
||||||
b: {
|
b: {
|
||||||
type: "one-on-one-portrait",
|
type: "one-on-one-mobile",
|
||||||
spotlight: [`${aliceId}:0`],
|
spotlight: [`${aliceId}:0`],
|
||||||
pip: `${localId}:0`,
|
pip: `${localId}:0`,
|
||||||
pipSize: "lg",
|
pipSize: "lg",
|
||||||
},
|
},
|
||||||
c: {
|
c: {
|
||||||
type: "one-on-one-portrait",
|
type: "one-on-one-mobile",
|
||||||
spotlight: [`${aliceId}:0`],
|
spotlight: [`${aliceId}:0`],
|
||||||
pip: `${localId}:0`,
|
pip: `${localId}:0`,
|
||||||
pipSize: "sm",
|
pipSize: "sm",
|
||||||
@@ -504,21 +502,21 @@ describe.each([
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("one-on-one portrait layout shows name tags in room with 3 members", () => {
|
test("one-on-one mobile layout shows name tags in room with 3 members", () => {
|
||||||
withTestScheduler(({ behavior, schedule, expectObservable }) => {
|
withTestScheduler(({ expectObservable }) => {
|
||||||
withCallViewModel(
|
withCallViewModel(
|
||||||
{
|
{
|
||||||
remoteParticipants$: constant([aliceParticipant]),
|
remoteParticipants$: constant([aliceParticipant]),
|
||||||
// Both Alice and Bob are with us in the room
|
// Both Alice and Bob are with us in the room
|
||||||
roomMembers: [local, alice, bob],
|
roomMembers: [local, alice, bob],
|
||||||
rtcMembers$: constant([localRtcMember, aliceRtcMember]),
|
rtcMembers$: constant([localRtcMember, aliceRtcMember]),
|
||||||
windowSize$: constant({ width: 380, height: 700 }), // Mobile phone in portrait
|
windowSize$: constant({ width: 380, height: 700 }), // Mobile phone
|
||||||
},
|
},
|
||||||
(vm) => {
|
(vm) => {
|
||||||
// Uses one-on-one portrait layout
|
// Uses one-on-one mobile layout
|
||||||
expectObservable(summarizeLayout$(vm.layout$)).toBe("a", {
|
expectObservable(summarizeLayout$(vm.layout$)).toBe("a", {
|
||||||
a: {
|
a: {
|
||||||
type: "one-on-one-portrait",
|
type: "one-on-one-mobile",
|
||||||
spotlight: [`${aliceId}:0`],
|
spotlight: [`${aliceId}:0`],
|
||||||
pip: undefined,
|
pip: undefined,
|
||||||
pipSize: "lg",
|
pipSize: "lg",
|
||||||
@@ -532,6 +530,65 @@ describe.each([
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("landscape mobile layouts show screen shares and group call participants", () => {
|
||||||
|
withTestScheduler(({ behavior, expectObservable }) => {
|
||||||
|
// Starts as a one-on-one call, then Alice shares her screen, then Bob
|
||||||
|
// joins, and finally Alice stops sharing her screen
|
||||||
|
const participantInputMarbles = " a--b";
|
||||||
|
const aliceSharingInputMarbles = " ny-n";
|
||||||
|
// Starts in one-on-one mobile layout, then goes to spotlight layout for
|
||||||
|
// the screen sharing and group call cases
|
||||||
|
const expectedLayoutMarbles = " ab-c";
|
||||||
|
// Whether the layout switch is visible. It should be hidden while in
|
||||||
|
// one-on-one layout.
|
||||||
|
const expectedLayoutSwitchMarbles = "ny--";
|
||||||
|
|
||||||
|
withCallViewModel(
|
||||||
|
{
|
||||||
|
remoteParticipants$: behavior(participantInputMarbles, {
|
||||||
|
a: [aliceParticipant],
|
||||||
|
b: [aliceParticipant, bobParticipant],
|
||||||
|
}),
|
||||||
|
roomMembers: [local, alice, bob],
|
||||||
|
rtcMembers$: behavior(participantInputMarbles, {
|
||||||
|
a: [localRtcMember, aliceRtcMember],
|
||||||
|
b: [localRtcMember, aliceRtcMember, bobRtcMember],
|
||||||
|
}),
|
||||||
|
sharingScreen: new Map([
|
||||||
|
[aliceParticipant, behavior(aliceSharingInputMarbles, yesNo)],
|
||||||
|
]),
|
||||||
|
windowSize$: constant({ width: 700, height: 380 }), // Mobile phone in landscape
|
||||||
|
},
|
||||||
|
(vm) => {
|
||||||
|
expectObservable(summarizeLayout$(vm.layout$)).toBe(
|
||||||
|
expectedLayoutMarbles,
|
||||||
|
{
|
||||||
|
a: {
|
||||||
|
type: "one-on-one-mobile",
|
||||||
|
spotlight: [`${aliceId}:0`],
|
||||||
|
pip: undefined,
|
||||||
|
pipSize: "sm",
|
||||||
|
},
|
||||||
|
b: {
|
||||||
|
type: "spotlight-landscape",
|
||||||
|
spotlight: [`${aliceId}:0:screen-share`],
|
||||||
|
grid: [`${localId}:0`, `${aliceId}:0`],
|
||||||
|
},
|
||||||
|
c: {
|
||||||
|
type: "spotlight-landscape",
|
||||||
|
spotlight: [`${aliceId}:0`],
|
||||||
|
grid: [`${localId}:0`, `${bobId}:0`],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
expectObservable(
|
||||||
|
vm.layoutSwitchVm$.pipe(map((vm) => vm !== null)),
|
||||||
|
).toBe(expectedLayoutSwitchMarbles, yesNo);
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
test("participants stay in the same order unless to appear/disappear", () => {
|
test("participants stay in the same order unless to appear/disappear", () => {
|
||||||
withTestScheduler(({ behavior, schedule, expectObservable }) => {
|
withTestScheduler(({ behavior, schedule, expectObservable }) => {
|
||||||
const visibilityInputMarbles = "a";
|
const visibilityInputMarbles = "a";
|
||||||
@@ -706,14 +763,14 @@ describe.each([
|
|||||||
{
|
{
|
||||||
a: {
|
a: {
|
||||||
// This is the expected one-on-one layout for a narrow window
|
// This is the expected one-on-one layout for a narrow window
|
||||||
type: "one-on-one-portrait",
|
type: "one-on-one-mobile",
|
||||||
spotlight: [`${aliceId}:0`],
|
spotlight: [`${aliceId}:0`],
|
||||||
pip: undefined,
|
pip: undefined,
|
||||||
pipSize: "lg",
|
pipSize: "lg",
|
||||||
},
|
},
|
||||||
b: {
|
b: {
|
||||||
// In a larger window, expect the normal one-on-one layout
|
// In a larger window, expect the one-on-one desktop layout
|
||||||
type: "one-on-one-landscape",
|
type: "one-on-one-desktop",
|
||||||
pip: `${localId}:0`,
|
pip: `${localId}:0`,
|
||||||
spotlight: `${aliceId}:0`,
|
spotlight: `${aliceId}:0`,
|
||||||
},
|
},
|
||||||
@@ -763,7 +820,9 @@ describe.each([
|
|||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
(vm) => {
|
(vm) => {
|
||||||
schedule(modeInputMarbles, { s: () => vm.setGridMode("spotlight") });
|
schedule(modeInputMarbles, {
|
||||||
|
s: () => vm.layoutSwitchVm$.value!.setLayout("spotlight"),
|
||||||
|
});
|
||||||
|
|
||||||
expectObservable(summarizeLayout$(vm.layout$)).toBe(
|
expectObservable(summarizeLayout$(vm.layout$)).toBe(
|
||||||
expectedLayoutMarbles,
|
expectedLayoutMarbles,
|
||||||
@@ -969,7 +1028,7 @@ describe.each([
|
|||||||
},
|
},
|
||||||
(vm) => {
|
(vm) => {
|
||||||
schedule(modeInputMarbles, {
|
schedule(modeInputMarbles, {
|
||||||
s: () => vm.setGridMode("spotlight"),
|
s: () => vm.layoutSwitchVm$.value!.setLayout("spotlight"),
|
||||||
});
|
});
|
||||||
schedule(expandInputMarbles, {
|
schedule(expandInputMarbles, {
|
||||||
a: () => vm.toggleSpotlightExpanded$.value!(),
|
a: () => vm.toggleSpotlightExpanded$.value!(),
|
||||||
@@ -1039,7 +1098,7 @@ describe.each([
|
|||||||
},
|
},
|
||||||
(vm) => {
|
(vm) => {
|
||||||
schedule(modeInputMarbles, {
|
schedule(modeInputMarbles, {
|
||||||
s: () => vm.setGridMode("spotlight"),
|
s: () => vm.layoutSwitchVm$.value!.setLayout("spotlight"),
|
||||||
});
|
});
|
||||||
schedule(expandInputMarbles, {
|
schedule(expandInputMarbles, {
|
||||||
a: () => vm.toggleSpotlightExpanded$.value!(),
|
a: () => vm.toggleSpotlightExpanded$.value!(),
|
||||||
@@ -1066,7 +1125,7 @@ describe.each([
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("expanded spotlight layout hides PiP tile in one-on-one voice call", () => {
|
test("expanded spotlight layout hides PiP tile in one-on-one voice call", () => {
|
||||||
withTestScheduler(({ behavior, schedule, expectObservable }) => {
|
withTestScheduler(({ schedule, expectObservable }) => {
|
||||||
withCallViewModel(
|
withCallViewModel(
|
||||||
{
|
{
|
||||||
remoteParticipants$: constant([aliceParticipant]),
|
remoteParticipants$: constant([aliceParticipant]),
|
||||||
@@ -1076,9 +1135,15 @@ describe.each([
|
|||||||
[localParticipant, constant(false)],
|
[localParticipant, constant(false)],
|
||||||
[aliceParticipant, constant(false)],
|
[aliceParticipant, constant(false)],
|
||||||
]),
|
]),
|
||||||
windowSize$: constant({ width: 700, height: 380 }), // Mobile phone in landscape
|
|
||||||
},
|
},
|
||||||
(vm) => {
|
(vm) => {
|
||||||
|
schedule("s", {
|
||||||
|
s: () => vm.layoutSwitchVm$.value!.setLayout("spotlight"),
|
||||||
|
});
|
||||||
|
schedule("a", {
|
||||||
|
a: () => vm.toggleSpotlightExpanded$.value!(),
|
||||||
|
});
|
||||||
|
|
||||||
// Layout should show remote tile only
|
// Layout should show remote tile only
|
||||||
expectObservable(summarizeLayout$(vm.layout$)).toBe("a", {
|
expectObservable(summarizeLayout$(vm.layout$)).toBe("a", {
|
||||||
a: {
|
a: {
|
||||||
@@ -1110,8 +1175,8 @@ describe.each([
|
|||||||
},
|
},
|
||||||
(vm) => {
|
(vm) => {
|
||||||
schedule(modeInputMarbles, {
|
schedule(modeInputMarbles, {
|
||||||
s: () => vm.setGridMode("spotlight"),
|
s: () => vm.layoutSwitchVm$.value!.setLayout("spotlight"),
|
||||||
g: () => vm.setGridMode("grid"),
|
g: () => vm.layoutSwitchVm$.value!.setLayout("grid"),
|
||||||
});
|
});
|
||||||
schedule(expandInputMarbles, {
|
schedule(expandInputMarbles, {
|
||||||
a: () => vm.toggleSpotlightExpanded$.value!(),
|
a: () => vm.toggleSpotlightExpanded$.value!(),
|
||||||
@@ -1177,7 +1242,7 @@ describe.each([
|
|||||||
]),
|
]),
|
||||||
},
|
},
|
||||||
(vm) => {
|
(vm) => {
|
||||||
vm.setGridMode("grid");
|
vm.layoutSwitchVm$.value!.setLayout("grid");
|
||||||
expectObservable(summarizeLayout$(vm.layout$)).toBe(
|
expectObservable(summarizeLayout$(vm.layout$)).toBe(
|
||||||
expectedLayoutMarbles,
|
expectedLayoutMarbles,
|
||||||
{
|
{
|
||||||
@@ -1187,7 +1252,7 @@ describe.each([
|
|||||||
grid: [`${localId}:0`],
|
grid: [`${localId}:0`],
|
||||||
},
|
},
|
||||||
b: {
|
b: {
|
||||||
type: "one-on-one-landscape",
|
type: "one-on-one-desktop",
|
||||||
pip: `${localId}:0`,
|
pip: `${localId}:0`,
|
||||||
spotlight: `${aliceId}:0`,
|
spotlight: `${aliceId}:0`,
|
||||||
},
|
},
|
||||||
@@ -1220,7 +1285,7 @@ describe.each([
|
|||||||
}),
|
}),
|
||||||
},
|
},
|
||||||
(vm) => {
|
(vm) => {
|
||||||
vm.setGridMode("grid");
|
vm.layoutSwitchVm$.value!.setLayout("grid");
|
||||||
expectObservable(summarizeLayout$(vm.layout$)).toBe(
|
expectObservable(summarizeLayout$(vm.layout$)).toBe(
|
||||||
expectedLayoutMarbles,
|
expectedLayoutMarbles,
|
||||||
{
|
{
|
||||||
@@ -1230,7 +1295,7 @@ describe.each([
|
|||||||
grid: [`${localId}:0`],
|
grid: [`${localId}:0`],
|
||||||
},
|
},
|
||||||
b: {
|
b: {
|
||||||
type: "one-on-one-landscape",
|
type: "one-on-one-desktop",
|
||||||
pip: `${localId}:0`,
|
pip: `${localId}:0`,
|
||||||
spotlight: `${aliceId}:0`,
|
spotlight: `${aliceId}:0`,
|
||||||
},
|
},
|
||||||
@@ -1240,7 +1305,7 @@ describe.each([
|
|||||||
grid: [`${localId}:0`, `${aliceId}:0`, `${daveId}:0`],
|
grid: [`${localId}:0`, `${aliceId}:0`, `${daveId}:0`],
|
||||||
},
|
},
|
||||||
d: {
|
d: {
|
||||||
type: "one-on-one-landscape",
|
type: "one-on-one-desktop",
|
||||||
pip: `${localId}:0`,
|
pip: `${localId}:0`,
|
||||||
spotlight: `${daveId}:0`,
|
spotlight: `${daveId}:0`,
|
||||||
},
|
},
|
||||||
@@ -1464,7 +1529,7 @@ describe.each([
|
|||||||
// ringing the entire time (even once timed out)
|
// ringing the entire time (even once timed out)
|
||||||
expectObservable(summarizeLayout$(vm.layout$)).toBe("a", {
|
expectObservable(summarizeLayout$(vm.layout$)).toBe("a", {
|
||||||
a: {
|
a: {
|
||||||
type: "one-on-one-landscape",
|
type: "one-on-one-desktop",
|
||||||
spotlight: `${localId}:0`,
|
spotlight: `${localId}:0`,
|
||||||
pip: `ringing:${aliceUserId}`,
|
pip: `ringing:${aliceUserId}`,
|
||||||
},
|
},
|
||||||
@@ -1510,12 +1575,12 @@ describe.each([
|
|||||||
// ringing the entire time
|
// ringing the entire time
|
||||||
expectObservable(summarizeLayout$(vm.layout$)).toBe("a 20ms b", {
|
expectObservable(summarizeLayout$(vm.layout$)).toBe("a 20ms b", {
|
||||||
a: {
|
a: {
|
||||||
type: "one-on-one-landscape",
|
type: "one-on-one-desktop",
|
||||||
spotlight: `${localId}:0`,
|
spotlight: `${localId}:0`,
|
||||||
pip: `ringing:${aliceUserId}`,
|
pip: `ringing:${aliceUserId}`,
|
||||||
},
|
},
|
||||||
b: {
|
b: {
|
||||||
type: "one-on-one-landscape",
|
type: "one-on-one-desktop",
|
||||||
spotlight: `${aliceId}:0`,
|
spotlight: `${aliceId}:0`,
|
||||||
pip: `${localId}:0`,
|
pip: `${localId}:0`,
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -49,7 +49,6 @@ import {
|
|||||||
import { type IWidgetApiRequest } from "matrix-widget-api";
|
import { type IWidgetApiRequest } from "matrix-widget-api";
|
||||||
import { type CallMembershipIdentityParts } from "matrix-js-sdk/lib/matrixrtc/EncryptionManager";
|
import { type CallMembershipIdentityParts } from "matrix-js-sdk/lib/matrixrtc/EncryptionManager";
|
||||||
import { v4 as uuidv4 } from "uuid";
|
import { v4 as uuidv4 } from "uuid";
|
||||||
import { type IMembershipManager } from "matrix-js-sdk/lib/matrixrtc/IMembershipManager";
|
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createToggle$,
|
createToggle$,
|
||||||
@@ -70,8 +69,8 @@ import { setPipEnabled$ } from "../../controls";
|
|||||||
import { TileStore } from "../TileStore";
|
import { TileStore } from "../TileStore";
|
||||||
import { gridLikeLayout } from "../GridLikeLayout";
|
import { gridLikeLayout } from "../GridLikeLayout";
|
||||||
import { spotlightExpandedLayout } from "../SpotlightExpandedLayout";
|
import { spotlightExpandedLayout } from "../SpotlightExpandedLayout";
|
||||||
import { oneOnOneLandscapeLayout } from "../OneOnOneLandscapeLayout";
|
import { oneOnOneDesktopLayout } from "../OneOnOneDesktopLayout";
|
||||||
import { oneOnOnePortraitLayout } from "../OneOnOnePortraitLayout";
|
import { oneOnOneMobileLayout } from "../OneOnOneMobileLayout";
|
||||||
import { pipLayout } from "../PipLayout";
|
import { pipLayout } from "../PipLayout";
|
||||||
import { type EncryptionSystem } from "../../e2ee/sharedKeyManagement";
|
import { type EncryptionSystem } from "../../e2ee/sharedKeyManagement";
|
||||||
import {
|
import {
|
||||||
@@ -79,7 +78,7 @@ import {
|
|||||||
type ReactionInfo,
|
type ReactionInfo,
|
||||||
type ReactionOption,
|
type ReactionOption,
|
||||||
} from "../../reactions";
|
} from "../../reactions";
|
||||||
import { shallowEquals } from "../../utils/array";
|
import { shallowEquals as shallowArrayEquals } from "../../utils/array";
|
||||||
import { type MediaDevices } from "../MediaDevices";
|
import { type MediaDevices } from "../MediaDevices";
|
||||||
import { constant, type Behavior } from "../Behavior";
|
import { constant, type Behavior } from "../Behavior";
|
||||||
import { E2eeType } from "../../e2ee/e2eeType";
|
import { E2eeType } from "../../e2ee/e2eeType";
|
||||||
@@ -89,12 +88,13 @@ import { getUrlParams, HeaderStyle } from "../../UrlParams";
|
|||||||
import { type ProcessorState } from "../../livekit/TrackProcessorContext";
|
import { type ProcessorState } from "../../livekit/TrackProcessorContext";
|
||||||
import { ElementWidgetActions, widget } from "../../widget";
|
import { ElementWidgetActions, widget } from "../../widget";
|
||||||
import {
|
import {
|
||||||
|
layoutShallowEquals,
|
||||||
type Alignment,
|
type Alignment,
|
||||||
type GridLayoutMedia,
|
type GridLayoutMedia,
|
||||||
type Layout,
|
type Layout,
|
||||||
type LayoutMedia,
|
type LayoutMedia,
|
||||||
type OneOnOneLandscapeLayoutMedia,
|
type OneOnOneDesktopLayoutMedia,
|
||||||
type OneOnOnePortraitLayoutMedia,
|
type OneOnOneMobileLayoutMedia,
|
||||||
type SpotlightExpandedLayoutMedia,
|
type SpotlightExpandedLayoutMedia,
|
||||||
type SpotlightLandscapeLayoutMedia,
|
type SpotlightLandscapeLayoutMedia,
|
||||||
type SpotlightPortraitLayoutMedia,
|
type SpotlightPortraitLayoutMedia,
|
||||||
@@ -141,7 +141,10 @@ import {
|
|||||||
} from "./remoteMembers/MatrixMemberMetadata.ts";
|
} from "./remoteMembers/MatrixMemberMetadata.ts";
|
||||||
import { Publisher } from "./localMember/Publisher.ts";
|
import { Publisher } from "./localMember/Publisher.ts";
|
||||||
import { type Connection } from "./remoteMembers/Connection.ts";
|
import { type Connection } from "./remoteMembers/Connection.ts";
|
||||||
import { createLayoutModeSwitch } from "./LayoutSwitch.ts";
|
import {
|
||||||
|
type LayoutSwitchViewModel,
|
||||||
|
createLayoutSwitchViewModel,
|
||||||
|
} from "../LayoutSwitchViewModel.ts";
|
||||||
import {
|
import {
|
||||||
createWrappedUserMedia,
|
createWrappedUserMedia,
|
||||||
type WrappedUserMediaViewModel,
|
type WrappedUserMediaViewModel,
|
||||||
@@ -201,8 +204,6 @@ const smallMobileCallThreshold = 3;
|
|||||||
// with the interface
|
// with the interface
|
||||||
const showFooterMs = 4000;
|
const showFooterMs = 4000;
|
||||||
|
|
||||||
export type GridMode = "grid" | "spotlight";
|
|
||||||
|
|
||||||
export type WindowMode = "normal" | "narrow" | "flat" | "pip";
|
export type WindowMode = "normal" | "narrow" | "flat" | "pip";
|
||||||
|
|
||||||
interface LayoutScanState {
|
interface LayoutScanState {
|
||||||
@@ -349,8 +350,7 @@ export interface CallViewModel {
|
|||||||
showNameTags$: Behavior<boolean>;
|
showNameTags$: Behavior<boolean>;
|
||||||
spotlightExpanded$: Behavior<boolean>;
|
spotlightExpanded$: Behavior<boolean>;
|
||||||
toggleSpotlightExpanded$: Behavior<(() => void) | null>;
|
toggleSpotlightExpanded$: Behavior<(() => void) | null>;
|
||||||
gridMode$: Behavior<GridMode>;
|
layoutSwitchVm$: Behavior<LayoutSwitchViewModel | null>;
|
||||||
setGridMode: (value: GridMode) => void;
|
|
||||||
|
|
||||||
// header/footer visibility
|
// header/footer visibility
|
||||||
showHeader$: Behavior<boolean>;
|
showHeader$: Behavior<boolean>;
|
||||||
@@ -365,6 +365,11 @@ export interface CallViewModel {
|
|||||||
*/
|
*/
|
||||||
overflowing$: Behavior<boolean>;
|
overflowing$: Behavior<boolean>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether modals such as settings and reactions should be accessible at all.
|
||||||
|
*/
|
||||||
|
showModals$: Behavior<boolean>;
|
||||||
|
|
||||||
settingsOpen$: Behavior<boolean>;
|
settingsOpen$: Behavior<boolean>;
|
||||||
setSettingsOpen$: Behavior<(open: boolean) => void>;
|
setSettingsOpen$: Behavior<(open: boolean) => void>;
|
||||||
|
|
||||||
@@ -435,7 +440,7 @@ export function createCallViewModel$(
|
|||||||
const matrixRTCMode$ =
|
const matrixRTCMode$ =
|
||||||
configMatrixRTCMode !== undefined
|
configMatrixRTCMode !== undefined
|
||||||
? constant(configMatrixRTCMode)
|
? constant(configMatrixRTCMode)
|
||||||
: (options.matrixRTCMode$ ?? constant(MatrixRTCMode.Legacy));
|
: (options.matrixRTCMode$ ?? constant(MatrixRTCMode.Compatibility));
|
||||||
|
|
||||||
// Each hbar seperates a block of input variables required for the CallViewModel to function.
|
// Each hbar seperates a block of input variables required for the CallViewModel to function.
|
||||||
// The outputs of this block is written under the hbar.
|
// The outputs of this block is written under the hbar.
|
||||||
@@ -482,22 +487,11 @@ export function createCallViewModel$(
|
|||||||
memberships$: memberships$,
|
memberships$: memberships$,
|
||||||
ownMembershipIdentity,
|
ownMembershipIdentity,
|
||||||
client,
|
client,
|
||||||
delayId$: scope.behavior(
|
|
||||||
(
|
|
||||||
fromEvent(
|
|
||||||
matrixRTCSession,
|
|
||||||
MembershipManagerEvent.DelayIdChanged,
|
|
||||||
// The type of reemitted event includes the original emitted as the second arg.
|
|
||||||
) as Observable<[string | undefined, IMembershipManager]>
|
|
||||||
).pipe(map(([delayId]) => delayId ?? null)),
|
|
||||||
matrixRTCSession.delayId ?? null,
|
|
||||||
),
|
|
||||||
roomId: matrixRoom.roomId,
|
roomId: matrixRoom.roomId,
|
||||||
forceJwtEndpoint:
|
forceJwtEndpoint:
|
||||||
mode === MatrixRTCMode.Matrix_2_0
|
mode === MatrixRTCMode.Matrix_2_0
|
||||||
? JwtEndpointVersion.Matrix_2_0
|
? JwtEndpointVersion.Matrix_2_0
|
||||||
: JwtEndpointVersion.Legacy,
|
: JwtEndpointVersion.Legacy,
|
||||||
useOldestMember: mode === MatrixRTCMode.Legacy,
|
|
||||||
}),
|
}),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
@@ -513,8 +507,6 @@ export function createCallViewModel$(
|
|||||||
livekitKeyProvider,
|
livekitKeyProvider,
|
||||||
getUrlParams().controlledAudioDevices,
|
getUrlParams().controlledAudioDevices,
|
||||||
options.livekitRoomFactory,
|
options.livekitRoomFactory,
|
||||||
getUrlParams().echoCancellation,
|
|
||||||
getUrlParams().noiseSuppression,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const connectionManager = createConnectionManager$({
|
const connectionManager = createConnectionManager$({
|
||||||
@@ -585,9 +577,20 @@ export function createCallViewModel$(
|
|||||||
);
|
);
|
||||||
},
|
},
|
||||||
connectionManager,
|
connectionManager,
|
||||||
|
client,
|
||||||
matrixRTCSession,
|
matrixRTCSession,
|
||||||
localTransport$,
|
localTransport$,
|
||||||
roomId: matrixRoom.roomId,
|
roomId: matrixRoom.roomId,
|
||||||
|
ownMembershipIdentity,
|
||||||
|
delayId$: scope.behavior(
|
||||||
|
(
|
||||||
|
fromEvent(
|
||||||
|
matrixRTCSession,
|
||||||
|
MembershipManagerEvent.DelayIdChanged,
|
||||||
|
) as Observable<[string | undefined]>
|
||||||
|
).pipe(map(([delayId]) => delayId ?? null)),
|
||||||
|
matrixRTCSession.delayId ?? null,
|
||||||
|
),
|
||||||
logger: logger.getChild(`[${Date.now()}]`),
|
logger: logger.getChild(`[${Date.now()}]`),
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -943,7 +946,7 @@ export function createCallViewModel$(
|
|||||||
bins.sort(([, bin1], [, bin2]) => bin1 - bin2).map(([m]) => m),
|
bins.sort(([, bin1], [, bin2]) => bin1 - bin2).map(([m]) => m),
|
||||||
);
|
);
|
||||||
}),
|
}),
|
||||||
distinctUntilChanged(shallowEquals),
|
distinctUntilChanged(shallowArrayEquals),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1002,7 +1005,7 @@ export function createCallViewModel$(
|
|||||||
const spotlight$ = scope.behavior<MediaViewModel[]>(
|
const spotlight$ = scope.behavior<MediaViewModel[]>(
|
||||||
spotlightAndPip$.pipe(
|
spotlightAndPip$.pipe(
|
||||||
map(({ spotlight }) => spotlight),
|
map(({ spotlight }) => spotlight),
|
||||||
distinctUntilChanged<MediaViewModel[]>(shallowEquals),
|
distinctUntilChanged<MediaViewModel[]>(shallowArrayEquals),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -1056,7 +1059,7 @@ export function createCallViewModel$(
|
|||||||
spotlightExpandedToggle$,
|
spotlightExpandedToggle$,
|
||||||
);
|
);
|
||||||
|
|
||||||
const { setGridMode, gridMode$ } = createLayoutModeSwitch(
|
const layoutSwitchVm = createLayoutSwitchViewModel(
|
||||||
scope,
|
scope,
|
||||||
windowMode$,
|
windowMode$,
|
||||||
hasRemoteScreenShares$,
|
hasRemoteScreenShares$,
|
||||||
@@ -1108,56 +1111,60 @@ export function createCallViewModel$(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
const oneOnOneLayoutMedia$: Observable<{
|
const oneOnOneLayoutMedia$: Behavior<{
|
||||||
local: LocalUserMediaViewModel;
|
local: LocalUserMediaViewModel;
|
||||||
remote: UserMediaViewModel | RingingMediaViewModel;
|
remote: UserMediaViewModel | RingingMediaViewModel;
|
||||||
} | null> = combineLatest([userMedia$, screenShares$]).pipe(
|
} | null> = scope.behavior(
|
||||||
switchMap(([userMedia, screenShares]) => {
|
combineLatest([userMedia$, screenShares$]).pipe(
|
||||||
// One-on-one layout only supports 2 user media, no screen shares
|
switchMap(([userMedia, screenShares]) => {
|
||||||
if (userMedia.length <= 2 && screenShares.length === 0) {
|
// One-on-one layout only supports 2 user media, no screen shares
|
||||||
const local = userMedia.find(
|
if (userMedia.length <= 2 && screenShares.length === 0) {
|
||||||
(vm): vm is WrappedUserMediaViewModel & LocalUserMediaViewModel =>
|
const local = userMedia.find(
|
||||||
vm.type === "user" && vm.local,
|
(vm): vm is WrappedUserMediaViewModel & LocalUserMediaViewModel =>
|
||||||
);
|
vm.type === "user" && vm.local,
|
||||||
|
|
||||||
if (local !== undefined) {
|
|
||||||
const remote = userMedia.find(
|
|
||||||
(vm): vm is WrappedUserMediaViewModel & RemoteUserMediaViewModel =>
|
|
||||||
vm.type === "user" && !vm.local,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
if (remote !== undefined) return of({ local, remote });
|
if (local !== undefined) {
|
||||||
|
const remote = userMedia.find(
|
||||||
// If there's no other user media in the call (could still happen in
|
(
|
||||||
// this branch due to the duplicate tiles option), we could possibly
|
vm,
|
||||||
// show ringing media instead
|
): vm is WrappedUserMediaViewModel & RemoteUserMediaViewModel =>
|
||||||
if (userMedia.length === 1)
|
vm.type === "user" && !vm.local,
|
||||||
return ringingMedia$.pipe(
|
|
||||||
map(
|
|
||||||
(ringingMedia) =>
|
|
||||||
ringingMedia && { local, remote: ringingMedia },
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return of(null);
|
if (remote !== undefined) return of({ local, remote });
|
||||||
}),
|
|
||||||
|
// If there's no other user media in the call (could still happen in
|
||||||
|
// this branch due to the duplicate tiles option), we could possibly
|
||||||
|
// show ringing media instead
|
||||||
|
if (userMedia.length === 1)
|
||||||
|
return ringingMedia$.pipe(
|
||||||
|
map(
|
||||||
|
(ringingMedia) =>
|
||||||
|
ringingMedia && { local, remote: ringingMedia },
|
||||||
|
),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return of(null);
|
||||||
|
}),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
const oneOnOneLandscapeLayoutMedia$: Observable<OneOnOneLandscapeLayoutMedia | null> =
|
const oneOnOneDesktopLayoutMedia$: Observable<OneOnOneDesktopLayoutMedia | null> =
|
||||||
oneOnOneLayoutMedia$.pipe(
|
oneOnOneLayoutMedia$.pipe(
|
||||||
map((media) => {
|
map((media) => {
|
||||||
if (media === null) return null;
|
if (media === null) return null;
|
||||||
return media.remote.type === "ringing"
|
return media.remote.type === "ringing"
|
||||||
? {
|
? {
|
||||||
type: "one-on-one-landscape" as const,
|
type: "one-on-one-desktop" as const,
|
||||||
edgeToEdge: false,
|
edgeToEdge: false,
|
||||||
spotlight: media.local,
|
spotlight: media.local,
|
||||||
pip: media.remote,
|
pip: media.remote,
|
||||||
}
|
}
|
||||||
: {
|
: {
|
||||||
type: "one-on-one-landscape" as const,
|
type: "one-on-one-desktop" as const,
|
||||||
edgeToEdge: false,
|
edgeToEdge: false,
|
||||||
spotlight: media.remote,
|
spotlight: media.remote,
|
||||||
pip: media.local,
|
pip: media.local,
|
||||||
@@ -1165,13 +1172,13 @@ export function createCallViewModel$(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
const oneOnOnePortraitLayoutMedia$: Observable<OneOnOnePortraitLayoutMedia | null> =
|
const oneOnOneMobileLayoutMedia$: Observable<OneOnOneMobileLayoutMedia | null> =
|
||||||
oneOnOneLayoutMedia$.pipe(
|
oneOnOneLayoutMedia$.pipe(
|
||||||
switchMap((media) => {
|
switchMap((media) => {
|
||||||
if (media === null) return of(null);
|
if (media === null) return of(null);
|
||||||
return media.local.videoEnabled$.pipe(
|
return media.local.videoEnabled$.pipe(
|
||||||
map((videoEnabled) => ({
|
map((videoEnabled) => ({
|
||||||
type: "one-on-one-portrait" as const,
|
type: "one-on-one-mobile" as const,
|
||||||
edgeToEdge: true as const,
|
edgeToEdge: true as const,
|
||||||
spotlight: media.remote,
|
spotlight: media.remote,
|
||||||
pip: videoEnabled ? media.local : undefined,
|
pip: videoEnabled ? media.local : undefined,
|
||||||
@@ -1207,6 +1214,7 @@ export function createCallViewModel$(
|
|||||||
}
|
}
|
||||||
return layout;
|
return layout;
|
||||||
}),
|
}),
|
||||||
|
distinctUntilChanged(),
|
||||||
scope.bind(),
|
scope.bind(),
|
||||||
)
|
)
|
||||||
.subscribe((orientation) => {
|
.subscribe((orientation) => {
|
||||||
@@ -1223,11 +1231,11 @@ export function createCallViewModel$(
|
|||||||
switchMap((windowMode) => {
|
switchMap((windowMode) => {
|
||||||
switch (windowMode) {
|
switch (windowMode) {
|
||||||
case "normal":
|
case "normal":
|
||||||
return gridMode$.pipe(
|
return layoutSwitchVm.layout$.pipe(
|
||||||
switchMap((gridMode) => {
|
switchMap((layout) => {
|
||||||
switch (gridMode) {
|
switch (layout) {
|
||||||
case "grid":
|
case "grid":
|
||||||
return oneOnOneLandscapeLayoutMedia$.pipe(
|
return oneOnOneDesktopLayoutMedia$.pipe(
|
||||||
switchMap((oneOnOne) =>
|
switchMap((oneOnOne) =>
|
||||||
oneOnOne === null ? gridLayoutMedia$ : of(oneOnOne),
|
oneOnOne === null ? gridLayoutMedia$ : of(oneOnOne),
|
||||||
),
|
),
|
||||||
@@ -1244,7 +1252,7 @@ export function createCallViewModel$(
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
case "narrow":
|
case "narrow":
|
||||||
return oneOnOnePortraitLayoutMedia$.pipe(
|
return oneOnOneMobileLayoutMedia$.pipe(
|
||||||
switchMap((oneOnOne) =>
|
switchMap((oneOnOne) =>
|
||||||
oneOnOne === null
|
oneOnOne === null
|
||||||
? combineLatest([grid$, spotlight$], (grid, spotlight) =>
|
? combineLatest([grid$, spotlight$], (grid, spotlight) =>
|
||||||
@@ -1257,17 +1265,23 @@ export function createCallViewModel$(
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
case "flat":
|
case "flat":
|
||||||
return gridMode$.pipe(
|
return oneOnOneMobileLayoutMedia$.pipe(
|
||||||
switchMap((gridMode) => {
|
switchMap((oneOnOne) =>
|
||||||
switch (gridMode) {
|
oneOnOne === null
|
||||||
case "grid":
|
? layoutSwitchVm.layout$.pipe(
|
||||||
// Yes, grid mode actually gets you a "spotlight" layout in
|
switchMap((layout) => {
|
||||||
// this window mode.
|
switch (layout) {
|
||||||
return spotlightLandscapeLayoutMedia$(true);
|
case "grid":
|
||||||
case "spotlight":
|
// Yes, grid mode actually gets you a "spotlight" layout in
|
||||||
return spotlightExpandedLayoutMedia$(true);
|
// this window mode.
|
||||||
}
|
return spotlightLandscapeLayoutMedia$(true);
|
||||||
}),
|
case "spotlight":
|
||||||
|
return spotlightExpandedLayoutMedia$(true);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
: of(oneOnOne),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
case "pip":
|
case "pip":
|
||||||
return pipLayoutMedia$;
|
return pipLayoutMedia$;
|
||||||
@@ -1295,8 +1309,8 @@ export function createCallViewModel$(
|
|||||||
// indicators. And in one-on-one layout there's no question as to who is
|
// indicators. And in one-on-one layout there's no question as to who is
|
||||||
// speaking.
|
// speaking.
|
||||||
case "spotlight-expanded":
|
case "spotlight-expanded":
|
||||||
case "one-on-one-landscape":
|
case "one-on-one-desktop":
|
||||||
case "one-on-one-portrait":
|
case "one-on-one-mobile":
|
||||||
return false;
|
return false;
|
||||||
default:
|
default:
|
||||||
return true;
|
return true;
|
||||||
@@ -1308,7 +1322,7 @@ export function createCallViewModel$(
|
|||||||
const showNameTags$ = scope.behavior<boolean>(
|
const showNameTags$ = scope.behavior<boolean>(
|
||||||
layoutMedia$.pipe(
|
layoutMedia$.pipe(
|
||||||
switchMap((l) =>
|
switchMap((l) =>
|
||||||
l.type === "pip" || l.type === "one-on-one-portrait"
|
l.type === "pip" || l.type === "one-on-one-mobile"
|
||||||
? matrixRoomMembers$.pipe(
|
? matrixRoomMembers$.pipe(
|
||||||
map(
|
map(
|
||||||
(members) =>
|
(members) =>
|
||||||
@@ -1352,6 +1366,22 @@ export function createCallViewModel$(
|
|||||||
layoutMedia$.pipe(map(({ edgeToEdge }) => edgeToEdge)),
|
layoutMedia$.pipe(map(({ edgeToEdge }) => edgeToEdge)),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Only show the layout switch in cases where it has an effect on the layout
|
||||||
|
const showLayoutSwitch$ = windowMode$.pipe(
|
||||||
|
switchMap((windowMode) => {
|
||||||
|
switch (windowMode) {
|
||||||
|
case "normal":
|
||||||
|
return of(true);
|
||||||
|
case "flat":
|
||||||
|
return oneOnOneLayoutMedia$.pipe(
|
||||||
|
map((oneOnOne) => oneOnOne === null),
|
||||||
|
);
|
||||||
|
default:
|
||||||
|
return of(false);
|
||||||
|
}
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
const screenTap$ = new Subject<void>();
|
const screenTap$ = new Subject<void>();
|
||||||
const controlsTap$ = new Subject<void>();
|
const controlsTap$ = new Subject<void>();
|
||||||
const screenHover$ = new Subject<void>();
|
const screenHover$ = new Subject<void>();
|
||||||
@@ -1424,6 +1454,11 @@ export function createCallViewModel$(
|
|||||||
map((naturallyShowFooter) => naturallyShowFooter && showFooterUrlParams),
|
map((naturallyShowFooter) => naturallyShowFooter && showFooterUrlParams),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const showModals$ = scope.behavior(
|
||||||
|
windowMode$.pipe(map((mode) => mode !== "pip")),
|
||||||
|
);
|
||||||
|
|
||||||
const settingsOpen$ = new BehaviorSubject(false);
|
const settingsOpen$ = new BehaviorSubject(false);
|
||||||
const setSettingsOpen$ = constant((open: boolean) => {
|
const setSettingsOpen$ = constant((open: boolean) => {
|
||||||
settingsOpen$.next(open);
|
settingsOpen$.next(open);
|
||||||
@@ -1513,16 +1548,16 @@ export function createCallViewModel$(
|
|||||||
prevTiles,
|
prevTiles,
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "one-on-one-landscape":
|
case "one-on-one-desktop":
|
||||||
[layout, newTiles] = oneOnOneLandscapeLayout(
|
[layout, newTiles] = oneOnOneDesktopLayout(
|
||||||
media,
|
media,
|
||||||
landscapePipAlignment$,
|
landscapePipAlignment$,
|
||||||
prevTiles,
|
prevTiles,
|
||||||
);
|
);
|
||||||
pip = layout.pip;
|
pip = layout.pip;
|
||||||
break;
|
break;
|
||||||
case "one-on-one-portrait":
|
case "one-on-one-mobile":
|
||||||
[layout, newTiles] = oneOnOnePortraitLayout(
|
[layout, newTiles] = oneOnOneMobileLayout(
|
||||||
media,
|
media,
|
||||||
portraitPipSize$,
|
portraitPipSize$,
|
||||||
portraitPipAlignment$,
|
portraitPipAlignment$,
|
||||||
@@ -1550,7 +1585,11 @@ export function createCallViewModel$(
|
|||||||
* The layout of tiles in the call interface.
|
* The layout of tiles in the call interface.
|
||||||
*/
|
*/
|
||||||
const layout$ = scope.behavior<Layout>(
|
const layout$ = scope.behavior<Layout>(
|
||||||
layoutInternals$.pipe(map(({ layout }) => layout)),
|
layoutInternals$.pipe(
|
||||||
|
map(({ layout }) => layout),
|
||||||
|
// Drop redundant layout updates before they would hit React.
|
||||||
|
distinctUntilChanged<Layout>(layoutShallowEquals),
|
||||||
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
const overflowing$ = scope.behavior<boolean>(
|
const overflowing$ = scope.behavior<boolean>(
|
||||||
@@ -1769,8 +1808,9 @@ export function createCallViewModel$(
|
|||||||
|
|
||||||
spotlightExpanded$: spotlightExpanded$,
|
spotlightExpanded$: spotlightExpanded$,
|
||||||
toggleSpotlightExpanded$: toggleSpotlightExpanded$,
|
toggleSpotlightExpanded$: toggleSpotlightExpanded$,
|
||||||
gridMode$: gridMode$,
|
layoutSwitchVm$: scope.behavior(
|
||||||
setGridMode: setGridMode,
|
showLayoutSwitch$.pipe(map((show) => (show ? layoutSwitchVm : null))),
|
||||||
|
),
|
||||||
layout$: layout$,
|
layout$: layout$,
|
||||||
localMatrixLivekitMember$,
|
localMatrixLivekitMember$,
|
||||||
remoteMatrixLivekitMembers$: scope.behavior(
|
remoteMatrixLivekitMembers$: scope.behavior(
|
||||||
@@ -1795,6 +1835,7 @@ export function createCallViewModel$(
|
|||||||
showNameTags$,
|
showNameTags$,
|
||||||
showHeader$: showHeader$,
|
showHeader$: showHeader$,
|
||||||
showFooter$: showFooter$,
|
showFooter$: showFooter$,
|
||||||
|
showModals$,
|
||||||
settingsOpen$: settingsOpen$,
|
settingsOpen$: settingsOpen$,
|
||||||
setSettingsOpen$: setSettingsOpen$,
|
setSettingsOpen$: setSettingsOpen$,
|
||||||
edgeToEdge$,
|
edgeToEdge$,
|
||||||
|
|||||||
@@ -138,9 +138,6 @@ export function withCallViewModel(mode: MatrixRTCMode) {
|
|||||||
public getSyncState(): SyncState {
|
public getSyncState(): SyncState {
|
||||||
return syncState;
|
return syncState;
|
||||||
}
|
}
|
||||||
public getAccessToken(): string | null {
|
|
||||||
return "a-token";
|
|
||||||
}
|
|
||||||
})() as Partial<MatrixClient> as MatrixClient,
|
})() as Partial<MatrixClient> as MatrixClient,
|
||||||
getMembers: () => roomMembers,
|
getMembers: () => roomMembers,
|
||||||
getMembersWithMembership: () => roomMembers,
|
getMembersWithMembership: () => roomMembers,
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2025 Element Creations Ltd.
|
|
||||||
|
|
||||||
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
||||||
Please see LICENSE in the repository root for full details.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {
|
|
||||||
combineLatest,
|
|
||||||
map,
|
|
||||||
Subject,
|
|
||||||
startWith,
|
|
||||||
skipWhile,
|
|
||||||
switchMap,
|
|
||||||
} from "rxjs";
|
|
||||||
|
|
||||||
import { type GridMode, type WindowMode } from "./CallViewModel.ts";
|
|
||||||
import { constant, type Behavior } from "../Behavior.ts";
|
|
||||||
import { type ObservableScope } from "../ObservableScope.ts";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Creates a layout mode switch that allows switching between grid and spotlight modes.
|
|
||||||
* The actual layout mode might switch automatically to spotlight if there is a
|
|
||||||
* remote screen share active or if the window mode is flat.
|
|
||||||
*
|
|
||||||
* @param scope - The observable scope to manage subscriptions.
|
|
||||||
* @param windowMode$ - The current window mode.
|
|
||||||
* @param hasRemoteScreenShares$ - A behavior indicating if there are remote screen shares active.
|
|
||||||
*/
|
|
||||||
export function createLayoutModeSwitch(
|
|
||||||
scope: ObservableScope,
|
|
||||||
windowMode$: Behavior<WindowMode>,
|
|
||||||
hasRemoteScreenShares$: Behavior<boolean>,
|
|
||||||
): {
|
|
||||||
gridMode$: Behavior<GridMode>;
|
|
||||||
setGridMode: (value: GridMode) => void;
|
|
||||||
} {
|
|
||||||
const userSelection$ = new Subject<GridMode>();
|
|
||||||
// Callback to set the grid mode desired by the user.
|
|
||||||
// Notice that this is only a preference, the actual grid mode can be overridden
|
|
||||||
// if there is a remote screen share active.
|
|
||||||
const setGridMode = (value: GridMode): void => userSelection$.next(value);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The natural grid mode - the mode that the grid would prefer to be in,
|
|
||||||
* not accounting for the user's manual selections.
|
|
||||||
*/
|
|
||||||
const naturalGridMode$ = scope.behavior<GridMode>(
|
|
||||||
combineLatest(
|
|
||||||
[hasRemoteScreenShares$, windowMode$],
|
|
||||||
(hasRemoteScreenShares, windowMode) =>
|
|
||||||
// When there are screen shares or the window is flat (as with a phone
|
|
||||||
// in landscape orientation), spotlight is a better experience.
|
|
||||||
// We want screen shares to be big and readable, and we want flipping
|
|
||||||
// your phone into landscape to be a quick way of maximising the
|
|
||||||
// spotlight tile.
|
|
||||||
hasRemoteScreenShares || windowMode === "flat" ? "spotlight" : "grid",
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* The layout mode of the media tile grid.
|
|
||||||
*/
|
|
||||||
const gridMode$ = scope.behavior<GridMode>(
|
|
||||||
// Whenever the user makes a selection, we enter a new mode of behavior:
|
|
||||||
userSelection$.pipe(
|
|
||||||
map((selection) => {
|
|
||||||
if (selection === "grid")
|
|
||||||
// The user has selected grid mode. Start by respecting their choice,
|
|
||||||
// but then follow the natural mode again as soon as it matches.
|
|
||||||
return naturalGridMode$.pipe(
|
|
||||||
skipWhile((naturalMode) => naturalMode !== selection),
|
|
||||||
startWith(selection),
|
|
||||||
);
|
|
||||||
|
|
||||||
// The user has selected spotlight mode. If this matches the natural
|
|
||||||
// mode, then follow the natural mode going forward.
|
|
||||||
return selection === naturalGridMode$.value
|
|
||||||
? naturalGridMode$
|
|
||||||
: constant(selection);
|
|
||||||
}),
|
|
||||||
// Initially the mode of behavior is to just follow the natural grid mode.
|
|
||||||
startWith(naturalGridMode$),
|
|
||||||
// Switch between each mode of behavior.
|
|
||||||
switchMap((mode$) => mode$),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
return {
|
|
||||||
gridMode$,
|
|
||||||
setGridMode,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -20,7 +20,6 @@ import {
|
|||||||
afterAll,
|
afterAll,
|
||||||
beforeEach,
|
beforeEach,
|
||||||
} from "vitest";
|
} from "vitest";
|
||||||
import { AutoDiscovery } from "matrix-js-sdk/lib/autodiscovery";
|
|
||||||
import { BehaviorSubject, map, of } from "rxjs";
|
import { BehaviorSubject, map, of } from "rxjs";
|
||||||
import { logger } from "matrix-js-sdk/lib/logger";
|
import { logger } from "matrix-js-sdk/lib/logger";
|
||||||
import { type LocalParticipant, type LocalTrack } from "livekit-client";
|
import { type LocalParticipant, type LocalTrack } from "livekit-client";
|
||||||
@@ -60,7 +59,7 @@ import {
|
|||||||
|
|
||||||
initializeWidget();
|
initializeWidget();
|
||||||
|
|
||||||
const MATRIX_RTC_MODE = MatrixRTCMode.Legacy;
|
const MATRIX_RTC_MODE = MatrixRTCMode.Compatibility;
|
||||||
const getUrlParams = vi.hoisted(() => vi.fn(() => ({})));
|
const getUrlParams = vi.hoisted(() => vi.fn(() => ({})));
|
||||||
vi.mock("../../../UrlParams", () => ({ getUrlParams }));
|
vi.mock("../../../UrlParams", () => ({ getUrlParams }));
|
||||||
vi.mock("@livekit/components-core", () => ({
|
vi.mock("@livekit/components-core", () => ({
|
||||||
@@ -72,40 +71,10 @@ vi.mock("@livekit/components-core", () => ({
|
|||||||
describe("LocalMembership", () => {
|
describe("LocalMembership", () => {
|
||||||
describe("enterRTCSession", () => {
|
describe("enterRTCSession", () => {
|
||||||
it("It joins the correct Session", () => {
|
it("It joins the correct Session", () => {
|
||||||
const focusFromOlderMembership = {
|
|
||||||
type: "livekit",
|
|
||||||
livekit_service_url: "http://my-oldest-member-service-url.com",
|
|
||||||
livekit_alias: "my-oldest-member-service-alias",
|
|
||||||
};
|
|
||||||
|
|
||||||
const focusConfigFromWellKnown = {
|
|
||||||
type: "livekit",
|
|
||||||
livekit_service_url: "http://my-well-known-service-url.com",
|
|
||||||
};
|
|
||||||
const focusConfigFromWellKnown2 = {
|
|
||||||
type: "livekit",
|
|
||||||
livekit_service_url: "http://my-well-known-service-url2.com",
|
|
||||||
};
|
|
||||||
const clientWellKnown = {
|
|
||||||
"org.matrix.msc4143.rtc_foci": [
|
|
||||||
focusConfigFromWellKnown,
|
|
||||||
focusConfigFromWellKnown2,
|
|
||||||
],
|
|
||||||
};
|
|
||||||
|
|
||||||
mockConfig({
|
mockConfig({
|
||||||
livekit: { livekit_service_url: "http://my-default-service-url.com" },
|
livekit: { livekit_service_url: "http://my-default-service-url.com" },
|
||||||
});
|
});
|
||||||
|
|
||||||
vi.spyOn(AutoDiscovery, "getRawClientConfig").mockImplementation(
|
|
||||||
async (domain) => {
|
|
||||||
if (domain === "example.org") {
|
|
||||||
return Promise.resolve(clientWellKnown);
|
|
||||||
}
|
|
||||||
return Promise.resolve({});
|
|
||||||
},
|
|
||||||
);
|
|
||||||
|
|
||||||
const mockedSession = vi.mocked({
|
const mockedSession = vi.mocked({
|
||||||
room: {
|
room: {
|
||||||
roomId: "roomId",
|
roomId: "roomId",
|
||||||
@@ -120,10 +89,6 @@ describe("LocalMembership", () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
memberships: [],
|
memberships: [],
|
||||||
getFocusInUse: vi.fn().mockReturnValue(focusFromOlderMembership),
|
|
||||||
getOldestMembership: vi.fn().mockReturnValue({
|
|
||||||
getPreferredFoci: vi.fn().mockReturnValue([focusFromOlderMembership]),
|
|
||||||
}),
|
|
||||||
joinRTCSession: vi.fn(),
|
joinRTCSession: vi.fn(),
|
||||||
}) as unknown as MatrixRTCSession;
|
}) as unknown as MatrixRTCSession;
|
||||||
|
|
||||||
@@ -132,7 +97,7 @@ describe("LocalMembership", () => {
|
|||||||
ownMemberMock,
|
ownMemberMock,
|
||||||
{
|
{
|
||||||
livekit_alias: "roomId",
|
livekit_alias: "roomId",
|
||||||
livekit_service_url: "http://my-well-known-service-url.com",
|
livekit_service_url: "http://my-livekit-service-url.com",
|
||||||
type: "livekit",
|
type: "livekit",
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -147,62 +112,13 @@ describe("LocalMembership", () => {
|
|||||||
memberId: "@alice:example.org:DEVICE",
|
memberId: "@alice:example.org:DEVICE",
|
||||||
userId: "@alice:example.org",
|
userId: "@alice:example.org",
|
||||||
},
|
},
|
||||||
[
|
[],
|
||||||
{
|
|
||||||
livekit_alias: "roomId",
|
|
||||||
livekit_service_url: "http://my-well-known-service-url.com",
|
|
||||||
type: "livekit",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
undefined,
|
|
||||||
expect.objectContaining({
|
|
||||||
manageMediaKeys: true,
|
|
||||||
useLegacyMemberEvents: false,
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("It should not fail with configuration error if homeserver config has livekit url but not fallback", () => {
|
|
||||||
mockConfig({});
|
|
||||||
vi.spyOn(AutoDiscovery, "getRawClientConfig").mockResolvedValue({
|
|
||||||
"org.matrix.msc4143.rtc_foci": [
|
|
||||||
{
|
|
||||||
type: "livekit",
|
|
||||||
livekit_service_url: "http://my-well-known-service-url.com",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
const mockedSession = vi.mocked({
|
|
||||||
room: {
|
|
||||||
roomId: "roomId",
|
|
||||||
client: {
|
|
||||||
getDomain: vi.fn().mockReturnValue("example.org"),
|
|
||||||
getOpenIdToken: vi.fn().mockResolvedValue({
|
|
||||||
access_token: "ACCCESS_TOKEN",
|
|
||||||
token_type: "Bearer",
|
|
||||||
matrix_server_name: "localhost",
|
|
||||||
expires_in: 10000,
|
|
||||||
}),
|
|
||||||
},
|
|
||||||
},
|
|
||||||
memberships: [],
|
|
||||||
getFocusInUse: vi.fn(),
|
|
||||||
joinRTCSession: vi.fn(),
|
|
||||||
}) as unknown as MatrixRTCSession;
|
|
||||||
|
|
||||||
enterRTCSession(
|
|
||||||
mockedSession,
|
|
||||||
ownMemberMock,
|
|
||||||
{
|
{
|
||||||
livekit_alias: "roomId",
|
livekit_alias: "roomId",
|
||||||
livekit_service_url: "http://my-well-known-service-url.com",
|
livekit_service_url: "http://my-livekit-service-url.com",
|
||||||
type: "livekit",
|
type: "livekit",
|
||||||
},
|
},
|
||||||
{
|
expect.objectContaining({ manageMediaKeys: true }),
|
||||||
encryptMedia: true,
|
|
||||||
matrixRTCMode: MATRIX_RTC_MODE,
|
|
||||||
},
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -10,10 +10,16 @@ import {
|
|||||||
ParticipantEvent,
|
ParticipantEvent,
|
||||||
type LocalParticipant,
|
type LocalParticipant,
|
||||||
type ScreenShareCaptureOptions,
|
type ScreenShareCaptureOptions,
|
||||||
|
type TrackPublishOptions,
|
||||||
RoomEvent,
|
RoomEvent,
|
||||||
MediaDeviceFailure,
|
MediaDeviceFailure,
|
||||||
} from "livekit-client";
|
} from "livekit-client";
|
||||||
import { observeParticipantEvents } from "@livekit/components-core";
|
import { observeParticipantEvents } from "@livekit/components-core";
|
||||||
|
import {
|
||||||
|
type IOpenIDToken,
|
||||||
|
parseErrorResponse,
|
||||||
|
type MatrixClient,
|
||||||
|
} from "matrix-js-sdk";
|
||||||
import {
|
import {
|
||||||
Status as RTCSessionStatus,
|
Status as RTCSessionStatus,
|
||||||
type LivekitTransport,
|
type LivekitTransport,
|
||||||
@@ -53,6 +59,14 @@ import {
|
|||||||
import { ElementWidgetActions, widget } from "../../../widget.ts";
|
import { ElementWidgetActions, widget } from "../../../widget.ts";
|
||||||
import { getUrlParams } from "../../../UrlParams.ts";
|
import { getUrlParams } from "../../../UrlParams.ts";
|
||||||
import { PosthogAnalytics } from "../../../analytics/PosthogAnalytics.ts";
|
import { PosthogAnalytics } from "../../../analytics/PosthogAnalytics.ts";
|
||||||
|
import {
|
||||||
|
advancedScreenShare,
|
||||||
|
screenShareResolution,
|
||||||
|
screenShareFramerate,
|
||||||
|
screenShareBitrate,
|
||||||
|
screenShareCodec,
|
||||||
|
parseResolution,
|
||||||
|
} from "../../../settings/settings.ts";
|
||||||
import { MatrixRTCMode } from "../../../config/ConfigOptions.ts";
|
import { MatrixRTCMode } from "../../../config/ConfigOptions.ts";
|
||||||
import { Config } from "../../../config/Config.ts";
|
import { Config } from "../../../config/Config.ts";
|
||||||
import {
|
import {
|
||||||
@@ -63,6 +77,7 @@ import {
|
|||||||
import { type HomeserverConnected } from "./HomeserverConnected.ts";
|
import { type HomeserverConnected } from "./HomeserverConnected.ts";
|
||||||
import { type LocalTransport } from "./LocalTransport.ts";
|
import { type LocalTransport } from "./LocalTransport.ts";
|
||||||
import { areLivekitTransportsEqual } from "../remoteMembers/MatrixLivekitMembers.ts";
|
import { areLivekitTransportsEqual } from "../remoteMembers/MatrixLivekitMembers.ts";
|
||||||
|
import { doNetworkOperationWithRetry } from "../../../utils/matrix.ts";
|
||||||
|
|
||||||
export enum TransportState {
|
export enum TransportState {
|
||||||
/** Not even a transport is available to the LocalMembership */
|
/** Not even a transport is available to the LocalMembership */
|
||||||
@@ -108,8 +123,6 @@ export type LocalMemberState =
|
|||||||
};
|
};
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* - get well known
|
|
||||||
* - get oldest membership
|
|
||||||
* - get transport to use
|
* - get transport to use
|
||||||
* - get openId + jwt token
|
* - get openId + jwt token
|
||||||
* - wait for createTrack() call
|
* - wait for createTrack() call
|
||||||
@@ -129,11 +142,14 @@ interface Props {
|
|||||||
joinMatrixRTC: (transport: LivekitTransportConfig) => void;
|
joinMatrixRTC: (transport: LivekitTransportConfig) => void;
|
||||||
homeserverConnected: HomeserverConnected;
|
homeserverConnected: HomeserverConnected;
|
||||||
roomId: string;
|
roomId: string;
|
||||||
|
ownMembershipIdentity: CallMembershipIdentityParts;
|
||||||
localTransport$: Behavior<LocalTransport>;
|
localTransport$: Behavior<LocalTransport>;
|
||||||
|
client: Pick<MatrixClient, "getOpenIdToken" | "baseUrl">;
|
||||||
matrixRTCSession: Pick<
|
matrixRTCSession: Pick<
|
||||||
MatrixRTCSession,
|
MatrixRTCSession,
|
||||||
"updateCallIntent" | "leaveRoomSession"
|
"slotId" | "updateCallIntent" | "leaveRoomSession"
|
||||||
>;
|
>;
|
||||||
|
delayId$: Behavior<string | null>;
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -169,8 +185,11 @@ export const createLocalMembership$ = ({
|
|||||||
joinMatrixRTC,
|
joinMatrixRTC,
|
||||||
logger: parentLogger,
|
logger: parentLogger,
|
||||||
muteStates,
|
muteStates,
|
||||||
|
client,
|
||||||
matrixRTCSession,
|
matrixRTCSession,
|
||||||
roomId,
|
roomId,
|
||||||
|
ownMembershipIdentity,
|
||||||
|
delayId$,
|
||||||
}: Props): {
|
}: Props): {
|
||||||
/**
|
/**
|
||||||
* This request to start audio and video tracks.
|
* This request to start audio and video tracks.
|
||||||
@@ -632,6 +651,60 @@ export const createLocalMembership$ = ({
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
scope.reconcile(
|
||||||
|
scope.behavior(combineLatest([delayId$, activeTransport$])),
|
||||||
|
async ([delayId, transport]) => {
|
||||||
|
if (delayId !== null && transport !== null) {
|
||||||
|
logger.info(
|
||||||
|
`Delegating delayed leave ${delayId} to ${transport.livekit_service_url}…`,
|
||||||
|
);
|
||||||
|
let openIdToken: IOpenIDToken;
|
||||||
|
try {
|
||||||
|
openIdToken = await doNetworkOperationWithRetry(async () =>
|
||||||
|
client.getOpenIdToken(),
|
||||||
|
);
|
||||||
|
} catch (e) {
|
||||||
|
logger.error("Failed to get OpenID token for delegation", e);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const body = JSON.stringify({
|
||||||
|
room_id: roomId,
|
||||||
|
slot_id: matrixRTCSession.slotId,
|
||||||
|
member: {
|
||||||
|
id: ownMembershipIdentity.memberId,
|
||||||
|
claimed_user_id: ownMembershipIdentity.userId,
|
||||||
|
claimed_device_id: ownMembershipIdentity.deviceId,
|
||||||
|
},
|
||||||
|
delay_id: delayId,
|
||||||
|
delay_timeout:
|
||||||
|
Config.get().matrix_rtc_session?.delayed_leave_event_delay_ms,
|
||||||
|
delay_cs_api_url: client.baseUrl,
|
||||||
|
openid_token: openIdToken,
|
||||||
|
});
|
||||||
|
try {
|
||||||
|
const res = await doNetworkOperationWithRetry(async () =>
|
||||||
|
fetch(transport.livekit_service_url + "/delegate_delayed_leave", {
|
||||||
|
method: "POST",
|
||||||
|
headers: { "Content-Type": "application/json" },
|
||||||
|
body,
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
if (res.ok) logger.info(`Delayed leave delegation successful`);
|
||||||
|
else if (res.status === 404)
|
||||||
|
logger.warn(
|
||||||
|
`Delayed event delegation not available on ${transport.livekit_service_url}`,
|
||||||
|
);
|
||||||
|
else throw parseErrorResponse(res, await res.text());
|
||||||
|
} catch (e) {
|
||||||
|
logger.error(
|
||||||
|
`Failed to delegate ${delayId} to ${transport.livekit_service_url}`,
|
||||||
|
e,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
);
|
||||||
|
|
||||||
const participant$ = scope.behavior(
|
const participant$ = scope.behavior(
|
||||||
localConnection$.pipe(
|
localConnection$.pipe(
|
||||||
map((c) => c?.livekitRoom?.localParticipant ?? null),
|
map((c) => c?.livekitRoom?.localParticipant ?? null),
|
||||||
@@ -719,6 +792,43 @@ export const createLocalMembership$ = ({
|
|||||||
surfaceSwitching: "include",
|
surfaceSwitching: "include",
|
||||||
systemAudio: "include",
|
systemAudio: "include",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let publishOptions: TrackPublishOptions | undefined;
|
||||||
|
|
||||||
|
if (advancedScreenShare.getValue()) {
|
||||||
|
// User has advanced screen share settings enabled
|
||||||
|
const { width, height } = parseResolution(
|
||||||
|
screenShareResolution.getValue(),
|
||||||
|
);
|
||||||
|
const fps = screenShareFramerate.getValue();
|
||||||
|
const bps = screenShareBitrate.getValue();
|
||||||
|
const codec = screenShareCodec.getValue();
|
||||||
|
|
||||||
|
screenshareSettings.resolution = {
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
frameRate: fps,
|
||||||
|
};
|
||||||
|
|
||||||
|
publishOptions = {
|
||||||
|
screenShareEncoding: {
|
||||||
|
maxBitrate: bps,
|
||||||
|
maxFramerate: fps,
|
||||||
|
},
|
||||||
|
videoCodec: codec,
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Fall back to config.json settings if available
|
||||||
|
const screenConf = Config.get().media_quality?.screen_share;
|
||||||
|
if (screenConf?.max_resolution) {
|
||||||
|
screenshareSettings.resolution = {
|
||||||
|
width: Math.round((screenConf.max_resolution * 16) / 9),
|
||||||
|
height: screenConf.max_resolution,
|
||||||
|
frameRate: screenConf.max_framerate ?? 30,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const targetScreenshareState = !sharingScreen$.value;
|
const targetScreenshareState = !sharingScreen$.value;
|
||||||
logger.info(
|
logger.info(
|
||||||
`toggleScreenSharing called. Switching ${
|
`toggleScreenSharing called. Switching ${
|
||||||
@@ -734,7 +844,11 @@ export const createLocalMembership$ = ({
|
|||||||
// is still initializing or publishing tracks, because there's no
|
// is still initializing or publishing tracks, because there's no
|
||||||
// technical reason to disallow this. LiveKit will publish if it can.
|
// technical reason to disallow this. LiveKit will publish if it can.
|
||||||
participant$.value
|
participant$.value
|
||||||
?.setScreenShareEnabled(targetScreenshareState, screenshareSettings)
|
?.setScreenShareEnabled(
|
||||||
|
targetScreenshareState,
|
||||||
|
screenshareSettings,
|
||||||
|
publishOptions,
|
||||||
|
)
|
||||||
.catch(logger.error);
|
.catch(logger.error);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -802,9 +916,7 @@ export function enterRTCSession(
|
|||||||
// have started tracking by the time calls start getting created.
|
// have started tracking by the time calls start getting created.
|
||||||
// groupCallOTelMembership?.onJoinCall();
|
// groupCallOTelMembership?.onJoinCall();
|
||||||
|
|
||||||
const { features, matrix_rtc_session: matrixRtcSessionConfig } = Config.get();
|
const { matrix_rtc_session: matrixRtcSessionConfig } = Config.get();
|
||||||
const useDeviceSessionMemberEvents =
|
|
||||||
features?.feature_use_device_session_member_events;
|
|
||||||
const { sendNotificationType: notificationType, callIntent } = getUrlParams();
|
const { sendNotificationType: notificationType, callIntent } = getUrlParams();
|
||||||
const multiSFU =
|
const multiSFU =
|
||||||
matrixRTCMode === MatrixRTCMode.Compatibility ||
|
matrixRTCMode === MatrixRTCMode.Compatibility ||
|
||||||
@@ -846,9 +958,6 @@ export function enterRTCSession(
|
|||||||
notificationType,
|
notificationType,
|
||||||
callIntent,
|
callIntent,
|
||||||
manageMediaKeys: encryptMedia,
|
manageMediaKeys: encryptMedia,
|
||||||
...(useDeviceSessionMemberEvents !== undefined && {
|
|
||||||
useLegacyMemberEvents: !useDeviceSessionMemberEvents,
|
|
||||||
}),
|
|
||||||
delayedLeaveEventRestartMs:
|
delayedLeaveEventRestartMs:
|
||||||
matrixRtcSessionConfig?.delayed_leave_event_restart_ms,
|
matrixRtcSessionConfig?.delayed_leave_event_restart_ms,
|
||||||
delayedLeaveEventDelayMs:
|
delayedLeaveEventDelayMs:
|
||||||
|
|||||||
@@ -13,29 +13,20 @@ import {
|
|||||||
it,
|
it,
|
||||||
type MockedObject,
|
type MockedObject,
|
||||||
vi,
|
vi,
|
||||||
type MockInstance,
|
|
||||||
} from "vitest";
|
} from "vitest";
|
||||||
import {
|
import { type CallMembership } from "matrix-js-sdk/lib/matrixrtc";
|
||||||
type CallMembership,
|
import { lastValueFrom } from "rxjs";
|
||||||
type LivekitTransportConfig,
|
|
||||||
} from "matrix-js-sdk/lib/matrixrtc";
|
|
||||||
import { BehaviorSubject, filter, lastValueFrom } from "rxjs";
|
|
||||||
import fetchMock from "fetch-mock";
|
import fetchMock from "fetch-mock";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
mockConfig,
|
mockConfig,
|
||||||
flushPromises,
|
flushPromises,
|
||||||
ownMemberMock,
|
ownMemberMock,
|
||||||
mockRtcMembership,
|
|
||||||
testScope,
|
testScope,
|
||||||
} from "../../../utils/test";
|
} from "../../../utils/test";
|
||||||
import {
|
import { createLocalTransport$, JwtEndpointVersion } from "./LocalTransport";
|
||||||
createLocalTransport$,
|
|
||||||
JwtEndpointVersion,
|
|
||||||
type LocalTransportWithSFUConfig,
|
|
||||||
} from "./LocalTransport";
|
|
||||||
import { constant } from "../../Behavior";
|
import { constant } from "../../Behavior";
|
||||||
import { Epoch, ObservableScope, trackEpoch } from "../../ObservableScope";
|
import { Epoch, ObservableScope } from "../../ObservableScope";
|
||||||
import {
|
import {
|
||||||
MatrixRTCTransportMissingError,
|
MatrixRTCTransportMissingError,
|
||||||
FailToGetOpenIdToken,
|
FailToGetOpenIdToken,
|
||||||
@@ -58,13 +49,11 @@ describe("LocalTransport", () => {
|
|||||||
const { advertised$, active$ } = createLocalTransport$({
|
const { advertised$, active$ } = createLocalTransport$({
|
||||||
scope: testScope(),
|
scope: testScope(),
|
||||||
roomId: "!room:example.org",
|
roomId: "!room:example.org",
|
||||||
useOldestMember: false,
|
|
||||||
memberships$: constant(new Epoch<CallMembership[]>([])),
|
memberships$: constant(new Epoch<CallMembership[]>([])),
|
||||||
client: {
|
client: {
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
||||||
getAccessToken: vi.fn().mockReturnValue("access_token"),
|
getDomain: () => "example.org",
|
||||||
getDomain: () => "",
|
|
||||||
baseUrl: "example.org",
|
baseUrl: "example.org",
|
||||||
// These won't be called in this error path but satisfy the type
|
// These won't be called in this error path but satisfy the type
|
||||||
getOpenIdToken: vi.fn(),
|
getOpenIdToken: vi.fn(),
|
||||||
@@ -72,14 +61,15 @@ describe("LocalTransport", () => {
|
|||||||
},
|
},
|
||||||
ownMembershipIdentity: ownMemberMock,
|
ownMembershipIdentity: ownMemberMock,
|
||||||
forceJwtEndpoint: JwtEndpointVersion.Legacy,
|
forceJwtEndpoint: JwtEndpointVersion.Legacy,
|
||||||
delayId$: constant("delay_id_mock"),
|
|
||||||
});
|
});
|
||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(() => advertised$.value).toThrow(
|
expect(() => advertised$.value).toThrow(
|
||||||
new MatrixRTCTransportMissingError(""),
|
new MatrixRTCTransportMissingError("example.org"),
|
||||||
|
);
|
||||||
|
expect(() => active$.value).toThrow(
|
||||||
|
new MatrixRTCTransportMissingError("example.org"),
|
||||||
);
|
);
|
||||||
expect(() => active$.value).toThrow(new MatrixRTCTransportMissingError(""));
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("throws FailToGetOpenIdToken when OpenID fetch fails", async () => {
|
it("throws FailToGetOpenIdToken when OpenID fetch fails", async () => {
|
||||||
@@ -100,13 +90,10 @@ describe("LocalTransport", () => {
|
|||||||
const { advertised$, active$ } = createLocalTransport$({
|
const { advertised$, active$ } = createLocalTransport$({
|
||||||
scope,
|
scope,
|
||||||
roomId: "!example_room_id",
|
roomId: "!example_room_id",
|
||||||
useOldestMember: false,
|
|
||||||
memberships$: constant(new Epoch<CallMembership[]>([])),
|
memberships$: constant(new Epoch<CallMembership[]>([])),
|
||||||
client: {
|
client: {
|
||||||
baseUrl: "https://lk.example.org",
|
baseUrl: "https://example.org",
|
||||||
// Use empty domain to skip .well-known and use config directly
|
getDomain: () => "example.org",
|
||||||
getDomain: () => "",
|
|
||||||
getAccessToken: vi.fn().mockReturnValue("access_token"),
|
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
||||||
getOpenIdToken: vi.fn(),
|
getOpenIdToken: vi.fn(),
|
||||||
@@ -114,7 +101,6 @@ describe("LocalTransport", () => {
|
|||||||
},
|
},
|
||||||
ownMembershipIdentity: ownMemberMock,
|
ownMembershipIdentity: ownMemberMock,
|
||||||
forceJwtEndpoint: JwtEndpointVersion.Legacy,
|
forceJwtEndpoint: JwtEndpointVersion.Legacy,
|
||||||
delayId$: constant("delay_id_mock"),
|
|
||||||
});
|
});
|
||||||
active$.subscribe(
|
active$.subscribe(
|
||||||
(o) => observations.push(o),
|
(o) => observations.push(o),
|
||||||
@@ -145,20 +131,17 @@ describe("LocalTransport", () => {
|
|||||||
const { advertised$, active$ } = createLocalTransport$({
|
const { advertised$, active$ } = createLocalTransport$({
|
||||||
scope: testScope(),
|
scope: testScope(),
|
||||||
roomId: "!room:example.org",
|
roomId: "!room:example.org",
|
||||||
useOldestMember: false,
|
|
||||||
memberships$: constant(new Epoch<CallMembership[]>([])),
|
memberships$: constant(new Epoch<CallMembership[]>([])),
|
||||||
client: {
|
client: {
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
||||||
getDomain: () => "",
|
getDomain: () => "example.org",
|
||||||
getOpenIdToken: vi.fn(),
|
getOpenIdToken: vi.fn(),
|
||||||
getDeviceId: vi.fn(),
|
getDeviceId: vi.fn(),
|
||||||
baseUrl: "https://lk.example.org",
|
baseUrl: "https://example.org",
|
||||||
getAccessToken: vi.fn().mockReturnValue("access_token"),
|
|
||||||
},
|
},
|
||||||
ownMembershipIdentity: ownMemberMock,
|
ownMembershipIdentity: ownMemberMock,
|
||||||
forceJwtEndpoint: JwtEndpointVersion.Legacy,
|
forceJwtEndpoint: JwtEndpointVersion.Legacy,
|
||||||
delayId$: constant("delay_id_mock"),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
openIdResolver.resolve?.({
|
openIdResolver.resolve?.({
|
||||||
@@ -187,129 +170,6 @@ describe("LocalTransport", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("oldest member mode", () => {
|
|
||||||
const aliceTransport: LivekitTransportConfig = {
|
|
||||||
type: "livekit",
|
|
||||||
livekit_service_url: "https://alice.example.org",
|
|
||||||
};
|
|
||||||
const bobTransport: LivekitTransportConfig = {
|
|
||||||
type: "livekit",
|
|
||||||
livekit_service_url: "https://bob.example.org",
|
|
||||||
};
|
|
||||||
const aliceMembership = mockRtcMembership("@alice:example.org", "AAA", {
|
|
||||||
fociPreferred: [aliceTransport],
|
|
||||||
});
|
|
||||||
const bobMembership = mockRtcMembership("@bob:example.org", "BBB", {
|
|
||||||
fociPreferred: [bobTransport],
|
|
||||||
});
|
|
||||||
|
|
||||||
let openIdSpy: MockInstance<(typeof openIDSFU)["getSFUConfigWithOpenID"]>;
|
|
||||||
beforeEach(() => {
|
|
||||||
openIdSpy = vi
|
|
||||||
.spyOn(openIDSFU, "getSFUConfigWithOpenID")
|
|
||||||
.mockResolvedValue(openIdResponse);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("updates active transport when oldest member changes", async () => {
|
|
||||||
// Initially, Alice is the only member
|
|
||||||
const memberships$ = new BehaviorSubject([aliceMembership]);
|
|
||||||
|
|
||||||
const scope = testScope();
|
|
||||||
const { advertised$, active$ } = createLocalTransport$({
|
|
||||||
scope,
|
|
||||||
roomId: "!example_room_id",
|
|
||||||
useOldestMember: true,
|
|
||||||
memberships$: scope.behavior(memberships$.pipe(trackEpoch())),
|
|
||||||
client: {
|
|
||||||
getDomain: () => "",
|
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
||||||
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
|
||||||
getAccessToken: vi.fn().mockReturnValue("access_token"),
|
|
||||||
getOpenIdToken: vi.fn(),
|
|
||||||
getDeviceId: vi.fn(),
|
|
||||||
baseUrl: "https://lk.example.org",
|
|
||||||
},
|
|
||||||
ownMembershipIdentity: ownMemberMock,
|
|
||||||
forceJwtEndpoint: JwtEndpointVersion.Legacy,
|
|
||||||
delayId$: constant("delay_id_mock"),
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(active$.value).toBe(null);
|
|
||||||
await flushPromises();
|
|
||||||
// SFU config should've been fetched
|
|
||||||
expect(openIdSpy).toHaveBeenCalled();
|
|
||||||
// Alice's transport should be active and advertised
|
|
||||||
expect(active$.value?.transport).toStrictEqual(aliceTransport);
|
|
||||||
expect(advertised$.value).toStrictEqual(aliceTransport);
|
|
||||||
|
|
||||||
// Now Bob joins the call, but Alice is still the oldest member
|
|
||||||
openIdSpy.mockClear();
|
|
||||||
memberships$.next([aliceMembership, bobMembership]);
|
|
||||||
await flushPromises();
|
|
||||||
// No new SFU config should've been fetched
|
|
||||||
expect(openIdSpy).not.toHaveBeenCalled();
|
|
||||||
// Alice's transport should still be active and advertised
|
|
||||||
expect(active$.value?.transport).toStrictEqual(aliceTransport);
|
|
||||||
expect(advertised$.value).toStrictEqual(aliceTransport);
|
|
||||||
|
|
||||||
// Now Bob takes Alice's place as the oldest member
|
|
||||||
openIdSpy.mockClear();
|
|
||||||
memberships$.next([bobMembership, aliceMembership]);
|
|
||||||
// Active transport should reset to null until we have Bob's SFU config
|
|
||||||
expect(active$.value).toStrictEqual(null);
|
|
||||||
await flushPromises();
|
|
||||||
// Bob's SFU config should've been fetched
|
|
||||||
expect(openIdSpy).toHaveBeenCalled();
|
|
||||||
// Bob's transport should be active, but Alice's should remain advertised
|
|
||||||
// (since we don't want the change in oldest member to cause a wave of new
|
|
||||||
// state events)
|
|
||||||
expect(active$.value?.transport).toStrictEqual(bobTransport);
|
|
||||||
expect(advertised$.value).toStrictEqual(aliceTransport);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("advertises preferred transport when no other member exists", async () => {
|
|
||||||
// Initially, there are no members
|
|
||||||
const memberships$ = new BehaviorSubject<CallMembership[]>([]);
|
|
||||||
|
|
||||||
const scope = testScope();
|
|
||||||
const { advertised$, active$ } = createLocalTransport$({
|
|
||||||
scope,
|
|
||||||
roomId: "!example_room_id",
|
|
||||||
useOldestMember: true,
|
|
||||||
memberships$: scope.behavior(memberships$.pipe(trackEpoch())),
|
|
||||||
client: {
|
|
||||||
getDomain: () => "",
|
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
||||||
_unstable_getRTCTransports: async () =>
|
|
||||||
Promise.resolve([aliceTransport]),
|
|
||||||
getAccessToken: vi.fn().mockReturnValue("access_token"),
|
|
||||||
getOpenIdToken: vi.fn(),
|
|
||||||
getDeviceId: vi.fn(),
|
|
||||||
baseUrl: "https://lk.example.org",
|
|
||||||
},
|
|
||||||
ownMembershipIdentity: ownMemberMock,
|
|
||||||
forceJwtEndpoint: JwtEndpointVersion.Legacy,
|
|
||||||
delayId$: constant("delay_id_mock"),
|
|
||||||
});
|
|
||||||
|
|
||||||
expect(active$.value).toBe(null);
|
|
||||||
await flushPromises();
|
|
||||||
// Our own preferred transport should be advertised
|
|
||||||
expect(advertised$.value).toStrictEqual(aliceTransport);
|
|
||||||
// No transport should be active however (there is still no oldest member)
|
|
||||||
expect(active$.value).toBe(null);
|
|
||||||
|
|
||||||
// Now Bob joins the call and becomes the oldest member
|
|
||||||
memberships$.next([bobMembership]);
|
|
||||||
await flushPromises();
|
|
||||||
// We should still advertise our own preferred transport (to avoid
|
|
||||||
// unnecessary state changes)
|
|
||||||
expect(advertised$.value).toStrictEqual(aliceTransport);
|
|
||||||
// Bob's transport should become active
|
|
||||||
expect(active$.value?.transport).toBe(bobTransport);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
type LocalTransportProps = Parameters<typeof createLocalTransport$>[0];
|
type LocalTransportProps = Parameters<typeof createLocalTransport$>[0];
|
||||||
|
|
||||||
describe("transport configuration mechanisms", () => {
|
describe("transport configuration mechanisms", () => {
|
||||||
@@ -324,16 +184,13 @@ describe("LocalTransport", () => {
|
|||||||
ownMembershipIdentity: ownMemberMock,
|
ownMembershipIdentity: ownMemberMock,
|
||||||
scope: testScope(),
|
scope: testScope(),
|
||||||
roomId: "!example_room_id",
|
roomId: "!example_room_id",
|
||||||
useOldestMember: false,
|
|
||||||
forceJwtEndpoint: JwtEndpointVersion.Legacy,
|
forceJwtEndpoint: JwtEndpointVersion.Legacy,
|
||||||
delayId$: constant(null),
|
|
||||||
memberships$: constant(new Epoch<CallMembership[]>([])),
|
memberships$: constant(new Epoch<CallMembership[]>([])),
|
||||||
client: {
|
client: {
|
||||||
baseUrl: "https://example.org",
|
baseUrl: "https://example.org",
|
||||||
getDomain: vi.fn().mockReturnValue(""),
|
getDomain: vi.fn().mockReturnValue("example.org"),
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
_unstable_getRTCTransports: vi.fn().mockResolvedValue([]),
|
_unstable_getRTCTransports: vi.fn().mockResolvedValue([]),
|
||||||
getAccessToken: vi.fn().mockReturnValue("access_token"),
|
|
||||||
getOpenIdToken: vi.fn(),
|
getOpenIdToken: vi.fn(),
|
||||||
getDeviceId: vi.fn(),
|
getDeviceId: vi.fn(),
|
||||||
},
|
},
|
||||||
@@ -421,42 +278,6 @@ describe("LocalTransport", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Should not call _unstable_getRTCTransports in widget mode but use well-known", async () => {
|
|
||||||
mockConfig({
|
|
||||||
livekit: { livekit_service_url: "https://do-not-use.lk.example.org" },
|
|
||||||
});
|
|
||||||
|
|
||||||
localTransportOpts.client.getDomain.mockReturnValue("example.org");
|
|
||||||
|
|
||||||
fetchMock.getOnce("https://example.org/.well-known/matrix/client", {
|
|
||||||
"org.matrix.msc4143.rtc_foci": [
|
|
||||||
{
|
|
||||||
type: "livekit",
|
|
||||||
livekit_service_url: "https://use-me.jwt.call.example.org",
|
|
||||||
},
|
|
||||||
],
|
|
||||||
});
|
|
||||||
|
|
||||||
localTransportOpts.client.getAccessToken.mockReturnValue(null);
|
|
||||||
const { advertised$, active$ } =
|
|
||||||
createLocalTransport$(localTransportOpts);
|
|
||||||
openIdResolver.resolve?.(openIdResponse);
|
|
||||||
expect(advertised$.value).toBe(null);
|
|
||||||
expect(active$.value).toBe(null);
|
|
||||||
await flushPromises();
|
|
||||||
|
|
||||||
expect(
|
|
||||||
localTransportOpts.client._unstable_getRTCTransports,
|
|
||||||
).not.toHaveBeenCalled();
|
|
||||||
|
|
||||||
const expectedTransport = {
|
|
||||||
type: "livekit",
|
|
||||||
livekit_service_url: "https://use-me.jwt.call.example.org",
|
|
||||||
};
|
|
||||||
|
|
||||||
expect(advertised$.value).toStrictEqual(expectedTransport);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("fails fast if the openID request fails for backend config", async () => {
|
it("fails fast if the openID request fails for backend config", async () => {
|
||||||
localTransportOpts.client._unstable_getRTCTransports.mockResolvedValue([
|
localTransportOpts.client._unstable_getRTCTransports.mockResolvedValue([
|
||||||
{ type: "livekit", livekit_service_url: "https://lk.example.org" },
|
{ type: "livekit", livekit_service_url: "https://lk.example.org" },
|
||||||
@@ -469,66 +290,18 @@ describe("LocalTransport", () => {
|
|||||||
).rejects.toThrow(expect.any(FailToGetOpenIdToken));
|
).rejects.toThrow(expect.any(FailToGetOpenIdToken));
|
||||||
});
|
});
|
||||||
|
|
||||||
it("supports getting transport via well-known", async () => {
|
|
||||||
localTransportOpts.client.getDomain.mockReturnValue("example.org");
|
|
||||||
fetchMock.getOnce("https://example.org/.well-known/matrix/client", {
|
|
||||||
"org.matrix.msc4143.rtc_foci": [
|
|
||||||
{ type: "livekit", livekit_service_url: "https://lk.example.org" },
|
|
||||||
],
|
|
||||||
});
|
|
||||||
const { advertised$, active$ } =
|
|
||||||
createLocalTransport$(localTransportOpts);
|
|
||||||
openIdResolver.resolve?.(openIdResponse);
|
|
||||||
expect(advertised$.value).toBe(null);
|
|
||||||
expect(active$.value).toBe(null);
|
|
||||||
await flushPromises();
|
|
||||||
const expectedTransport = {
|
|
||||||
livekit_service_url: "https://lk.example.org",
|
|
||||||
type: "livekit",
|
|
||||||
};
|
|
||||||
expect(advertised$.value).toStrictEqual(expectedTransport);
|
|
||||||
expect(active$.value).toStrictEqual({
|
|
||||||
transport: expectedTransport,
|
|
||||||
sfuConfig: {
|
|
||||||
jwt: "e30=.eyJzdWIiOiJAbWU6ZXhhbXBsZS5vcmc6QUJDREVGIiwidmlkZW8iOnsicm9vbSI6IiFleGFtcGxlX3Jvb21faWQifX0=.e30=",
|
|
||||||
livekitAlias: "Akph4alDMhen",
|
|
||||||
livekitIdentity: "@lk_user:ABCDEF",
|
|
||||||
url: "https://lk.example.org",
|
|
||||||
},
|
|
||||||
});
|
|
||||||
expect(fetchMock.done()).toEqual(true);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("fails fast if the openId request fails for the well-known config", async () => {
|
|
||||||
localTransportOpts.client.getDomain.mockReturnValue("example.org");
|
|
||||||
fetchMock.getOnce("https://example.org/.well-known/matrix/client", {
|
|
||||||
"org.matrix.msc4143.rtc_foci": [
|
|
||||||
{ type: "livekit", livekit_service_url: "https://lk.example.org" },
|
|
||||||
],
|
|
||||||
});
|
|
||||||
openIdResolver.reject(
|
|
||||||
new FailToGetOpenIdToken(new Error("Test driven error")),
|
|
||||||
);
|
|
||||||
await expect(async () =>
|
|
||||||
lastValueFrom(createLocalTransport$(localTransportOpts).active$),
|
|
||||||
).rejects.toThrow(expect.any(FailToGetOpenIdToken));
|
|
||||||
});
|
|
||||||
|
|
||||||
it("throws if no options are available", async () => {
|
it("throws if no options are available", async () => {
|
||||||
const { advertised$, active$ } = createLocalTransport$({
|
const { advertised$, active$ } = createLocalTransport$({
|
||||||
scope: testScope(),
|
scope: testScope(),
|
||||||
ownMembershipIdentity: ownMemberMock,
|
ownMembershipIdentity: ownMemberMock,
|
||||||
roomId: "!example_room_id",
|
roomId: "!example_room_id",
|
||||||
useOldestMember: false,
|
|
||||||
forceJwtEndpoint: JwtEndpointVersion.Legacy,
|
forceJwtEndpoint: JwtEndpointVersion.Legacy,
|
||||||
delayId$: constant(null),
|
|
||||||
memberships$: constant(new Epoch<CallMembership[]>([])),
|
memberships$: constant(new Epoch<CallMembership[]>([])),
|
||||||
client: {
|
client: {
|
||||||
getDomain: () => "",
|
getDomain: () => "example.org",
|
||||||
baseUrl: "https://example.org",
|
baseUrl: "https://example.org",
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
||||||
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
||||||
getAccessToken: vi.fn().mockReturnValue("access_token"),
|
|
||||||
// These won't be called in this error path but satisfy the type
|
// These won't be called in this error path but satisfy the type
|
||||||
getOpenIdToken: vi.fn(),
|
getOpenIdToken: vi.fn(),
|
||||||
getDeviceId: vi.fn(),
|
getDeviceId: vi.fn(),
|
||||||
@@ -537,93 +310,11 @@ describe("LocalTransport", () => {
|
|||||||
await flushPromises();
|
await flushPromises();
|
||||||
|
|
||||||
expect(() => advertised$.value).toThrow(
|
expect(() => advertised$.value).toThrow(
|
||||||
new MatrixRTCTransportMissingError(""),
|
new MatrixRTCTransportMissingError("example.org"),
|
||||||
);
|
);
|
||||||
expect(() => active$.value).toThrow(
|
expect(() => active$.value).toThrow(
|
||||||
new MatrixRTCTransportMissingError(""),
|
new MatrixRTCTransportMissingError("example.org"),
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it("should not update advertised/active transport on delayID changes, but delay Id delegation should be called", async () => {
|
|
||||||
// For simplicity, we'll just use the config livekit
|
|
||||||
customLivekitUrl.setValue("https://lk.example.org");
|
|
||||||
|
|
||||||
const authCallSpy = vi
|
|
||||||
.spyOn(openIDSFU, "getSFUConfigWithOpenID")
|
|
||||||
.mockResolvedValue(openIdResponse);
|
|
||||||
|
|
||||||
const delayId$ = new BehaviorSubject<string | null>(null);
|
|
||||||
|
|
||||||
const { advertised$, active$ } = createLocalTransport$({
|
|
||||||
scope: testScope(),
|
|
||||||
ownMembershipIdentity: ownMemberMock,
|
|
||||||
roomId: "!example_room_id",
|
|
||||||
// We want multi-sdu
|
|
||||||
useOldestMember: false,
|
|
||||||
forceJwtEndpoint: JwtEndpointVersion.Legacy,
|
|
||||||
delayId$: delayId$,
|
|
||||||
memberships$: constant(new Epoch<CallMembership[]>([])),
|
|
||||||
client: {
|
|
||||||
getDomain: () => "",
|
|
||||||
baseUrl: "https://example.org",
|
|
||||||
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
||||||
_unstable_getRTCTransports: async () => Promise.resolve([]),
|
|
||||||
getAccessToken: vi.fn().mockReturnValue("access_token"),
|
|
||||||
// These won't be called in this error path but satisfy the type
|
|
||||||
getOpenIdToken: vi.fn(),
|
|
||||||
getDeviceId: vi.fn(),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
const advertisedValues: LivekitTransportConfig[] = [];
|
|
||||||
const activeValues: LocalTransportWithSFUConfig[] = [];
|
|
||||||
advertised$
|
|
||||||
.pipe(filter((v) => v !== null))
|
|
||||||
.subscribe((t) => advertisedValues.push(t));
|
|
||||||
active$
|
|
||||||
.pipe(filter((v) => v !== null))
|
|
||||||
.subscribe((t) => activeValues.push(t));
|
|
||||||
|
|
||||||
await flushPromises();
|
|
||||||
|
|
||||||
// we have now an active and an advertised
|
|
||||||
expect(advertisedValues.length).toEqual(1);
|
|
||||||
expect(activeValues.length).toEqual(1);
|
|
||||||
expect(advertisedValues[0]!.livekit_service_url).toEqual(
|
|
||||||
"https://lk.example.org",
|
|
||||||
);
|
|
||||||
expect(activeValues[0]!.transport.livekit_service_url).toEqual(
|
|
||||||
"https://lk.example.org",
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(authCallSpy).toHaveBeenCalledTimes(2);
|
|
||||||
// Now emits 3 new delays id
|
|
||||||
delayId$.next("delay_id_1");
|
|
||||||
await flushPromises();
|
|
||||||
delayId$.next("delay_id_2");
|
|
||||||
await flushPromises();
|
|
||||||
delayId$.next("delay_id_3");
|
|
||||||
await flushPromises();
|
|
||||||
|
|
||||||
// No new emissions should've happened, it is the same transport.
|
|
||||||
expect(advertisedValues.length).toEqual(1);
|
|
||||||
expect(activeValues.length).toEqual(1);
|
|
||||||
|
|
||||||
// Still we should have updated the delayID to auth
|
|
||||||
expect(authCallSpy).toHaveBeenCalledTimes(
|
|
||||||
4 * 2 /* 2 calls for each delayId ?? why */,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(authCallSpy).toHaveBeenLastCalledWith(
|
|
||||||
expect.anything(),
|
|
||||||
expect.anything(),
|
|
||||||
expect.anything(),
|
|
||||||
expect.anything(),
|
|
||||||
expect.objectContaining({
|
|
||||||
delayId: "delay_id_3",
|
|
||||||
}),
|
|
||||||
expect.anything(),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -7,26 +7,11 @@ Please see LICENSE in the repository root for full details.
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
type CallMembership,
|
type CallMembership,
|
||||||
isLivekitTransportConfig,
|
|
||||||
type LivekitTransportConfig,
|
type LivekitTransportConfig,
|
||||||
} from "matrix-js-sdk/lib/matrixrtc";
|
} from "matrix-js-sdk/lib/matrixrtc";
|
||||||
import { type MatrixClient } from "matrix-js-sdk";
|
import { type MatrixClient } from "matrix-js-sdk";
|
||||||
import {
|
import { distinctUntilChanged, from, map, of, switchMap } from "rxjs";
|
||||||
catchError,
|
|
||||||
combineLatest,
|
|
||||||
distinctUntilChanged,
|
|
||||||
first,
|
|
||||||
from,
|
|
||||||
map,
|
|
||||||
merge,
|
|
||||||
type Observable,
|
|
||||||
of,
|
|
||||||
startWith,
|
|
||||||
switchMap,
|
|
||||||
tap,
|
|
||||||
} from "rxjs";
|
|
||||||
import { logger as rootLogger, type Logger } from "matrix-js-sdk/lib/logger";
|
import { logger as rootLogger, type Logger } from "matrix-js-sdk/lib/logger";
|
||||||
import { AutoDiscovery } from "matrix-js-sdk/lib/autodiscovery";
|
|
||||||
import { type CallMembershipIdentityParts } from "matrix-js-sdk/lib/matrixrtc/EncryptionManager";
|
import { type CallMembershipIdentityParts } from "matrix-js-sdk/lib/matrixrtc/EncryptionManager";
|
||||||
|
|
||||||
import { type Behavior } from "../../Behavior.ts";
|
import { type Behavior } from "../../Behavior.ts";
|
||||||
@@ -48,8 +33,7 @@ import { RtcTransportAutoDiscovery } from "./RtcTransportAutoDiscovery.ts";
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* It figures out “which LiveKit focus URL/alias the local user should use,”
|
* It figures out “which LiveKit focus URL/alias the local user should use,”
|
||||||
* optionally aligning with the oldest member, and ensures the SFU path is primed
|
* and ensures the SFU path is primed before advertising that choice.
|
||||||
* before advertising that choice.
|
|
||||||
*/
|
*/
|
||||||
interface Props {
|
interface Props {
|
||||||
scope: ObservableScope;
|
scope: ObservableScope;
|
||||||
@@ -57,14 +41,12 @@ interface Props {
|
|||||||
memberships$: Behavior<Epoch<CallMembership[]>>;
|
memberships$: Behavior<Epoch<CallMembership[]>>;
|
||||||
client: Pick<
|
client: Pick<
|
||||||
MatrixClient,
|
MatrixClient,
|
||||||
"getDomain" | "baseUrl" | "_unstable_getRTCTransports" | "getAccessToken"
|
"getDomain" | "baseUrl" | "_unstable_getRTCTransports"
|
||||||
> &
|
> &
|
||||||
OpenIDClientParts;
|
OpenIDClientParts;
|
||||||
// Used by the jwt service to create the livekit room and compute the livekit alias.
|
// Used by the jwt service to create the livekit room and compute the livekit alias.
|
||||||
roomId: string;
|
roomId: string;
|
||||||
useOldestMember: boolean;
|
|
||||||
forceJwtEndpoint: JwtEndpointVersion;
|
forceJwtEndpoint: JwtEndpointVersion;
|
||||||
delayId$: Behavior<string | null>;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum JwtEndpointVersion {
|
export enum JwtEndpointVersion {
|
||||||
@@ -120,8 +102,6 @@ export interface LocalTransport {
|
|||||||
/**
|
/**
|
||||||
* Connects to the JWT service and determines the transports that the local member should use.
|
* Connects to the JWT service and determines the transports that the local member should use.
|
||||||
*
|
*
|
||||||
* @prop useOldestMember Whether to use the same transport as the oldest member.
|
|
||||||
* This will only update once the first oldest member appears. Will not recompute if the oldest member leaves.
|
|
||||||
* @prop useOldJwtEndpoint Whether to set forceOldJwtEndpoint on the returned transport and to use the old JWT endpoint.
|
* @prop useOldJwtEndpoint Whether to set forceOldJwtEndpoint on the returned transport and to use the old JWT endpoint.
|
||||||
* This is used when the connection manager needs to know if it has to use the legacy endpoint which implies a string concatenated rtcBackendIdentity.
|
* This is used when the connection manager needs to know if it has to use the legacy endpoint which implies a string concatenated rtcBackendIdentity.
|
||||||
* (which is expected for non sticky event based rtc member events)
|
* (which is expected for non sticky event based rtc member events)
|
||||||
@@ -134,23 +114,13 @@ export const createLocalTransport$ = ({
|
|||||||
ownMembershipIdentity,
|
ownMembershipIdentity,
|
||||||
client,
|
client,
|
||||||
roomId,
|
roomId,
|
||||||
useOldestMember,
|
|
||||||
forceJwtEndpoint,
|
forceJwtEndpoint,
|
||||||
delayId$,
|
|
||||||
}: Props): LocalTransport => {
|
}: Props): LocalTransport => {
|
||||||
const logger = rootLogger.getChild("[LocalTransport]");
|
const logger = rootLogger.getChild("[LocalTransport]");
|
||||||
// The LiveKit transport in use by the oldest RTC membership. `null` when the
|
|
||||||
// oldest member has no such transport.
|
|
||||||
const oldestMemberTransport$ = observerOldestMembership$(
|
|
||||||
scope,
|
|
||||||
memberships$,
|
|
||||||
logger,
|
|
||||||
);
|
|
||||||
|
|
||||||
const transportDiscovery = new RtcTransportAutoDiscovery({
|
const transportDiscovery = new RtcTransportAutoDiscovery({
|
||||||
client: client,
|
client: client,
|
||||||
resolvedConfig: Config.get(),
|
resolvedConfig: Config.get(),
|
||||||
wellKnownFetcher: AutoDiscovery.getRawClientConfig.bind(AutoDiscovery),
|
|
||||||
logger: logger,
|
logger: logger,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -183,8 +153,8 @@ export const createLocalTransport$ = ({
|
|||||||
distinctUntilChanged(areLivekitTransportsEqual),
|
distinctUntilChanged(areLivekitTransportsEqual),
|
||||||
);
|
);
|
||||||
|
|
||||||
const preferredTransport$ = combineLatest([preferredConfig$, delayId$]).pipe(
|
const preferredTransport$ = preferredConfig$.pipe(
|
||||||
switchMap(async ([transport, delayId]) => {
|
switchMap(async (transport) => {
|
||||||
try {
|
try {
|
||||||
return await doOpenIdAndJWTFromUrl(
|
return await doOpenIdAndJWTFromUrl(
|
||||||
transport,
|
transport,
|
||||||
@@ -192,7 +162,6 @@ export const createLocalTransport$ = ({
|
|||||||
ownMembershipIdentity,
|
ownMembershipIdentity,
|
||||||
roomId,
|
roomId,
|
||||||
client,
|
client,
|
||||||
delayId ?? undefined,
|
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
@@ -205,19 +174,6 @@ export const createLocalTransport$ = ({
|
|||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
|
|
||||||
if (useOldestMember) {
|
|
||||||
return observeLocalTransportForOldestMembership(
|
|
||||||
scope,
|
|
||||||
oldestMemberTransport$,
|
|
||||||
preferredTransport$,
|
|
||||||
client,
|
|
||||||
ownMembershipIdentity,
|
|
||||||
roomId,
|
|
||||||
logger,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// --- Multi-SFU mode ---
|
|
||||||
// Always publish on and advertise the preferred transport.
|
// Always publish on and advertise the preferred transport.
|
||||||
return {
|
return {
|
||||||
advertised$: scope.behavior(
|
advertised$: scope.behavior(
|
||||||
@@ -245,47 +201,6 @@ export const createLocalTransport$ = ({
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Observes the oldest member in the room and returns the transport that it uses if it is a livekit transport.
|
|
||||||
* @param scope - The observable scope.
|
|
||||||
* @param memberships$ - The observable of the call's memberships.'
|
|
||||||
*/
|
|
||||||
function observerOldestMembership$(
|
|
||||||
scope: ObservableScope,
|
|
||||||
memberships$: Behavior<Epoch<CallMembership[]>>,
|
|
||||||
logger: Logger,
|
|
||||||
): Behavior<LivekitTransportConfig | null> {
|
|
||||||
return scope.behavior<LivekitTransportConfig | null>(
|
|
||||||
memberships$.pipe(
|
|
||||||
map((memberships) => {
|
|
||||||
const oldestMember = memberships.value[0];
|
|
||||||
if (oldestMember === undefined) {
|
|
||||||
logger.info("Oldest member: not found");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const transport = oldestMember.getTransport(oldestMember);
|
|
||||||
if (transport === undefined) {
|
|
||||||
logger.warn(
|
|
||||||
`Oldest member: ${oldestMember.userId}|${oldestMember.deviceId}|${oldestMember.memberId} has no transport`,
|
|
||||||
);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
if (!isLivekitTransportConfig(transport)) {
|
|
||||||
logger.warn(
|
|
||||||
`Oldest member: ${oldestMember.userId}|${oldestMember.deviceId}|${oldestMember.memberId} has invalid transport`,
|
|
||||||
);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
logger.info(
|
|
||||||
"Oldest member: ${oldestMember.userId}|${oldestMember.deviceId}|${oldestMember.memberId} has valid transport",
|
|
||||||
);
|
|
||||||
return transport;
|
|
||||||
}),
|
|
||||||
distinctUntilChanged(areLivekitTransportsEqual),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility to ensure the user can authenticate with the SFU.
|
* Utility to ensure the user can authenticate with the SFU.
|
||||||
* We will call `getSFUConfigWithOpenID` once per transport here as it's our
|
* We will call `getSFUConfigWithOpenID` once per transport here as it's our
|
||||||
@@ -298,7 +213,6 @@ function observerOldestMembership$(
|
|||||||
* @param membership The identity of the local member.
|
* @param membership The identity of the local member.
|
||||||
* @param roomId The room ID to use for the JWT.
|
* @param roomId The room ID to use for the JWT.
|
||||||
* @param client The client to use for the OpenID token.
|
* @param client The client to use for the OpenID token.
|
||||||
* @param delayId The delayId to use for the JWT.
|
|
||||||
*
|
*
|
||||||
* @throws FailToGetOpenIdToken, NoMatrix2AuthorizationService
|
* @throws FailToGetOpenIdToken, NoMatrix2AuthorizationService
|
||||||
*/
|
*/
|
||||||
@@ -307,12 +221,7 @@ async function doOpenIdAndJWTFromUrl(
|
|||||||
forceJwtEndpoint: JwtEndpointVersion,
|
forceJwtEndpoint: JwtEndpointVersion,
|
||||||
membership: CallMembershipIdentityParts,
|
membership: CallMembershipIdentityParts,
|
||||||
roomId: string,
|
roomId: string,
|
||||||
client: Pick<
|
client: Pick<MatrixClient, "_unstable_getRTCTransports"> & OpenIDClientParts,
|
||||||
MatrixClient,
|
|
||||||
"getDomain" | "baseUrl" | "_unstable_getRTCTransports" | "getAccessToken"
|
|
||||||
> &
|
|
||||||
OpenIDClientParts,
|
|
||||||
delayId?: string,
|
|
||||||
logger?: Logger,
|
logger?: Logger,
|
||||||
): Promise<LocalTransportWithSFUConfig> {
|
): Promise<LocalTransportWithSFUConfig> {
|
||||||
const sfuConfig = await getSFUConfigWithOpenID(
|
const sfuConfig = await getSFUConfigWithOpenID(
|
||||||
@@ -322,8 +231,6 @@ async function doOpenIdAndJWTFromUrl(
|
|||||||
roomId,
|
roomId,
|
||||||
{
|
{
|
||||||
forceJwtEndpoint: forceJwtEndpoint,
|
forceJwtEndpoint: forceJwtEndpoint,
|
||||||
delayEndpointBaseUrl: client.baseUrl,
|
|
||||||
delayId,
|
|
||||||
},
|
},
|
||||||
logger,
|
logger,
|
||||||
);
|
);
|
||||||
@@ -333,85 +240,6 @@ async function doOpenIdAndJWTFromUrl(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function observeLocalTransportForOldestMembership(
|
|
||||||
scope: ObservableScope,
|
|
||||||
oldestMemberTransport$: Behavior<LivekitTransportConfig | null>,
|
|
||||||
preferredTransport$: Observable<LocalTransportWithSFUConfig>,
|
|
||||||
client: Pick<
|
|
||||||
MatrixClient,
|
|
||||||
"getDomain" | "baseUrl" | "_unstable_getRTCTransports" | "getAccessToken"
|
|
||||||
> &
|
|
||||||
OpenIDClientParts,
|
|
||||||
ownMembershipIdentity: CallMembershipIdentityParts,
|
|
||||||
roomId: string,
|
|
||||||
logger: Logger,
|
|
||||||
): LocalTransport {
|
|
||||||
// Ensure we can authenticate with the SFU.
|
|
||||||
const authenticatedOldestMemberTransport$ = oldestMemberTransport$.pipe(
|
|
||||||
switchMap((transport) => {
|
|
||||||
// Oldest member not available -we are first- (or invalid SFU config).
|
|
||||||
if (transport === null) return of(null);
|
|
||||||
|
|
||||||
// Whenever there is transport change we want to revert
|
|
||||||
// to no transport while we do the authentication.
|
|
||||||
// So do a from(promise) here to be able to startWith(null)
|
|
||||||
return from(
|
|
||||||
doOpenIdAndJWTFromUrl(
|
|
||||||
transport,
|
|
||||||
JwtEndpointVersion.Legacy,
|
|
||||||
ownMembershipIdentity,
|
|
||||||
roomId,
|
|
||||||
client,
|
|
||||||
undefined,
|
|
||||||
logger,
|
|
||||||
),
|
|
||||||
).pipe(
|
|
||||||
catchError((e: unknown) => {
|
|
||||||
logger.error(
|
|
||||||
`Failed to authenticate to transport ${transport.livekit_service_url}`,
|
|
||||||
e,
|
|
||||||
);
|
|
||||||
throw mapAuthErrorToUserFriendlyError(e);
|
|
||||||
}),
|
|
||||||
startWith(null),
|
|
||||||
);
|
|
||||||
}),
|
|
||||||
);
|
|
||||||
|
|
||||||
// --- Oldest member mode ---
|
|
||||||
return {
|
|
||||||
// Never update the transport that we advertise in our membership. Just
|
|
||||||
// take the first valid oldest member or preferred transport that we learn
|
|
||||||
// about, and stick with that. This avoids unnecessary SFU hops and room
|
|
||||||
// state changes.
|
|
||||||
advertised$: scope.behavior(
|
|
||||||
merge(
|
|
||||||
authenticatedOldestMemberTransport$.pipe(
|
|
||||||
map((t) => t?.transport ?? null),
|
|
||||||
),
|
|
||||||
preferredTransport$.pipe(map((t) => t.transport)),
|
|
||||||
).pipe(
|
|
||||||
first((t) => t !== null),
|
|
||||||
tap((t) =>
|
|
||||||
logger.info(`Advertise transport: ${t.livekit_service_url}`),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
null,
|
|
||||||
),
|
|
||||||
// Publish on the transport used by the oldest member.
|
|
||||||
active$: scope.behavior(
|
|
||||||
authenticatedOldestMemberTransport$.pipe(
|
|
||||||
tap((t) =>
|
|
||||||
logger.info(
|
|
||||||
`Publish on transport: ${t?.transport.livekit_service_url}`,
|
|
||||||
),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
null,
|
|
||||||
),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapAuthErrorToUserFriendlyError(e: unknown): Error {
|
function mapAuthErrorToUserFriendlyError(e: unknown): Error {
|
||||||
if (
|
if (
|
||||||
e instanceof FailToGetOpenIdToken ||
|
e instanceof FailToGetOpenIdToken ||
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import {
|
|||||||
type MockedObject,
|
type MockedObject,
|
||||||
vi,
|
vi,
|
||||||
} from "vitest";
|
} from "vitest";
|
||||||
import { type IClientWellKnown, MatrixError } from "matrix-js-sdk";
|
import { MatrixError } from "matrix-js-sdk";
|
||||||
import { logger as rootLogger } from "matrix-js-sdk/lib/logger";
|
import { logger as rootLogger } from "matrix-js-sdk/lib/logger";
|
||||||
import {
|
import {
|
||||||
type LivekitTransportConfig,
|
type LivekitTransportConfig,
|
||||||
@@ -33,9 +33,9 @@ const backendTransport: LivekitTransportConfig = {
|
|||||||
livekit_service_url: "https://backend.example.org",
|
livekit_service_url: "https://backend.example.org",
|
||||||
};
|
};
|
||||||
|
|
||||||
const wellKnownTransport: LivekitTransportConfig = {
|
const configTransport: LivekitTransportConfig = {
|
||||||
type: "livekit",
|
type: "livekit",
|
||||||
livekit_service_url: "https://well-known.example.org",
|
livekit_service_url: "https://config.example.org",
|
||||||
};
|
};
|
||||||
|
|
||||||
function makeClient(): MockedObject<DiscoveryClient> {
|
function makeClient(): MockedObject<DiscoveryClient> {
|
||||||
@@ -43,7 +43,6 @@ function makeClient(): MockedObject<DiscoveryClient> {
|
|||||||
getDomain: vi.fn().mockReturnValue("example.org"),
|
getDomain: vi.fn().mockReturnValue("example.org"),
|
||||||
baseUrl: "https://matrix.example.org",
|
baseUrl: "https://matrix.example.org",
|
||||||
_unstable_getRTCTransports: vi.fn().mockResolvedValue([]),
|
_unstable_getRTCTransports: vi.fn().mockResolvedValue([]),
|
||||||
getAccessToken: vi.fn().mockReturnValue("access_token"),
|
|
||||||
getOpenIdToken: vi.fn(),
|
getOpenIdToken: vi.fn(),
|
||||||
getDeviceId: vi.fn(),
|
getDeviceId: vi.fn(),
|
||||||
} as unknown as MockedObject<DiscoveryClient>;
|
} as unknown as MockedObject<DiscoveryClient>;
|
||||||
@@ -59,12 +58,6 @@ function makeResolvedConfig(livekitServiceUrl?: string): ResolvedConfigOptions {
|
|||||||
} as ResolvedConfigOptions;
|
} as ResolvedConfigOptions;
|
||||||
}
|
}
|
||||||
|
|
||||||
function makeWellKnown(rtcFoci?: Transport[]): IClientWellKnown {
|
|
||||||
return {
|
|
||||||
"org.matrix.msc4143.rtc_foci": rtcFoci,
|
|
||||||
} as unknown as IClientWellKnown;
|
|
||||||
}
|
|
||||||
|
|
||||||
describe("RtcTransportAutoDiscovery", () => {
|
describe("RtcTransportAutoDiscovery", () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
vi.clearAllMocks();
|
vi.clearAllMocks();
|
||||||
@@ -75,33 +68,27 @@ describe("RtcTransportAutoDiscovery", () => {
|
|||||||
{ transports: [{ type: "not_livekit" }, backendTransport] },
|
{ transports: [{ type: "not_livekit" }, backendTransport] },
|
||||||
];
|
];
|
||||||
it.each(VALID_TEST_CASES)(
|
it.each(VALID_TEST_CASES)(
|
||||||
"prefers backend transport over well-known and app config $transports",
|
"prefers backend transport other app config $transports",
|
||||||
async ({ transports }) => {
|
async ({ transports }) => {
|
||||||
// it("prefers backend transport over well-known and app config", async () => {
|
|
||||||
const client = makeClient();
|
const client = makeClient();
|
||||||
client._unstable_getRTCTransports.mockResolvedValue(transports);
|
client._unstable_getRTCTransports.mockResolvedValue(transports);
|
||||||
|
|
||||||
const wellKnownFetcher = vi
|
|
||||||
.fn<(domain: string) => Promise<IClientWellKnown>>()
|
|
||||||
.mockResolvedValue(makeWellKnown([wellKnownTransport]));
|
|
||||||
|
|
||||||
const discovery = new RtcTransportAutoDiscovery({
|
const discovery = new RtcTransportAutoDiscovery({
|
||||||
client,
|
client,
|
||||||
resolvedConfig: makeResolvedConfig("https://config.example.org"),
|
resolvedConfig: makeResolvedConfig(configTransport.livekit_service_url),
|
||||||
wellKnownFetcher,
|
|
||||||
logger: rootLogger,
|
logger: rootLogger,
|
||||||
});
|
});
|
||||||
|
|
||||||
await expect(
|
const discoveredTransport = await discovery.discoverPreferredTransport();
|
||||||
discovery.discoverPreferredTransport(),
|
|
||||||
).resolves.toStrictEqual(backendTransport);
|
expect(discoveredTransport).toStrictEqual(backendTransport);
|
||||||
|
expect(discoveredTransport).not.toStrictEqual(configTransport);
|
||||||
|
|
||||||
expect(client._unstable_getRTCTransports).toHaveBeenCalledTimes(1);
|
expect(client._unstable_getRTCTransports).toHaveBeenCalledTimes(1);
|
||||||
expect(wellKnownFetcher).not.toHaveBeenCalled();
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it("Retries limit_exceeded backend transport over well-known", async () => {
|
it("Retries limit_exceeded backend transport", async () => {
|
||||||
const client = makeClient();
|
const client = makeClient();
|
||||||
client._unstable_getRTCTransports
|
client._unstable_getRTCTransports
|
||||||
.mockRejectedValueOnce(
|
.mockRejectedValueOnce(
|
||||||
@@ -116,14 +103,9 @@ describe("RtcTransportAutoDiscovery", () => {
|
|||||||
)
|
)
|
||||||
.mockResolvedValue([backendTransport]);
|
.mockResolvedValue([backendTransport]);
|
||||||
|
|
||||||
const wellKnownFetcher = vi
|
|
||||||
.fn<(domain: string) => Promise<IClientWellKnown>>()
|
|
||||||
.mockResolvedValue(makeWellKnown([wellKnownTransport]));
|
|
||||||
|
|
||||||
const discovery = new RtcTransportAutoDiscovery({
|
const discovery = new RtcTransportAutoDiscovery({
|
||||||
client,
|
client,
|
||||||
resolvedConfig: makeResolvedConfig("https://config.example.org"),
|
resolvedConfig: makeResolvedConfig("https://config.example.org"),
|
||||||
wellKnownFetcher,
|
|
||||||
logger: rootLogger,
|
logger: rootLogger,
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -132,7 +114,6 @@ describe("RtcTransportAutoDiscovery", () => {
|
|||||||
);
|
);
|
||||||
|
|
||||||
expect(client._unstable_getRTCTransports).toHaveBeenCalledTimes(2);
|
expect(client._unstable_getRTCTransports).toHaveBeenCalledTimes(2);
|
||||||
expect(wellKnownFetcher).not.toHaveBeenCalled();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
const INVALID_TEST_CASES: Array<{ transports: Transport[] }> = [
|
const INVALID_TEST_CASES: Array<{ transports: Transport[] }> = [
|
||||||
@@ -140,91 +121,30 @@ describe("RtcTransportAutoDiscovery", () => {
|
|||||||
{ transports: [{ type: "not_livekit" }] },
|
{ transports: [{ type: "not_livekit" }] },
|
||||||
];
|
];
|
||||||
it.each(INVALID_TEST_CASES)(
|
it.each(INVALID_TEST_CASES)(
|
||||||
"falls back to well-known when backend has no (valid) livekit transports $transports",
|
"falls back to config when backend has no (valid) livekit transports $transports",
|
||||||
async ({ transports }) => {
|
async ({ transports }) => {
|
||||||
const client = makeClient();
|
const client = makeClient();
|
||||||
client._unstable_getRTCTransports.mockResolvedValue(transports);
|
client._unstable_getRTCTransports.mockResolvedValue(transports);
|
||||||
|
|
||||||
const wellKnownFetcher = vi
|
|
||||||
.fn<(domain: string) => Promise<IClientWellKnown>>()
|
|
||||||
.mockResolvedValue(makeWellKnown([wellKnownTransport]));
|
|
||||||
|
|
||||||
const discovery = new RtcTransportAutoDiscovery({
|
const discovery = new RtcTransportAutoDiscovery({
|
||||||
client,
|
client,
|
||||||
resolvedConfig: makeResolvedConfig("https://config.example.org"),
|
resolvedConfig: makeResolvedConfig(configTransport.livekit_service_url),
|
||||||
wellKnownFetcher,
|
|
||||||
logger: rootLogger,
|
logger: rootLogger,
|
||||||
});
|
});
|
||||||
|
|
||||||
await expect(
|
const discoveredTransport = await discovery.discoverPreferredTransport();
|
||||||
discovery.discoverPreferredTransport(),
|
expect(discoveredTransport).not.toStrictEqual(backendTransport);
|
||||||
).resolves.toStrictEqual(wellKnownTransport);
|
expect(discoveredTransport).toStrictEqual(configTransport);
|
||||||
|
|
||||||
expect(wellKnownFetcher).toHaveBeenCalledWith("example.org");
|
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
it("skips backend discovery in widget mode and uses well-known", async () => {
|
it("returns null when backend and config are all unavailable", async () => {
|
||||||
const client = makeClient();
|
|
||||||
// widget mode is detected by the absence of an access token
|
|
||||||
client.getAccessToken.mockReturnValue(null);
|
|
||||||
|
|
||||||
const wellKnownFetcher = vi
|
|
||||||
.fn<(domain: string) => Promise<IClientWellKnown>>()
|
|
||||||
.mockResolvedValue(makeWellKnown([wellKnownTransport]));
|
|
||||||
|
|
||||||
const discovery = new RtcTransportAutoDiscovery({
|
|
||||||
client,
|
|
||||||
resolvedConfig: makeResolvedConfig("https://config.example.org"),
|
|
||||||
wellKnownFetcher,
|
|
||||||
logger: rootLogger,
|
|
||||||
});
|
|
||||||
|
|
||||||
await expect(discovery.discoverPreferredTransport()).resolves.toStrictEqual(
|
|
||||||
wellKnownTransport,
|
|
||||||
);
|
|
||||||
|
|
||||||
expect(client._unstable_getRTCTransports).not.toHaveBeenCalled();
|
|
||||||
expect(wellKnownFetcher).toHaveBeenCalledWith("example.org");
|
|
||||||
});
|
|
||||||
|
|
||||||
it("falls back to app config when backend fails and well-known has no rtc_foci", async () => {
|
|
||||||
const client = makeClient();
|
|
||||||
client._unstable_getRTCTransports.mockRejectedValue(
|
|
||||||
new MatrixError({ errcode: "M_UNKNOWN" }, 404),
|
|
||||||
);
|
|
||||||
|
|
||||||
const wellKnownFetcher = vi
|
|
||||||
.fn<(domain: string) => Promise<IClientWellKnown>>()
|
|
||||||
.mockResolvedValue({} as IClientWellKnown);
|
|
||||||
|
|
||||||
const discovery = new RtcTransportAutoDiscovery({
|
|
||||||
client,
|
|
||||||
resolvedConfig: makeResolvedConfig("https://config.example.org"),
|
|
||||||
wellKnownFetcher,
|
|
||||||
logger: rootLogger,
|
|
||||||
});
|
|
||||||
|
|
||||||
await expect(discovery.discoverPreferredTransport()).resolves.toStrictEqual(
|
|
||||||
{
|
|
||||||
type: "livekit",
|
|
||||||
livekit_service_url: "https://config.example.org",
|
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("returns null when backend, well-known and config are all unavailable", async () => {
|
|
||||||
const client = makeClient();
|
const client = makeClient();
|
||||||
client._unstable_getRTCTransports.mockResolvedValue([]);
|
client._unstable_getRTCTransports.mockResolvedValue([]);
|
||||||
|
|
||||||
const wellKnownFetcher = vi
|
|
||||||
.fn<(domain: string) => Promise<IClientWellKnown>>()
|
|
||||||
.mockResolvedValue({} as IClientWellKnown);
|
|
||||||
|
|
||||||
const discovery = new RtcTransportAutoDiscovery({
|
const discovery = new RtcTransportAutoDiscovery({
|
||||||
client,
|
client,
|
||||||
resolvedConfig: makeResolvedConfig(undefined),
|
resolvedConfig: makeResolvedConfig(undefined),
|
||||||
wellKnownFetcher,
|
|
||||||
logger: rootLogger,
|
logger: rootLogger,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import {
|
|||||||
isLivekitTransportConfig,
|
isLivekitTransportConfig,
|
||||||
type LivekitTransportConfig,
|
type LivekitTransportConfig,
|
||||||
} from "matrix-js-sdk/lib/matrixrtc";
|
} from "matrix-js-sdk/lib/matrixrtc";
|
||||||
import { type IClientWellKnown, type MatrixClient } from "matrix-js-sdk";
|
import { type MatrixClient } from "matrix-js-sdk";
|
||||||
import { type Logger } from "matrix-js-sdk/lib/logger";
|
import { type Logger } from "matrix-js-sdk/lib/logger";
|
||||||
|
|
||||||
import type { ResolvedConfigOptions } from "../../../config/ConfigOptions.ts";
|
import type { ResolvedConfigOptions } from "../../../config/ConfigOptions.ts";
|
||||||
@@ -16,33 +16,27 @@ import { doNetworkOperationWithRetry } from "../../../utils/matrix.ts";
|
|||||||
|
|
||||||
type TransportDiscoveryClient = Pick<
|
type TransportDiscoveryClient = Pick<
|
||||||
MatrixClient,
|
MatrixClient,
|
||||||
"getDomain" | "_unstable_getRTCTransports" | "getAccessToken"
|
"getDomain" | "_unstable_getRTCTransports"
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export interface RtcTransportAutoDiscoveryProps {
|
export interface RtcTransportAutoDiscoveryProps {
|
||||||
client: TransportDiscoveryClient;
|
client: TransportDiscoveryClient;
|
||||||
resolvedConfig: ResolvedConfigOptions;
|
resolvedConfig: ResolvedConfigOptions;
|
||||||
wellKnownFetcher: (domain: string) => Promise<IClientWellKnown>;
|
|
||||||
logger: Logger;
|
logger: Logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class RtcTransportAutoDiscovery {
|
export class RtcTransportAutoDiscovery {
|
||||||
private readonly client: TransportDiscoveryClient;
|
private readonly client: TransportDiscoveryClient;
|
||||||
private readonly resolvedConfig: ResolvedConfigOptions;
|
private readonly resolvedConfig: ResolvedConfigOptions;
|
||||||
private readonly wellKnownFetcher: (
|
|
||||||
domain: string,
|
|
||||||
) => Promise<IClientWellKnown>;
|
|
||||||
private readonly logger: Logger;
|
private readonly logger: Logger;
|
||||||
|
|
||||||
public constructor({
|
public constructor({
|
||||||
client,
|
client,
|
||||||
resolvedConfig,
|
resolvedConfig,
|
||||||
wellKnownFetcher,
|
|
||||||
logger,
|
logger,
|
||||||
}: RtcTransportAutoDiscoveryProps) {
|
}: RtcTransportAutoDiscoveryProps) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
this.resolvedConfig = resolvedConfig;
|
this.resolvedConfig = resolvedConfig;
|
||||||
this.wellKnownFetcher = wellKnownFetcher;
|
|
||||||
this.logger = logger.getChild("[RtcTransportAutoDiscovery]");
|
this.logger = logger.getChild("[RtcTransportAutoDiscovery]");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -56,21 +50,7 @@ export class RtcTransportAutoDiscovery {
|
|||||||
return backendTransport;
|
return backendTransport;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.logger.info("No backend transport found, falling back to well-known");
|
// 2) app config URL
|
||||||
// 2) .well-known transports
|
|
||||||
const wellKnownTransport = await this.tryWellKnownTransports();
|
|
||||||
if (wellKnownTransport) {
|
|
||||||
this.logger.info(
|
|
||||||
`Found .well-known transport: ${wellKnownTransport.livekit_service_url}`,
|
|
||||||
);
|
|
||||||
return wellKnownTransport;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.logger.info(
|
|
||||||
"No .well-known transport found, falling back to app config",
|
|
||||||
);
|
|
||||||
|
|
||||||
// 3) app config URL
|
|
||||||
const configTransport = this.tryConfigTransport();
|
const configTransport = this.tryConfigTransport();
|
||||||
if (configTransport) {
|
if (configTransport) {
|
||||||
this.logger.info(
|
this.logger.info(
|
||||||
@@ -90,72 +70,23 @@ export class RtcTransportAutoDiscovery {
|
|||||||
private async tryBackendTransports(): Promise<LivekitTransportConfig | null> {
|
private async tryBackendTransports(): Promise<LivekitTransportConfig | null> {
|
||||||
const client = this.client;
|
const client = this.client;
|
||||||
// MSC4143: Attempt to fetch transports from backend.
|
// MSC4143: Attempt to fetch transports from backend.
|
||||||
// TODO: Workaround for an issue in the js-sdk RoomWidgetClient that
|
this.logger.info("First try to use getRTCTransports end point ...");
|
||||||
// is not yet implementing _unstable_getRTCTransports properly (via widget API new action).
|
try {
|
||||||
// For now we just skip this call if we are in a widget.
|
const transportList = await doNetworkOperationWithRetry(async () =>
|
||||||
// In widget mode the client is a `RoomWidgetClient` which has no access token (it is using the widget API).
|
client._unstable_getRTCTransports(),
|
||||||
// Could be removed once the js-sdk is fixed (https://github.com/matrix-org/matrix-js-sdk/issues/5245)
|
);
|
||||||
const isSPA = !!client.getAccessToken();
|
const first = transportList.find(isLivekitTransportConfig);
|
||||||
if (isSPA && "_unstable_getRTCTransports" in client) {
|
if (first) {
|
||||||
this.logger.info("First try to use getRTCTransports end point ...");
|
return first;
|
||||||
try {
|
|
||||||
const transportList = await doNetworkOperationWithRetry(async () =>
|
|
||||||
client._unstable_getRTCTransports(),
|
|
||||||
);
|
|
||||||
const first = transportList.find(isLivekitTransportConfig);
|
|
||||||
if (first) {
|
|
||||||
return first;
|
|
||||||
} else {
|
|
||||||
this.logger.info(
|
|
||||||
`No livekit transport found in getRTCTransports end point`,
|
|
||||||
transportList,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
} catch (ex) {
|
|
||||||
this.logger.info(`Failed to use getRTCTransports end point: ${ex}`);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
this.logger.debug(`getRTCTransports end point not available`);
|
|
||||||
}
|
|
||||||
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetches the first rtc_foci from the .well-known/matrix/client.
|
|
||||||
* This will not throw errors, but instead just log them and return null if the expected config is not found or malformed.
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
private async tryWellKnownTransports(): Promise<LivekitTransportConfig | null> {
|
|
||||||
// Legacy MSC4143 (to be removed) WELL_KNOWN: Prioritize the .well-known/matrix/client, if available.
|
|
||||||
const client = this.client;
|
|
||||||
const domain = client.getDomain();
|
|
||||||
if (domain) {
|
|
||||||
// we use AutoDiscovery instead of relying on the MatrixClient having already
|
|
||||||
// been fully configured and started
|
|
||||||
|
|
||||||
const wellKnownFoci = await this.wellKnownFetcher(domain);
|
|
||||||
|
|
||||||
const fociConfig = wellKnownFoci["org.matrix.msc4143.rtc_foci"];
|
|
||||||
if (fociConfig) {
|
|
||||||
if (!Array.isArray(fociConfig)) {
|
|
||||||
this.logger.warn(
|
|
||||||
`org.matrix.msc4143.rtc_foci is not an array in .well-known`,
|
|
||||||
);
|
|
||||||
} else {
|
|
||||||
return fociConfig[0];
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
this.logger.info(
|
this.logger.info(
|
||||||
`No .well-known "org.matrix.msc4143.rtc_foci" found for ${domain}`,
|
`No livekit transport found in getRTCTransports end point`,
|
||||||
wellKnownFoci,
|
transportList,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} catch (ex) {
|
||||||
// Should never happen, but just in case
|
this.logger.info(`Failed to use getRTCTransports end point: ${ex}`);
|
||||||
this.logger.warn(`No domain configured for client`);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -36,7 +36,6 @@ import {
|
|||||||
SFURoomCreationRestrictedError,
|
SFURoomCreationRestrictedError,
|
||||||
UnknownCallError,
|
UnknownCallError,
|
||||||
} from "../../../utils/errors.ts";
|
} from "../../../utils/errors.ts";
|
||||||
import { type JwtEndpointVersion } from "../localMember/LocalTransport.ts";
|
|
||||||
|
|
||||||
export interface ConnectionOpts {
|
export interface ConnectionOpts {
|
||||||
/**
|
/**
|
||||||
@@ -44,11 +43,6 @@ export interface ConnectionOpts {
|
|||||||
* On top the local transport will send additional data to the jwt server to use delayed event delegation.
|
* On top the local transport will send additional data to the jwt server to use delayed event delegation.
|
||||||
*/
|
*/
|
||||||
existingSFUConfig?: SFUConfig;
|
existingSFUConfig?: SFUConfig;
|
||||||
/**
|
|
||||||
* For local connections that use the oldest member pattern. here we have not prefetched the sfuConfig
|
|
||||||
* and hence we need to let the connection do the jwt token fetching.
|
|
||||||
*/
|
|
||||||
forceJwtEndpoint?: JwtEndpointVersion;
|
|
||||||
/** The identity parts to use on this connection */
|
/** The identity parts to use on this connection */
|
||||||
ownMembershipIdentity: CallMembershipIdentityParts;
|
ownMembershipIdentity: CallMembershipIdentityParts;
|
||||||
/** The media transport to connect to. */
|
/** The media transport to connect to. */
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import {
|
|||||||
type E2EEManagerOptions,
|
type E2EEManagerOptions,
|
||||||
type BaseE2EEManager,
|
type BaseE2EEManager,
|
||||||
} from "livekit-client";
|
} from "livekit-client";
|
||||||
import { type Logger } from "matrix-js-sdk/lib/logger";
|
import { logger, type Logger } from "matrix-js-sdk/lib/logger";
|
||||||
// imported as inline to support worker when loaded from a cdn (cross domain)
|
// imported as inline to support worker when loaded from a cdn (cross domain)
|
||||||
import E2EEWorker from "livekit-client/e2ee-worker?worker&inline";
|
import E2EEWorker from "livekit-client/e2ee-worker?worker&inline";
|
||||||
import { type CallMembershipIdentityParts } from "matrix-js-sdk/lib/matrixrtc/EncryptionManager";
|
import { type CallMembershipIdentityParts } from "matrix-js-sdk/lib/matrixrtc/EncryptionManager";
|
||||||
@@ -27,7 +27,18 @@ import type {
|
|||||||
import type { MediaDevices } from "../../MediaDevices.ts";
|
import type { MediaDevices } from "../../MediaDevices.ts";
|
||||||
import type { Behavior } from "../../Behavior.ts";
|
import type { Behavior } from "../../Behavior.ts";
|
||||||
import type { ProcessorState } from "../../../livekit/TrackProcessorContext.tsx";
|
import type { ProcessorState } from "../../../livekit/TrackProcessorContext.tsx";
|
||||||
import { defaultLiveKitOptions } from "../../../livekit/options.ts";
|
import { getLiveKitOptions } from "../../../livekit/options.ts";
|
||||||
|
import {
|
||||||
|
advancedCamera,
|
||||||
|
cameraResolution,
|
||||||
|
cameraFramerate,
|
||||||
|
cameraBitrate,
|
||||||
|
cameraCodec,
|
||||||
|
parseResolution,
|
||||||
|
echoCancellationSetting,
|
||||||
|
noiseSuppressionSetting,
|
||||||
|
autoGainControlSetting,
|
||||||
|
} from "../../../settings/settings.ts";
|
||||||
|
|
||||||
// TODO evaluate if this should be done like the Publisher Factory
|
// TODO evaluate if this should be done like the Publisher Factory
|
||||||
export interface ConnectionFactory {
|
export interface ConnectionFactory {
|
||||||
@@ -53,8 +64,6 @@ export class ECConnectionFactory implements ConnectionFactory {
|
|||||||
* @param livekitKeyProvider - Optional key provider for end-to-end encryption.
|
* @param livekitKeyProvider - Optional key provider for end-to-end encryption.
|
||||||
* @param controlledAudioDevices - Option to indicate whether audio output device is controlled externally (native mobile app).
|
* @param controlledAudioDevices - Option to indicate whether audio output device is controlled externally (native mobile app).
|
||||||
* @param livekitRoomFactory - Optional factory function (for testing) to create LivekitRoom instances. If not provided, a default factory is used.
|
* @param livekitRoomFactory - Optional factory function (for testing) to create LivekitRoom instances. If not provided, a default factory is used.
|
||||||
* @param echoCancellation - Whether to enable echo cancellation for audio capture.
|
|
||||||
* @param noiseSuppression - Whether to enable noise suppression for audio capture.
|
|
||||||
*/
|
*/
|
||||||
public constructor(
|
public constructor(
|
||||||
private client: OpenIDClientParts,
|
private client: OpenIDClientParts,
|
||||||
@@ -64,25 +73,22 @@ export class ECConnectionFactory implements ConnectionFactory {
|
|||||||
livekitKeyProvider: BaseKeyProvider | undefined,
|
livekitKeyProvider: BaseKeyProvider | undefined,
|
||||||
private controlledAudioDevices: boolean,
|
private controlledAudioDevices: boolean,
|
||||||
livekitRoomFactory?: () => LivekitRoom,
|
livekitRoomFactory?: () => LivekitRoom,
|
||||||
echoCancellation: boolean = true,
|
|
||||||
noiseSuppression: boolean = true,
|
|
||||||
) {
|
) {
|
||||||
const defaultFactory = (): LivekitRoom =>
|
const defaultFactory = (): LivekitRoom => {
|
||||||
new LivekitRoom(
|
const roomOptions = generateRoomOption({
|
||||||
generateRoomOption({
|
devices: this.devices,
|
||||||
devices: this.devices,
|
processorState: this.processorState$.value,
|
||||||
processorState: this.processorState$.value,
|
e2eeLivekitOptions: livekitKeyProvider && {
|
||||||
e2eeLivekitOptions: livekitKeyProvider && {
|
keyProvider: livekitKeyProvider,
|
||||||
keyProvider: livekitKeyProvider,
|
// It's important that every room use a separate E2EE worker.
|
||||||
// It's important that every room use a separate E2EE worker.
|
// They get confused if given streams from multiple rooms.
|
||||||
// They get confused if given streams from multiple rooms.
|
worker: new E2EEWorker(),
|
||||||
worker: new E2EEWorker(),
|
},
|
||||||
},
|
controlledAudioDevices: this.controlledAudioDevices,
|
||||||
controlledAudioDevices: this.controlledAudioDevices,
|
});
|
||||||
echoCancellation,
|
logger.info("[ECConnectionFactory] livekit room options: ", roomOptions);
|
||||||
noiseSuppression,
|
return new LivekitRoom(roomOptions);
|
||||||
}),
|
};
|
||||||
);
|
|
||||||
this.livekitRoomFactory = livekitRoomFactory ?? defaultFactory;
|
this.livekitRoomFactory = livekitRoomFactory ?? defaultFactory;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,14 +125,13 @@ export class ECConnectionFactory implements ConnectionFactory {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate the initial LiveKit RoomOptions based on the current media devices and processor state.
|
* Generate the initial LiveKit RoomOptions based on the current media devices and processor state.
|
||||||
|
* Reads audio processing and camera quality settings directly from Settings.
|
||||||
*/
|
*/
|
||||||
function generateRoomOption({
|
function generateRoomOption({
|
||||||
devices,
|
devices,
|
||||||
processorState,
|
processorState,
|
||||||
e2eeLivekitOptions,
|
e2eeLivekitOptions,
|
||||||
controlledAudioDevices,
|
controlledAudioDevices,
|
||||||
echoCancellation,
|
|
||||||
noiseSuppression,
|
|
||||||
}: {
|
}: {
|
||||||
devices: MediaDevices;
|
devices: MediaDevices;
|
||||||
processorState: ProcessorState;
|
processorState: ProcessorState;
|
||||||
@@ -135,21 +140,44 @@ function generateRoomOption({
|
|||||||
| { e2eeManager: BaseE2EEManager }
|
| { e2eeManager: BaseE2EEManager }
|
||||||
| undefined;
|
| undefined;
|
||||||
controlledAudioDevices: boolean;
|
controlledAudioDevices: boolean;
|
||||||
echoCancellation: boolean;
|
|
||||||
noiseSuppression: boolean;
|
|
||||||
}): RoomOptions {
|
}): RoomOptions {
|
||||||
|
const liveKitOptions = getLiveKitOptions();
|
||||||
|
|
||||||
|
// Apply advanced camera settings if enabled
|
||||||
|
let videoCaptureDefaults = {
|
||||||
|
...liveKitOptions.videoCaptureDefaults,
|
||||||
|
deviceId: devices.videoInput.selected$.value?.id,
|
||||||
|
processor: processorState.processor,
|
||||||
|
};
|
||||||
|
let publishDefaults = liveKitOptions.publishDefaults;
|
||||||
|
|
||||||
|
if (advancedCamera.getValue()) {
|
||||||
|
const { width, height } = parseResolution(cameraResolution.getValue());
|
||||||
|
const fps = cameraFramerate.getValue();
|
||||||
|
const bps = cameraBitrate.getValue();
|
||||||
|
const codec = cameraCodec.getValue();
|
||||||
|
|
||||||
|
videoCaptureDefaults = {
|
||||||
|
...videoCaptureDefaults,
|
||||||
|
resolution: { width, height, frameRate: fps },
|
||||||
|
};
|
||||||
|
publishDefaults = {
|
||||||
|
...publishDefaults,
|
||||||
|
videoEncoding: { maxBitrate: bps, maxFramerate: fps },
|
||||||
|
videoCodec: codec,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...defaultLiveKitOptions,
|
...liveKitOptions,
|
||||||
videoCaptureDefaults: {
|
videoCaptureDefaults,
|
||||||
...defaultLiveKitOptions.videoCaptureDefaults,
|
publishDefaults,
|
||||||
deviceId: devices.videoInput.selected$.value?.id,
|
|
||||||
processor: processorState.processor,
|
|
||||||
},
|
|
||||||
audioCaptureDefaults: {
|
audioCaptureDefaults: {
|
||||||
...defaultLiveKitOptions.audioCaptureDefaults,
|
...liveKitOptions.audioCaptureDefaults,
|
||||||
deviceId: devices.audioInput.selected$.value?.id,
|
deviceId: devices.audioInput.selected$.value?.id,
|
||||||
echoCancellation,
|
echoCancellation: echoCancellationSetting.getValue(),
|
||||||
noiseSuppression,
|
noiseSuppression: noiseSuppressionSetting.getValue(),
|
||||||
|
autoGainControl: autoGainControlSetting.getValue(),
|
||||||
},
|
},
|
||||||
audioOutput: {
|
audioOutput: {
|
||||||
// When using controlled audio devices, we don't want to set the
|
// When using controlled audio devices, we don't want to set the
|
||||||
|
|||||||
@@ -22,6 +22,16 @@ import {
|
|||||||
} from "../../../utils/test.ts";
|
} from "../../../utils/test.ts";
|
||||||
import type { ProcessorState } from "../../../livekit/TrackProcessorContext.tsx";
|
import type { ProcessorState } from "../../../livekit/TrackProcessorContext.tsx";
|
||||||
import { constant } from "../../Behavior";
|
import { constant } from "../../Behavior";
|
||||||
|
import {
|
||||||
|
echoCancellationSetting,
|
||||||
|
noiseSuppressionSetting,
|
||||||
|
autoGainControlSetting,
|
||||||
|
advancedCamera,
|
||||||
|
cameraResolution,
|
||||||
|
cameraFramerate,
|
||||||
|
cameraBitrate,
|
||||||
|
cameraCodec,
|
||||||
|
} from "../../../settings/settings.ts";
|
||||||
|
|
||||||
// At the top of your test file, after imports
|
// At the top of your test file, after imports
|
||||||
vi.mock("livekit-client", async (importOriginal) => {
|
vi.mock("livekit-client", async (importOriginal) => {
|
||||||
@@ -58,11 +68,14 @@ describe("ECConnectionFactory - Audio inputs options", () => {
|
|||||||
{ echo: false, noise: true },
|
{ echo: false, noise: true },
|
||||||
{ echo: false, noise: false },
|
{ echo: false, noise: false },
|
||||||
])(
|
])(
|
||||||
"it sets echoCancellation=$echo and noiseSuppression=$noise based on constructor parameters",
|
"it sets echoCancellation=$echo and noiseSuppression=$noise based on settings",
|
||||||
({ echo, noise }) => {
|
({ echo, noise }) => {
|
||||||
// test("it sets echoCancellation and noiseSuppression based on constructor parameters", () => {
|
|
||||||
const RoomConstructor = vi.mocked(LivekitRoom);
|
const RoomConstructor = vi.mocked(LivekitRoom);
|
||||||
|
|
||||||
|
// Set audio processing settings
|
||||||
|
echoCancellationSetting.setValue(echo);
|
||||||
|
noiseSuppressionSetting.setValue(noise);
|
||||||
|
|
||||||
const ecConnectionFactory = new ECConnectionFactory(
|
const ecConnectionFactory = new ECConnectionFactory(
|
||||||
mockClient,
|
mockClient,
|
||||||
"!roomid:example.org",
|
"!roomid:example.org",
|
||||||
@@ -73,9 +86,6 @@ describe("ECConnectionFactory - Audio inputs options", () => {
|
|||||||
}),
|
}),
|
||||||
undefined,
|
undefined,
|
||||||
false,
|
false,
|
||||||
undefined,
|
|
||||||
echo,
|
|
||||||
noise,
|
|
||||||
);
|
);
|
||||||
ecConnectionFactory.createConnection(
|
ecConnectionFactory.createConnection(
|
||||||
testScope,
|
testScope,
|
||||||
@@ -101,9 +111,13 @@ describe("ECConnectionFactory - ControlledAudioDevice", () => {
|
|||||||
test.each([{ controlled: true }, { controlled: false }])(
|
test.each([{ controlled: true }, { controlled: false }])(
|
||||||
"it sets controlledAudioDevice=$controlled then uses deviceId accordingly",
|
"it sets controlledAudioDevice=$controlled then uses deviceId accordingly",
|
||||||
({ controlled }) => {
|
({ controlled }) => {
|
||||||
// test("it sets echoCancellation and noiseSuppression based on constructor parameters", () => {
|
|
||||||
const RoomConstructor = vi.mocked(LivekitRoom);
|
const RoomConstructor = vi.mocked(LivekitRoom);
|
||||||
|
|
||||||
|
// Explicitly set audio settings so the test doesn't depend on defaults
|
||||||
|
echoCancellationSetting.setValue(true);
|
||||||
|
noiseSuppressionSetting.setValue(true);
|
||||||
|
autoGainControlSetting.setValue(true);
|
||||||
|
|
||||||
const ecConnectionFactory = new ECConnectionFactory(
|
const ecConnectionFactory = new ECConnectionFactory(
|
||||||
mockClient,
|
mockClient,
|
||||||
"!roomid:example.org",
|
"!roomid:example.org",
|
||||||
@@ -120,9 +134,6 @@ describe("ECConnectionFactory - ControlledAudioDevice", () => {
|
|||||||
}),
|
}),
|
||||||
undefined,
|
undefined,
|
||||||
controlled,
|
controlled,
|
||||||
undefined,
|
|
||||||
false,
|
|
||||||
false,
|
|
||||||
);
|
);
|
||||||
ecConnectionFactory.createConnection(
|
ecConnectionFactory.createConnection(
|
||||||
testScope,
|
testScope,
|
||||||
@@ -143,6 +154,114 @@ describe("ECConnectionFactory - ControlledAudioDevice", () => {
|
|||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("ECConnectionFactory - Camera quality settings", () => {
|
||||||
|
test("it uses default video options when advancedCamera is disabled", () => {
|
||||||
|
const RoomConstructor = vi.mocked(LivekitRoom);
|
||||||
|
advancedCamera.setValue(false);
|
||||||
|
|
||||||
|
const ecConnectionFactory = new ECConnectionFactory(
|
||||||
|
mockClient,
|
||||||
|
"!roomid:example.org",
|
||||||
|
mockMediaDevices({}),
|
||||||
|
new BehaviorSubject<ProcessorState>({
|
||||||
|
supported: true,
|
||||||
|
processor: undefined,
|
||||||
|
}),
|
||||||
|
undefined,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
ecConnectionFactory.createConnection(
|
||||||
|
testScope,
|
||||||
|
exampleTransport,
|
||||||
|
ownMemberMock,
|
||||||
|
logger,
|
||||||
|
);
|
||||||
|
|
||||||
|
// publishDefaults should use config defaults (vp8), not custom settings
|
||||||
|
expect(RoomConstructor).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
publishDefaults: expect.objectContaining({
|
||||||
|
videoCodec: "vp8",
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("it applies custom camera resolution, encoding, and codec when advancedCamera is enabled", () => {
|
||||||
|
const RoomConstructor = vi.mocked(LivekitRoom);
|
||||||
|
|
||||||
|
advancedCamera.setValue(true);
|
||||||
|
cameraResolution.setValue("1920x1080");
|
||||||
|
cameraFramerate.setValue(60);
|
||||||
|
cameraBitrate.setValue(4_000_000);
|
||||||
|
cameraCodec.setValue("vp9");
|
||||||
|
|
||||||
|
const ecConnectionFactory = new ECConnectionFactory(
|
||||||
|
mockClient,
|
||||||
|
"!roomid:example.org",
|
||||||
|
mockMediaDevices({}),
|
||||||
|
new BehaviorSubject<ProcessorState>({
|
||||||
|
supported: true,
|
||||||
|
processor: undefined,
|
||||||
|
}),
|
||||||
|
undefined,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
ecConnectionFactory.createConnection(
|
||||||
|
testScope,
|
||||||
|
exampleTransport,
|
||||||
|
ownMemberMock,
|
||||||
|
logger,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(RoomConstructor).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
videoCaptureDefaults: expect.objectContaining({
|
||||||
|
resolution: { width: 1920, height: 1080, frameRate: 60 },
|
||||||
|
}),
|
||||||
|
publishDefaults: expect.objectContaining({
|
||||||
|
videoEncoding: { maxBitrate: 4_000_000, maxFramerate: 60 },
|
||||||
|
videoCodec: "vp9",
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("it applies autoGainControl from settings", () => {
|
||||||
|
const RoomConstructor = vi.mocked(LivekitRoom);
|
||||||
|
|
||||||
|
autoGainControlSetting.setValue(false);
|
||||||
|
echoCancellationSetting.setValue(true);
|
||||||
|
noiseSuppressionSetting.setValue(true);
|
||||||
|
|
||||||
|
const ecConnectionFactory = new ECConnectionFactory(
|
||||||
|
mockClient,
|
||||||
|
"!roomid:example.org",
|
||||||
|
mockMediaDevices({}),
|
||||||
|
new BehaviorSubject<ProcessorState>({
|
||||||
|
supported: true,
|
||||||
|
processor: undefined,
|
||||||
|
}),
|
||||||
|
undefined,
|
||||||
|
false,
|
||||||
|
);
|
||||||
|
ecConnectionFactory.createConnection(
|
||||||
|
testScope,
|
||||||
|
exampleTransport,
|
||||||
|
ownMemberMock,
|
||||||
|
logger,
|
||||||
|
);
|
||||||
|
|
||||||
|
expect(RoomConstructor).toHaveBeenCalledWith(
|
||||||
|
expect.objectContaining({
|
||||||
|
audioCaptureDefaults: expect.objectContaining({
|
||||||
|
autoGainControl: false,
|
||||||
|
}),
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
afterEach(() => {
|
afterEach(() => {
|
||||||
testScope.end();
|
testScope.end();
|
||||||
fetchMock.reset();
|
fetchMock.reset();
|
||||||
|
|||||||
@@ -35,11 +35,7 @@ vi.mock("../widget", () => ({
|
|||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
it.each([
|
it.each([[MatrixRTCMode.Compatibility], [MatrixRTCMode.Matrix_2_0]])(
|
||||||
[MatrixRTCMode.Legacy],
|
|
||||||
[MatrixRTCMode.Compatibility],
|
|
||||||
[MatrixRTCMode.Matrix_2_0],
|
|
||||||
])(
|
|
||||||
"expect leave when ElementWidgetActions.HangupCall is called (%s mode)",
|
"expect leave when ElementWidgetActions.HangupCall is called (%s mode)",
|
||||||
async (mode) => {
|
async (mode) => {
|
||||||
const pr = Promise.withResolvers<string>();
|
const pr = Promise.withResolvers<string>();
|
||||||
|
|||||||
+43
-49
@@ -7,31 +7,31 @@ Please see LICENSE in the repository root for full details.
|
|||||||
|
|
||||||
import { describe, test } from "vitest";
|
import { describe, test } from "vitest";
|
||||||
|
|
||||||
import { createLayoutModeSwitch } from "./LayoutSwitch";
|
import { createLayoutSwitchViewModel } from "./LayoutSwitchViewModel";
|
||||||
import { testScope, withTestScheduler } from "../../utils/test";
|
import { testScope, withTestScheduler } from "../utils/test";
|
||||||
|
|
||||||
function testLayoutSwitch({
|
function testLayoutSwitch({
|
||||||
windowMode = "n",
|
windowMode = "n",
|
||||||
hasScreenShares = "n",
|
hasScreenShares = "n",
|
||||||
userSelection = "",
|
userSelection = "",
|
||||||
expectedGridMode,
|
expectedLayout,
|
||||||
}: {
|
}: {
|
||||||
windowMode?: string;
|
windowMode?: string;
|
||||||
hasScreenShares?: string;
|
hasScreenShares?: string;
|
||||||
userSelection?: string;
|
userSelection?: string;
|
||||||
expectedGridMode: string;
|
expectedLayout: string;
|
||||||
}): void {
|
}): void {
|
||||||
withTestScheduler(({ behavior, schedule, expectObservable }) => {
|
withTestScheduler(({ behavior, schedule, expectObservable }) => {
|
||||||
const { gridMode$, setGridMode } = createLayoutModeSwitch(
|
const { layout$, setLayout } = createLayoutSwitchViewModel(
|
||||||
testScope(),
|
testScope(),
|
||||||
behavior(windowMode, { n: "normal", N: "narrow", f: "flat" }),
|
behavior(windowMode, { n: "normal", N: "narrow", f: "flat" }),
|
||||||
behavior(hasScreenShares, { y: true, n: false }),
|
behavior(hasScreenShares, { y: true, n: false }),
|
||||||
);
|
);
|
||||||
schedule(userSelection, {
|
schedule(userSelection, {
|
||||||
g: () => setGridMode("grid"),
|
g: () => setLayout("grid"),
|
||||||
s: () => setGridMode("spotlight"),
|
s: () => setLayout("spotlight"),
|
||||||
});
|
});
|
||||||
expectObservable(gridMode$).toBe(expectedGridMode, {
|
expectObservable(layout$).toBe(expectedLayout, {
|
||||||
g: "grid",
|
g: "grid",
|
||||||
s: "spotlight",
|
s: "spotlight",
|
||||||
});
|
});
|
||||||
@@ -39,94 +39,88 @@ function testLayoutSwitch({
|
|||||||
}
|
}
|
||||||
|
|
||||||
describe("default mode", () => {
|
describe("default mode", () => {
|
||||||
test("uses grid layout by default", () =>
|
test("uses grid layout in normal window", () =>
|
||||||
testLayoutSwitch({
|
testLayoutSwitch({
|
||||||
expectedGridMode: "g",
|
windowMode: " n",
|
||||||
|
expectedLayout: "g",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test("uses spotlight mode when window mode is flat", () =>
|
test("uses grid layout in flat window", () =>
|
||||||
testLayoutSwitch({
|
testLayoutSwitch({
|
||||||
windowMode: " f",
|
windowMode: " f",
|
||||||
expectedGridMode: "s",
|
expectedLayout: "g",
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
||||||
test("allows switching modes manually", () =>
|
test("allows switching modes manually", () =>
|
||||||
testLayoutSwitch({
|
testLayoutSwitch({
|
||||||
userSelection: " --sgs",
|
userSelection: " --sgs",
|
||||||
expectedGridMode: "g-sgs",
|
expectedLayout: "g-sgs",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test("switches to spotlight mode when there is a remote screen share", () =>
|
test("switches to spotlight mode when there is a remote screen share", () =>
|
||||||
testLayoutSwitch({
|
testLayoutSwitch({
|
||||||
hasScreenShares: " n--y",
|
hasScreenShares: "n--y",
|
||||||
expectedGridMode: "g--s",
|
expectedLayout: " g--s",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test("can manually switch to grid when there is a screenshare", () =>
|
test("can manually switch to grid when there is a screenshare", () =>
|
||||||
testLayoutSwitch({
|
testLayoutSwitch({
|
||||||
hasScreenShares: " n-y",
|
hasScreenShares: "n-y",
|
||||||
userSelection: " ---g",
|
userSelection: " ---g",
|
||||||
expectedGridMode: "g-sg",
|
expectedLayout: " g-sg",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test("auto-switches after manually selecting grid", () =>
|
test("auto-switches after manually selecting grid", () =>
|
||||||
testLayoutSwitch({
|
testLayoutSwitch({
|
||||||
// Two screenshares will happen in sequence. There is a screen share that
|
// Two screenshares will happen in sequence. There is a screen share that
|
||||||
// forces spotlight, then the user manually switches back to grid.
|
// forces spotlight, then the user manually switches back to grid.
|
||||||
hasScreenShares: " n-y-ny",
|
hasScreenShares: "n-y-ny",
|
||||||
userSelection: " ---g",
|
userSelection: " ---g",
|
||||||
expectedGridMode: "g-sg-s",
|
expectedLayout: " g-sg-s",
|
||||||
// If we did want to respect manual selection, the expectation would be: g-sg
|
// If we did want to respect manual selection, the expectation would be: g-sg
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test("switches back to grid mode when the remote screen share ends", () =>
|
test("switches back to grid mode when the remote screen share ends", () =>
|
||||||
testLayoutSwitch({
|
testLayoutSwitch({
|
||||||
hasScreenShares: " n--y--n",
|
hasScreenShares: "n--y--n",
|
||||||
expectedGridMode: "g--s--g",
|
expectedLayout: " g--s--g",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test("auto-switches to spotlight again after first screen share ends", () =>
|
test("auto-switches to spotlight again after first screen share ends", () =>
|
||||||
testLayoutSwitch({
|
testLayoutSwitch({
|
||||||
hasScreenShares: " nyny",
|
hasScreenShares: "nyny",
|
||||||
expectedGridMode: "gsgs",
|
expectedLayout: " gsgs",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test("switches manually to grid after screen share while manually in spotlight", () =>
|
test("switches manually to grid after screen share while manually in spotlight", () =>
|
||||||
testLayoutSwitch({
|
testLayoutSwitch({
|
||||||
// Initially, no one is sharing. Then the user manually switches to spotlight.
|
// Initially, no one is sharing. Then the user manually switches to spotlight.
|
||||||
// After a screen share starts, the user manually switches to grid.
|
// After a screen share starts, the user manually switches to grid.
|
||||||
hasScreenShares: " n-y",
|
hasScreenShares: "n-y",
|
||||||
userSelection: " -s-g",
|
userSelection: " -s-g",
|
||||||
expectedGridMode: "gs-g",
|
expectedLayout: " gs-g",
|
||||||
}));
|
|
||||||
|
|
||||||
test("auto-switches to spotlight when in flat window mode", () =>
|
|
||||||
testLayoutSwitch({
|
|
||||||
// First normal, then narrow, then flat.
|
|
||||||
windowMode: " nNf",
|
|
||||||
expectedGridMode: "g-s",
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test("allows switching modes manually when in flat window mode", () =>
|
test("allows switching modes manually when in flat window mode", () =>
|
||||||
testLayoutSwitch({
|
testLayoutSwitch({
|
||||||
// Window becomes flat, then user switches to grid and back.
|
// Window becomes flat, then user switches to spotlight and back.
|
||||||
// Finally the window returns to a normal shape.
|
// Finally the window returns to a normal shape.
|
||||||
windowMode: " nf--n",
|
windowMode: " nf--n",
|
||||||
userSelection: " --gs",
|
userSelection: " --sg",
|
||||||
expectedGridMode: "gsgsg",
|
expectedLayout: "g-sg",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test("stays in spotlight while there are screen shares even when window mode changes", () =>
|
test("switches to grid when in flat window mode even when there are screen shares", () =>
|
||||||
testLayoutSwitch({
|
testLayoutSwitch({
|
||||||
windowMode: " nfn",
|
windowMode: " nf",
|
||||||
hasScreenShares: " y",
|
hasScreenShares: "y",
|
||||||
expectedGridMode: "s",
|
expectedLayout: " sg",
|
||||||
}));
|
}));
|
||||||
|
|
||||||
test("ignores end of screen share until window mode returns to normal", () =>
|
test("ignores screen share until window mode returns to normal", () =>
|
||||||
testLayoutSwitch({
|
testLayoutSwitch({
|
||||||
windowMode: " nf-n",
|
windowMode: " f-n",
|
||||||
hasScreenShares: " y-n",
|
hasScreenShares: "ny-n",
|
||||||
expectedGridMode: "s--g",
|
expectedLayout: " g-sg",
|
||||||
}));
|
}));
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2025 Element Creations Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import {
|
||||||
|
combineLatest,
|
||||||
|
map,
|
||||||
|
Subject,
|
||||||
|
startWith,
|
||||||
|
skipWhile,
|
||||||
|
switchAll,
|
||||||
|
} from "rxjs";
|
||||||
|
|
||||||
|
import { type WindowMode } from "./CallViewModel/CallViewModel.ts";
|
||||||
|
import { constant, type Behavior } from "./Behavior.ts";
|
||||||
|
import { type ObservableScope } from "./ObservableScope.ts";
|
||||||
|
|
||||||
|
export type LayoutMode = "spotlight" | "grid";
|
||||||
|
|
||||||
|
export interface LayoutSwitchViewModel {
|
||||||
|
/**
|
||||||
|
* The layout mode of the call's media tiles.
|
||||||
|
*/
|
||||||
|
layout$: Behavior<LayoutMode>;
|
||||||
|
setLayout: (value: LayoutMode) => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Creates a layout mode switch that allows switching between grid and spotlight layouts.
|
||||||
|
* The actual layout mode might switch automatically to spotlight if there is a
|
||||||
|
* remote screen share active or if the window mode is flat.
|
||||||
|
*
|
||||||
|
* @param scope - The observable scope to manage subscriptions.
|
||||||
|
* @param windowMode$ - The current window mode.
|
||||||
|
* @param hasRemoteScreenShares$ - A behavior indicating if there are remote screen shares active.
|
||||||
|
*/
|
||||||
|
export function createLayoutSwitchViewModel(
|
||||||
|
scope: ObservableScope,
|
||||||
|
windowMode$: Behavior<WindowMode>,
|
||||||
|
hasRemoteScreenShares$: Behavior<boolean>,
|
||||||
|
): LayoutSwitchViewModel {
|
||||||
|
const userSelection$ = new Subject<LayoutMode>();
|
||||||
|
// Callback to set the layout desired by the user.
|
||||||
|
// Notice that this is only a preference, the actual layout can be overridden
|
||||||
|
// if there is a remote screen share active.
|
||||||
|
const setLayout = (value: LayoutMode): void => userSelection$.next(value);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The natural layout - the layout that the interface would prefer to be in,
|
||||||
|
* not accounting for the user's manual selections.
|
||||||
|
*/
|
||||||
|
const naturalLayout$ = scope.behavior<LayoutMode>(
|
||||||
|
combineLatest(
|
||||||
|
[hasRemoteScreenShares$, windowMode$],
|
||||||
|
(hasRemoteScreenShares, windowMode) => {
|
||||||
|
// When the window is flat (as with a phone in landscape orientation),
|
||||||
|
// grid is preferable as there's usually more than enough horizontal
|
||||||
|
// space to fit in some grid tiles on the side.
|
||||||
|
if (windowMode === "flat") return "grid";
|
||||||
|
// When there are screen shares, spotlight is a better experience. We
|
||||||
|
// want them to be big and readable.
|
||||||
|
return hasRemoteScreenShares ? "spotlight" : "grid";
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The layout mode of the call's media tiles.
|
||||||
|
*/
|
||||||
|
const layout$ = scope.behavior<LayoutMode>(
|
||||||
|
// Whenever the user makes a selection, we enter a new mode of behavior:
|
||||||
|
userSelection$.pipe(
|
||||||
|
map((selection) => {
|
||||||
|
if (selection === "grid")
|
||||||
|
// The user has selected grid. Start by respecting their choice, but
|
||||||
|
// then follow the natural mode again as soon as it matches.
|
||||||
|
return naturalLayout$.pipe(
|
||||||
|
skipWhile((naturalMode) => naturalMode !== selection),
|
||||||
|
startWith(selection),
|
||||||
|
);
|
||||||
|
|
||||||
|
// The user has selected spotlight. If this matches the natural layout,
|
||||||
|
// then follow the natural layout going forward.
|
||||||
|
return selection === naturalLayout$.value
|
||||||
|
? naturalLayout$
|
||||||
|
: constant(selection);
|
||||||
|
}),
|
||||||
|
// Initially the mode of behavior is to just follow the natural layout.
|
||||||
|
startWith(naturalLayout$),
|
||||||
|
// Switch between each mode of behavior.
|
||||||
|
switchAll(),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
return { layout$, setLayout };
|
||||||
|
}
|
||||||
@@ -10,19 +10,19 @@ import { type BehaviorSubject } from "rxjs";
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
type Alignment,
|
type Alignment,
|
||||||
type OneOnOneLandscapeLayout,
|
type OneOnOneDesktopLayout,
|
||||||
type OneOnOneLandscapeLayoutMedia,
|
type OneOnOneDesktopLayoutMedia,
|
||||||
} from "./layout-types";
|
} from "./layout-types";
|
||||||
import { type TileStore } from "./TileStore";
|
import { type TileStore } from "./TileStore";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produces a one-on-one landscape layout with the given media.
|
* Produces a one-on-one desktop layout with the given media.
|
||||||
*/
|
*/
|
||||||
export function oneOnOneLandscapeLayout(
|
export function oneOnOneDesktopLayout(
|
||||||
media: OneOnOneLandscapeLayoutMedia,
|
media: OneOnOneDesktopLayoutMedia,
|
||||||
pipAlignment$: BehaviorSubject<Alignment>,
|
pipAlignment$: BehaviorSubject<Alignment>,
|
||||||
prevTiles: TileStore,
|
prevTiles: TileStore,
|
||||||
): [OneOnOneLandscapeLayout, TileStore] {
|
): [OneOnOneDesktopLayout, TileStore] {
|
||||||
const update = prevTiles.from(2);
|
const update = prevTiles.from(2);
|
||||||
update.registerGridTile(media.pip);
|
update.registerGridTile(media.pip);
|
||||||
update.registerGridTile(media.spotlight);
|
update.registerGridTile(media.spotlight);
|
||||||
@@ -10,21 +10,21 @@ import { type BehaviorSubject } from "rxjs";
|
|||||||
|
|
||||||
import {
|
import {
|
||||||
type Alignment,
|
type Alignment,
|
||||||
type OneOnOnePortraitLayout,
|
type OneOnOneMobileLayout,
|
||||||
type OneOnOnePortraitLayoutMedia,
|
type OneOnOneMobileLayoutMedia,
|
||||||
} from "./layout-types";
|
} from "./layout-types";
|
||||||
import { type TileStore } from "./TileStore";
|
import { type TileStore } from "./TileStore";
|
||||||
import { type Behavior } from "./Behavior";
|
import { type Behavior } from "./Behavior";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Produces a one-on-one portrait layout with the given media.
|
* Produces a one-on-one mobile layout with the given media.
|
||||||
*/
|
*/
|
||||||
export function oneOnOnePortraitLayout(
|
export function oneOnOneMobileLayout(
|
||||||
media: OneOnOnePortraitLayoutMedia,
|
media: OneOnOneMobileLayoutMedia,
|
||||||
pipSize$: Behavior<"sm" | "lg">,
|
pipSize$: Behavior<"sm" | "lg">,
|
||||||
pipAlignment$: BehaviorSubject<Alignment>,
|
pipAlignment$: BehaviorSubject<Alignment>,
|
||||||
prevTiles: TileStore,
|
prevTiles: TileStore,
|
||||||
): [OneOnOnePortraitLayout, TileStore] {
|
): [OneOnOneMobileLayout, TileStore] {
|
||||||
const update = prevTiles.from(media.pip === undefined ? 0 : 1);
|
const update = prevTiles.from(media.pip === undefined ? 0 : 1);
|
||||||
update.registerSpotlight([media.spotlight], true, "transparent");
|
update.registerSpotlight([media.spotlight], true, "transparent");
|
||||||
if (media.pip !== undefined) update.registerGridTile(media.pip);
|
if (media.pip !== undefined) update.registerGridTile(media.pip);
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2026 Element Creations Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
export type Service =
|
||||||
|
| { name: "encryption-keys" }
|
||||||
|
| { name: "reactions" }
|
||||||
|
| { name: "screen-sharing" }
|
||||||
|
| { name: "local-media" }
|
||||||
|
| {
|
||||||
|
name: "remote-media";
|
||||||
|
/**
|
||||||
|
* The number of users affected, for the purpose of pluralising the
|
||||||
|
* strings.
|
||||||
|
*/
|
||||||
|
count: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface ServiceInterruptionsViewModel {
|
||||||
|
/**
|
||||||
|
* A non-empty array of services which are temporarily unavailable.
|
||||||
|
*/
|
||||||
|
unavailable: Service[];
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2026 Element Creations Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { test, expect } from "vitest";
|
||||||
|
import {
|
||||||
|
type Alignment,
|
||||||
|
layoutShallowEquals,
|
||||||
|
type Layout,
|
||||||
|
} from "./layout-types";
|
||||||
|
import {
|
||||||
|
type SpotlightTileViewModel,
|
||||||
|
type GridTileViewModel,
|
||||||
|
} from "./TileViewModel";
|
||||||
|
import { BehaviorSubject } from "rxjs";
|
||||||
|
|
||||||
|
const spotlightTile = {} as unknown as SpotlightTileViewModel;
|
||||||
|
const gridTile = {} as unknown as GridTileViewModel;
|
||||||
|
const pipAlignment$ = new BehaviorSubject<Alignment>({
|
||||||
|
inline: "end",
|
||||||
|
block: "end",
|
||||||
|
});
|
||||||
|
|
||||||
|
const spotlightExpanded: Layout = {
|
||||||
|
type: "spotlight-expanded",
|
||||||
|
spotlight: spotlightTile,
|
||||||
|
pipAlignment$,
|
||||||
|
};
|
||||||
|
|
||||||
|
const spotlightPortrait: Layout = {
|
||||||
|
type: "spotlight-portrait",
|
||||||
|
spotlight: spotlightTile,
|
||||||
|
grid: [gridTile],
|
||||||
|
setVisibleTiles: () => {},
|
||||||
|
};
|
||||||
|
|
||||||
|
test("layoutShallowEquals considers a layout to be equal to its shallow clone", () =>
|
||||||
|
expect(layoutShallowEquals(spotlightExpanded, { ...spotlightExpanded })).toBe(
|
||||||
|
true,
|
||||||
|
));
|
||||||
|
|
||||||
|
test("layoutShallowEquals detects a missing key", () => {
|
||||||
|
expect(
|
||||||
|
layoutShallowEquals(spotlightExpanded, {
|
||||||
|
...spotlightExpanded,
|
||||||
|
pip: gridTile,
|
||||||
|
}),
|
||||||
|
).toBe(false);
|
||||||
|
expect(
|
||||||
|
layoutShallowEquals(
|
||||||
|
{ ...spotlightExpanded, pip: gridTile },
|
||||||
|
spotlightExpanded,
|
||||||
|
),
|
||||||
|
).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
test("layoutShallowEquals considers grid arrays with equal contents to be equal", () =>
|
||||||
|
expect(
|
||||||
|
layoutShallowEquals(spotlightPortrait, {
|
||||||
|
...spotlightPortrait,
|
||||||
|
grid: [...spotlightPortrait.grid],
|
||||||
|
}),
|
||||||
|
).toBe(true));
|
||||||
|
|
||||||
|
test("layoutShallowEquals detects grid arrays with different contents", () =>
|
||||||
|
expect(
|
||||||
|
layoutShallowEquals(spotlightPortrait, {
|
||||||
|
...spotlightPortrait,
|
||||||
|
grid: [...spotlightPortrait.grid, gridTile],
|
||||||
|
}),
|
||||||
|
).toBe(false));
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user