feat(call): add sound effects and incoming call notification UI

- Implemented sound management for call events including mute, unmute, deafen, undeafen, call joined, call depart, and dialing sounds.
- Created a new CallSounds class to handle sound playback and state management.
- Added IncomingCallNotification component to display incoming call alerts with caller information and action buttons.
- Styled the incoming call notification using vanilla-extract CSS for animations and layout.
- Integrated sound playback for incoming calls with a 15-second threshold for dialing sound.
This commit is contained in:
2026-02-05 03:24:18 +11:00
parent cd912025f1
commit 1a452f52ca
27 changed files with 1888 additions and 179 deletions
+10 -9
View File
@@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { useCallback, useEffect, useState } from 'react';
import { MatrixEvent, Room, RoomStateEvent } from 'matrix-js-sdk';
import { useMatrixClient } from '../../hooks/useMatrixClient';
@@ -25,20 +26,20 @@ function getActiveCallMembers(room: Room): CallMember[] {
try {
const stateEvents = room.currentState.getStateEvents(CALL_MEMBER_EVENT_TYPE);
for (const event of stateEvents) {
stateEvents.forEach((event) => {
const content = event.getContent();
const userId = event.getStateKey();
if (!userId || !content['m.calls']) continue;
if (!userId || !content['m.calls']) return;
const calls = content['m.calls'];
if (!Array.isArray(calls)) continue;
if (!Array.isArray(calls)) return;
for (const call of calls) {
calls.forEach((call) => {
const devices = call['m.devices'];
if (!Array.isArray(devices)) continue;
if (!Array.isArray(devices)) return;
for (const device of devices) {
devices.forEach((device) => {
const expiresTs = device.expires_ts || 0;
// Check if the call membership is still valid (not expired)
@@ -50,9 +51,9 @@ function getActiveCallMembers(room: Room): CallMember[] {
expiresTs,
});
}
}
}
}
});
});
});
} catch (e) {
console.error('Error reading call member events:', e);
}