mirror of
https://github.com/vector-im/element-call.git
synced 2024-11-27 00:48:06 +08:00
Make local field based on view model class not observable
This commit is contained in:
parent
efee27ad25
commit
eec44702f7
@ -317,6 +317,7 @@ class ScreenShare {
|
||||
this.participant.asObservable(),
|
||||
encryptionSystem,
|
||||
liveKitRoom,
|
||||
participant.isLocal,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -207,14 +207,6 @@ export enum EncryptionStatus {
|
||||
}
|
||||
|
||||
abstract class BaseMediaViewModel extends ViewModel {
|
||||
/**
|
||||
* Whether the media belongs to the local user.
|
||||
*/
|
||||
public readonly local: Observable<boolean> = this.participant.pipe(
|
||||
// We can assume, that the user is not local if the participant is undefined
|
||||
// We assume the local LK participant will always be available.
|
||||
map((p) => p?.isLocal ?? false),
|
||||
);
|
||||
/**
|
||||
* The LiveKit video track for this media.
|
||||
*/
|
||||
@ -414,6 +406,7 @@ abstract class BaseUserMediaViewModel extends BaseMediaViewModel {
|
||||
* The local participant's user media.
|
||||
*/
|
||||
export class LocalUserMediaViewModel extends BaseUserMediaViewModel {
|
||||
public readonly local = true;
|
||||
/**
|
||||
* Whether the video should be mirrored.
|
||||
*/
|
||||
@ -453,6 +446,8 @@ export class LocalUserMediaViewModel extends BaseUserMediaViewModel {
|
||||
* A remote participant's user media.
|
||||
*/
|
||||
export class RemoteUserMediaViewModel extends BaseUserMediaViewModel {
|
||||
public readonly local = false;
|
||||
|
||||
private readonly locallyMutedToggle = new Subject<void>();
|
||||
private readonly localVolumeAdjustment = new Subject<number>();
|
||||
private readonly localVolumeCommit = new Subject<void>();
|
||||
@ -538,6 +533,7 @@ export class ScreenShareViewModel extends BaseMediaViewModel {
|
||||
participant: Observable<LocalParticipant | RemoteParticipant>,
|
||||
encryptionSystem: EncryptionSystem,
|
||||
livekitRoom: LivekitRoom,
|
||||
public readonly local: boolean,
|
||||
) {
|
||||
super(
|
||||
id,
|
||||
|
Loading…
Reference in New Issue
Block a user