Skip to content

Commit d24da18

Browse files
Half-Shotrenovate[bot]robintowntoger5fkwp
authored
Add media hints for notification events. (#3493)
* Add media hints for notification events. * Prevent showing calling view when disconnected from Livekit. (#3491) * Refactor disconnection handling * Use "unknown" * Update signature * Add tests * Expose livekitConnectionState directly * fix whoopsie * Update dependency livekit-client to v2.15.7 (#3496) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> * Fix the interactivity of buttons while reconnecting or in earpiece mode (#3486) * Fix the interactivity of buttons while reconnecting or in earpiece mode When we're in one of these modes, we need to ensure that everything above the overlay (the header and footer buttons) is interactive, while everything obscured by the overlay (the media tiles) is non-interactive and removed from the accessibility tree. It's not a very easy task to trap focus *outside* an element, so the best solution I could come up with is to set tabindex="-1" manually on all interactive elements belonging to the media tiles. * Write a Playwright test for reconnecting * fix lints Signed-off-by: Timo K <[email protected]> * fix test Signed-off-by: Timo K <[email protected]> * enable http2 for matrx-rtc host to allow the jwt service to talk to the SFU * remove rate limit for delayed events * more time to connect to livekit SFU * Due to a Firefox issue we set the start anchor for the tab test to the Mute microphone button * adapt to most recent Element Web version * Use the "End call" button as proofe for a started call * Currrenty disabled due to recent Element Web - not indicating the number of participants - bypassing Lobby * linting * disable 'can only interact with header and footer while reconnecting' for firefox --------- Signed-off-by: Timo K <[email protected]> Co-authored-by: Timo <[email protected]> Co-authored-by: Timo K <[email protected]> Co-authored-by: fkwp <[email protected]> * Log when a track is unpublished or runs into an error (#3495) * default mute states (unmuted!) in widget mode (embedded + intent) (#3494) * default mute states (unmuted!) in widget mode (embedded + intent) Signed-off-by: Timo K <[email protected]> * review Signed-off-by: Timo K <[email protected]> * introduce a cache for the url params. Signed-off-by: Timo K <[email protected]> * Add an option to skip the cache. Signed-off-by: Timo K <[email protected]> --------- Signed-off-by: Timo K <[email protected]> * Apply new hint code * missed a bit * fix intent * Automatically update intent on mute change * update packages * lint * Fix tests * fix merge fails --------- Signed-off-by: Timo K <[email protected]> Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Robin <[email protected]> Co-authored-by: Timo <[email protected]> Co-authored-by: Timo K <[email protected]> Co-authored-by: fkwp <[email protected]>
1 parent 342dd2e commit d24da18

File tree

5 files changed

+69
-38
lines changed

5 files changed

+69
-38
lines changed

src/UrlParams.ts

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ Please see LICENSE in the repository root for full details.
88
import { useMemo } from "react";
99
import { useLocation } from "react-router-dom";
1010
import { logger } from "matrix-js-sdk/lib/logger";
11-
import { type RTCNotificationType } from "matrix-js-sdk/lib/matrixrtc";
11+
import {
12+
type RTCCallIntent,
13+
type RTCNotificationType,
14+
} from "matrix-js-sdk/lib/matrixrtc";
1215
import { pickBy } from "lodash-es";
1316

1417
import { Config } from "./config/Config";
@@ -26,7 +29,9 @@ export enum UserIntent {
2629
StartNewCall = "start_call",
2730
JoinExistingCall = "join_existing",
2831
StartNewCallDM = "start_call_dm",
32+
StartNewCallDMVoice = "start_call_dm_voice",
2933
JoinExistingCallDM = "join_existing_dm",
34+
JoinExistingCallDMVoice = "join_existing_dm_voice",
3035
Unknown = "unknown",
3136
}
3237

@@ -227,6 +232,12 @@ export interface UrlConfiguration {
227232
* - auto-dismiss the call widget once the notification lifetime expires on the receivers side.
228233
*/
229234
waitForCallPickup: boolean;
235+
236+
callIntent?: RTCCallIntent;
237+
}
238+
interface IntentAndPlatformDerivedConfiguration {
239+
defaultAudioEnabled?: boolean;
240+
defaultVideoEnabled?: boolean;
230241
}
231242
interface IntentAndPlatformDerivedConfiguration {
232243
defaultAudioEnabled?: boolean;
@@ -395,22 +406,31 @@ export const computeUrlParams = (search = "", hash = ""): UrlParams => {
395406
switch (intent) {
396407
case UserIntent.StartNewCall:
397408
intentPreset.skipLobby = false;
409+
intentPreset.callIntent = "video";
398410
break;
399411
case UserIntent.JoinExistingCall:
400412
// On desktop this will be overridden based on which button was used to join the call
401413
intentPreset.skipLobby = false;
414+
intentPreset.callIntent = "video";
402415
break;
416+
case UserIntent.StartNewCallDMVoice:
417+
intentPreset.callIntent = "audio";
418+
// Fall through
403419
case UserIntent.StartNewCallDM:
404420
intentPreset.skipLobby = true;
405421
intentPreset.sendNotificationType = "ring";
406422
intentPreset.autoLeaveWhenOthersLeft = true;
407423
intentPreset.waitForCallPickup = true;
408-
424+
intentPreset.callIntent = intentPreset.callIntent ?? "video";
409425
break;
426+
case UserIntent.JoinExistingCallDMVoice:
427+
intentPreset.callIntent = "audio";
428+
// Fall through
410429
case UserIntent.JoinExistingCallDM:
411430
// On desktop this will be overridden based on which button was used to join the call
412431
intentPreset.skipLobby = true;
413432
intentPreset.autoLeaveWhenOthersLeft = true;
433+
intentPreset.callIntent = intentPreset.callIntent ?? "video";
414434
break;
415435
// Non widget usecase defaults
416436
default:
@@ -447,6 +467,11 @@ export const computeUrlParams = (search = "", hash = ""): UrlParams => {
447467
intentAndPlatformDerivedConfiguration.defaultAudioEnabled = true;
448468
intentAndPlatformDerivedConfiguration.defaultVideoEnabled = true;
449469
break;
470+
case UserIntent.StartNewCallDMVoice:
471+
case UserIntent.JoinExistingCallDMVoice:
472+
intentAndPlatformDerivedConfiguration.defaultAudioEnabled = true;
473+
intentAndPlatformDerivedConfiguration.defaultVideoEnabled = false;
474+
break;
450475
}
451476
}
452477

src/room/GroupCallView.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,16 @@ export const GroupCallView: FC<Props> = ({
128128
// eslint-disable-next-line react-hooks/exhaustive-deps
129129
}, []);
130130

131+
// Update our member event when our mute state changes.
132+
useEffect(() => {
133+
if (!isJoined) {
134+
return;
135+
}
136+
void rtcSession.updateCallIntent(
137+
muteStates.video.enabled ? "video" : "audio",
138+
);
139+
}, [rtcSession, isJoined, muteStates.video.enabled]);
140+
131141
useEffect(() => {
132142
logger.info("[Lifecycle] GroupCallView Component mounted");
133143
return (): void => {

src/rtcSessionHelpers.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,13 @@ export async function enterRTCSession(
120120
const { features, matrix_rtc_session: matrixRtcSessionConfig } = Config.get();
121121
const useDeviceSessionMemberEvents =
122122
features?.feature_use_device_session_member_events;
123+
const { sendNotificationType: notificationType, callIntent } = getUrlParams();
123124
rtcSession.joinRoomSession(
124125
await makePreferredLivekitFoci(rtcSession, livekitAlias),
125126
makeActiveFocus(),
126127
{
127-
notificationType: getUrlParams().sendNotificationType,
128+
notificationType,
129+
callIntent,
128130
useNewMembershipManager,
129131
manageMediaKeys: encryptMedia,
130132
...(useDeviceSessionMemberEvents !== undefined && {

src/utils/test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,8 @@ export class MockRTCSession extends TypedEventEmitter<
360360
return this;
361361
}
362362

363+
public updateCallIntent = vitest.fn();
364+
363365
private _membershipStatus = Status.Connected;
364366
public get membershipStatus(): Status {
365367
return this._membershipStatus;

yarn.lock

Lines changed: 27 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2793,10 +2793,10 @@ __metadata:
27932793
languageName: node
27942794
linkType: hard
27952795

2796-
"@matrix-org/matrix-sdk-crypto-wasm@npm:^15.1.0":
2797-
version: 15.1.0
2798-
resolution: "@matrix-org/matrix-sdk-crypto-wasm@npm:15.1.0"
2799-
checksum: 10c0/19edc6d0045ff49fad8d77b6e561cee994f7513f8c18a7176ae2d3f0116c1a91980e02d10300b09c2b72dea4da4a8c3392f2bf1752057f2d6b53030a056d76d8
2796+
"@matrix-org/matrix-sdk-crypto-wasm@npm:^15.3.0":
2797+
version: 15.3.0
2798+
resolution: "@matrix-org/matrix-sdk-crypto-wasm@npm:15.3.0"
2799+
checksum: 10c0/45628f36b7b0e54a8777ae67a7233dbdf3e3cf14e0d95d21f62f89a7ea7e3f907232f1eb7b1262193b1e227759fad47af829dcccc103ded89011f13c66f01d76
28002800
languageName: node
28012801
linkType: hard
28022802

@@ -5290,13 +5290,6 @@ __metadata:
52905290
languageName: node
52915291
linkType: hard
52925292

5293-
"@types/retry@npm:0.12.0":
5294-
version: 0.12.0
5295-
resolution: "@types/retry@npm:0.12.0"
5296-
checksum: 10c0/7c5c9086369826f569b83a4683661557cab1361bac0897a1cefa1a915ff739acd10ca0d62b01071046fe3f5a3f7f2aec80785fe283b75602dc6726781ea3e328
5297-
languageName: node
5298-
linkType: hard
5299-
53005293
"@types/sdp-transform@npm:^2.4.5":
53015294
version: 2.4.10
53025295
resolution: "@types/sdp-transform@npm:2.4.10"
@@ -9528,6 +9521,13 @@ __metadata:
95289521
languageName: node
95299522
linkType: hard
95309523

9524+
"is-network-error@npm:^1.1.0":
9525+
version: 1.3.0
9526+
resolution: "is-network-error@npm:1.3.0"
9527+
checksum: 10c0/3e85a69e957988db66d5af5412efdd531a5a63e150d1bdd5647cfd4dc54fd89b1dbdd472621f8915233c3176ba1e6922afa8a51a9e363ba4693edf96a294f898
9528+
languageName: node
9529+
linkType: hard
9530+
95319531
"is-number-object@npm:^1.1.1":
95329532
version: 1.1.1
95339533
resolution: "is-number-object@npm:1.1.1"
@@ -10298,11 +10298,11 @@ __metadata:
1029810298
linkType: hard
1029910299

1030010300
"matrix-js-sdk@github:matrix-org/matrix-js-sdk#head=develop":
10301-
version: 37.13.0
10302-
resolution: "matrix-js-sdk@https://github.com/matrix-org/matrix-js-sdk.git#commit=2f1d654f14be8dd03896e9e76f12017b6f9eec1c"
10301+
version: 38.3.0
10302+
resolution: "matrix-js-sdk@https://github.com/matrix-org/matrix-js-sdk.git#commit=41d70d0b5d3f0eba92686f8089cb329d875b26b5"
1030310303
dependencies:
1030410304
"@babel/runtime": "npm:^7.12.5"
10305-
"@matrix-org/matrix-sdk-crypto-wasm": "npm:^15.1.0"
10305+
"@matrix-org/matrix-sdk-crypto-wasm": "npm:^15.3.0"
1030610306
another-json: "npm:^0.2.0"
1030710307
bs58: "npm:^6.0.0"
1030810308
content-type: "npm:^1.0.4"
@@ -10311,11 +10311,11 @@ __metadata:
1031110311
matrix-events-sdk: "npm:0.0.1"
1031210312
matrix-widget-api: "npm:^1.10.0"
1031310313
oidc-client-ts: "npm:^3.0.1"
10314-
p-retry: "npm:4"
10314+
p-retry: "npm:7"
1031510315
sdp-transform: "npm:^2.14.1"
1031610316
unhomoglyph: "npm:^1.0.6"
10317-
uuid: "npm:11"
10318-
checksum: 10c0/ecd019c677c272c5598617dcde407dbe4b1b11460863b2a577e33f3fd8732c9d9073ec0221b471ec1eb24e2839eec20728db7f92c9348be83126547286e50805
10317+
uuid: "npm:13"
10318+
checksum: 10c0/b48528fec573f3e14d1297f360a56d52d7f313da0d4cf82ab51e4c29798b86995b8a6bd72409779746e7bcf02949bc2788bffa9aba276bfb1a76dbcbe89900a0
1031910319
languageName: node
1032010320
linkType: hard
1032110321

@@ -10922,13 +10922,12 @@ __metadata:
1092210922
languageName: node
1092310923
linkType: hard
1092410924

10925-
"p-retry@npm:4":
10926-
version: 4.6.2
10927-
resolution: "p-retry@npm:4.6.2"
10925+
"p-retry@npm:7":
10926+
version: 7.0.0
10927+
resolution: "p-retry@npm:7.0.0"
1092810928
dependencies:
10929-
"@types/retry": "npm:0.12.0"
10930-
retry: "npm:^0.13.1"
10931-
checksum: 10c0/d58512f120f1590cfedb4c2e0c42cb3fa66f3cea8a4646632fcb834c56055bb7a6f138aa57b20cc236fb207c9d694e362e0b5c2b14d9b062f67e8925580c73b0
10929+
is-network-error: "npm:^1.1.0"
10930+
checksum: 10c0/3c090ac72bbe00fd2f062ee6178c44f7302f298936ab2290a458575e73650e7834b556beb2b09fa9fbebedab2ec3358cb474c09710cf828972b670c3c0cb89e4
1093210931
languageName: node
1093310932
linkType: hard
1093410933

@@ -12230,13 +12229,6 @@ __metadata:
1223012229
languageName: node
1223112230
linkType: hard
1223212231

12233-
"retry@npm:^0.13.1":
12234-
version: 0.13.1
12235-
resolution: "retry@npm:0.13.1"
12236-
checksum: 10c0/9ae822ee19db2163497e074ea919780b1efa00431d197c7afdb950e42bf109196774b92a49fc9821f0b8b328a98eea6017410bfc5e8a0fc19c85c6d11adb3772
12237-
languageName: node
12238-
linkType: hard
12239-
1224012232
"reusify@npm:^1.0.4":
1224112233
version: 1.1.0
1224212234
resolution: "reusify@npm:1.1.0"
@@ -13766,12 +13758,12 @@ __metadata:
1376613758
languageName: node
1376713759
linkType: hard
1376813760

13769-
"uuid@npm:11":
13770-
version: 11.0.5
13771-
resolution: "uuid@npm:11.0.5"
13761+
"uuid@npm:13":
13762+
version: 13.0.0
13763+
resolution: "uuid@npm:13.0.0"
1377213764
bin:
13773-
uuid: dist/esm/bin/uuid
13774-
checksum: 10c0/6f59f0c605e02c14515401084ca124b9cb462b4dcac866916a49862bcf831874508a308588c23a7718269226ad11a92da29b39d761ad2b86e736623e3a33b6e7
13765+
uuid: dist-node/bin/uuid
13766+
checksum: 10c0/950e4c18d57fef6c69675344f5700a08af21e26b9eff2bf2180427564297368c538ea11ac9fb2e6528b17fc3966a9fd2c5049361b0b63c7d654f3c550c9b3d67
1377513767
languageName: node
1377613768
linkType: hard
1377713769

0 commit comments

Comments
 (0)