Commit Graph

2330 Commits

Author SHA1 Message Date
Robin
3ffb118dc7 Modernize how we use React contexts (#3359)
* Replace useContext with use

The docs recommend the use hook because it is simpler and allows itself to be called conditionally.

* Simplify our context providers

React 19 lets you omit the '.Provider' bit.
2025-06-24 10:48:35 +02:00
Timo
a507bcde90 Add onBackButtonPressed controls api (#3357)
* Add `onBackButtonPressed` controls api

* Update docs/controls.md

Co-authored-by: Robin <robin@robin.town>

---------

Co-authored-by: Robin <robin@robin.town>
2025-06-24 08:46:04 +00:00
Robin
5e2e94d794 Refactor media devices to live outside React as Observables (#3334)
* Refactor media devices to live outside React as Observables

This moves the media devices state out of React to further our transition to a MVVM architecture in which we can more easily model and store complex application state. I have created an AppViewModel to act as the overarching state holder for any future non-React state we end up creating, and the MediaDevices reside within this. We should move more application logic (including the CallViewModel itself) there in the future.

* Address review feedback

* Fixes from ios debugging session: (#3342)

- dont use preferred vs selected concept in controlled media. Its not needed since we dont use the id for actual browser media devices (the id's are not even actual browser media devices)
  - add more logging
  - add more conditions to not accidently set a deviceId that is not a browser deviceId but one provided via controlled.

---------

Co-authored-by: Timo <16718859+toger5@users.noreply.github.com>
2025-06-20 18:37:25 +02:00
Timo
1425de8726 Expose keep alive event configurarion in ec config and update defaults. (#3303) 2025-06-10 18:09:52 +02:00
Timo
02f3f1b71a Improvements to audio renderer codebase. (#3308)
* Improvements to audio renderer codebase.

* review
2025-06-10 13:00:21 +00:00
Timo
a596eb71a9 add onAudioPlaybackStarted callback for controls (#3309)
* add onAudioTrackReady callback for controls

* more details in controls.md for `onAudioPlaybackStarted`
2025-06-10 12:35:04 +02:00
Robin
c8a1cae18b Merge pull request #2874 from element-hq/renovate/major-react-monorepo
Update react monorepo to v19 (major)
2025-06-09 11:59:26 -04:00
Robin
4f1450aaf0 Replace react-use-clipboard with copy-to-clipboard
We didn't need the complexity of the (admittedly very small) React hook, and the package hasn't declared compatibility with React 19, so let's just switch to copying things manually via copy-to-clipboard.
2025-06-09 11:53:58 -04:00
Robin
8704b44b78 Update test snapshots for React 19 changes 2025-06-09 11:48:01 -04:00
Timo
34724b7a8c revert "custom compare logic" 2025-06-05 14:39:06 +02:00
Timo
b005f36ac7 custom compare logic 2025-06-05 14:36:43 +02:00
Robin
b0587fcfb3 Avoid reactivity bugs in how we track external state (#3316)
* Avoid reactivity bugs in how we track external state

Many of our hooks which attempt to bridge external state from an EventEmitter or EventTarget into React had subtle bugs which could cause them to fail to react to certain updates. The conditions necessary for triggering these bugs are explained by the tests that I've included.

In the majority of cases, I don't think we were triggering these bugs in practice. They could've become problems if we refactored our components in certain ways. The one concrete case I'm aware of in which we actually triggered such a bug was the race condition with the useRoomEncryptionSystem shared secret logic (addressed by a1110af6d5).

But, particularly with all the weird reactivity issues we're debugging this week, I think we need to eliminate the possibility that any of the bugs in these hooks are the cause of our current headaches.

* Reuse useTypedEventEmitterState in useLocalStorage

* Fix type error
2025-06-05 13:54:57 +02:00
Robin
15bcaef3a5 Use the same function for deep equality everywhere 2025-06-04 17:41:42 -04:00
Timo
3c831fc5e6 Fix react errors in settings tab (#3314)
* Fix react errors in settings tab

* review
2025-06-04 23:29:49 +02:00
Robin
929367c9ce Always render audio from the current set of participants
We forgot to tell React that we need the audio renderer to react to changes in the set of MatrixRTC participants; instead we had it referencing rtcSession.memberships non-reactively.

Now, I'm not 100% confident that this is going to fix the "speaking from the void" issues observed in the wild, because I can't reproduce them and, in my testing, the InCallView component always seemed to be rendered redundantly when the MatrixRTC participants change, even though we hadn't explicitly stated that it needs to react. (This makes sense as we haven't memoized the component.) But it's worth a shot.
2025-06-04 17:21:48 -04:00
Timo
2f3e0b419d Leave issue refactor (#3302)
* Simplify key local storage management.

* Refactor useLivekit to only ever connect to one room.
This change also tries to make the code more explicit so that we only do the things we really need to do and rely less on react updating everything correctly.

It also surfaces, that we are currently implementing useLivekit in a way, so that we can change the encryption system on the fly and recreate the room. I am not sure this is a case we need to support?

* simplify the useLivekit hook even more
This is possible because we concluded that we do not need to be able to hot reload the e2ee system.

* review

* linter

* Update src/room/InCallView.tsx

Co-authored-by: Robin <robin@robin.town>

---------

Co-authored-by: Robin <robin@robin.town>
2025-06-04 20:51:13 +00:00
Robin
40b351d76d Ignore spurious 'devicechange' events
This gives us the additional insurance of breaking the Safari media acquisition loop at the source by admitting that they can be spurious in practice. Safari, why!?
2025-06-04 11:23:20 -04:00
Robin
83bfb721e7 Break loop in acquiring media on Safari 2025-06-03 17:22:20 -04:00
Timo
87186058ab Only use ios platform logic when in controlled media device condition (#3295) 2025-05-30 12:03:22 +02:00
Robin
0661486676 Merge branch 'livekit' into renovate/major-compound 2025-05-28 18:07:30 -04:00
Robin
07a4244c05 Upgrade Compound Web to v7.12.0 2025-05-28 18:04:29 -04:00
Robin
3c3fce96e7 Upgrade to OpenTelemetry v2 SDKs
Necessitated by our minor version upgrade of @opentelemetry/exporter-trace-otlp-http.
2025-05-28 17:17:31 -04:00
Timo
a52b723414 code styling 2025-05-27 18:17:41 +02:00
Timo
a1110af6d5 Fix the actual leaving issue 2025-05-27 17:38:54 +02:00
Timo
b8951944ab start with a couple of more logs 2025-05-27 17:38:45 +02:00
Timo
5374342d98 Disable device switching when in controlled audio devices mode (#3290)
* Disable device switching when in controlled audio devices mode

* Temporarily switch matrix-js-sdk to robin/embedded-no-update-state

To allow us to test this change on Element X, which does not yet support the update_state action.

* Also add a check for controlled audio devices in useAudioContext

* use develop branch

* fix tests

---------

Co-authored-by: Robin <robin@robin.town>
2025-05-23 15:54:47 +00:00
Timo
f0403c80bc also add non deprecated audio url parameter 2025-05-22 19:18:04 +02:00
Timo
9f84a5cae0 Deprecate old naming and introduce new words 2025-05-22 18:58:18 +02:00
Timo
4eb867436a Merge branch 'livekit' into robin/audio-output-controls 2025-05-22 14:10:03 +02:00
Timo
ab9dfc75f0 Comment to explain the usage/impact of: controlledMediaDevices 2025-05-22 13:04:42 +02:00
Timo
a056a28423 review 2025-05-21 12:53:17 +02:00
Timo
435a7d0adb earpice -> earpiece 2025-05-20 16:37:14 +02:00
Timo
a1759a46de rename everything to controlledMediaDevices to make it consistent with the actual name in the url parameters (controlledOutput is now only used for the hook that provides the output handle) 2025-05-20 15:30:02 +02:00
Timo
1cf11b91c1 Back to translated button 2025-05-20 10:17:25 +02:00
Timo
0412629871 fix start with for output devices. 2025-05-20 10:14:08 +02:00
Timo
c11a37ca61 back to non translated label 2025-05-19 20:01:59 +02:00
Timo
fb95ba278e make the button prettty again 2025-05-19 19:59:35 +02:00
Timo
aa00a951b6 ITS A FORM NOOOOO 2025-05-19 19:56:12 +02:00
Timo
7fd7dc3794 use normal button 2025-05-19 19:52:08 +02:00
Timo
ed234a1ad1 change label on button 2025-05-19 19:44:19 +02:00
Timo
d7e0abc55c remove the whole button on click logic 2025-05-19 19:26:50 +02:00
Timo
e8c6d79a89 logger instead of native window picker 2025-05-19 19:20:26 +02:00
Timo
d94feaa8db smaller diff 2025-05-19 19:08:39 +02:00
Timo
6d0697cf2f inform ios about earpice mode 2025-05-19 18:44:48 +02:00
Timo
28246ef86b Update RTCSession configuration to non deprecated names. (#3267)
* Update RTCSession configuration to non deprecated names.

* bump js-sdk

* es2024 and array buffer adaptions

* Alternative without `createKeyMaterialFromBuffer`
2025-05-19 18:04:07 +02:00
Timo
5d6ec19ca0 Allow some controls to be set before the call view is loaded. 2025-05-19 14:14:08 +02:00
Timo
956b7fc480 actually test the impl 2025-05-19 13:42:13 +02:00
Timo
2946b307c2 fix no audio thinko. 2025-05-19 13:35:21 +02:00
Timo
c22e0cb7e2 better logging 2025-05-19 13:03:16 +02:00
Timo
7f4b0a33f6 isBluetooth -> isExternalHeadset 2025-05-16 17:06:54 +02:00