* 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>
20 lines
560 B
TypeScript
20 lines
560 B
TypeScript
/*
|
|
Copyright 2025 New Vector Ltd.
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|
Please see LICENSE in the repository root for full details.
|
|
*/
|
|
|
|
import { MediaDevices } from "./MediaDevices";
|
|
import { ViewModel } from "./ViewModel";
|
|
|
|
/**
|
|
* The top-level state holder for the application.
|
|
*/
|
|
export class AppViewModel extends ViewModel {
|
|
public readonly mediaDevices = new MediaDevices(this.scope);
|
|
|
|
// TODO: Move more application logic here. The CallViewModel, at the very
|
|
// least, ought to be accessible from this object.
|
|
}
|