Make local field based on view model class not observable

This commit is contained in:
Hugh Nimmo-Smith 2024-11-06 16:33:53 +00:00
parent efee27ad25
commit eec44702f7
2 changed files with 5 additions and 8 deletions

View File

@ -317,6 +317,7 @@ class ScreenShare {
this.participant.asObservable(),
encryptionSystem,
liveKitRoom,
participant.isLocal,
);
}

View File

@ -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,