diff --git a/src/state/CallViewModel.ts b/src/state/CallViewModel.ts index 10c56eea..0052067e 100644 --- a/src/state/CallViewModel.ts +++ b/src/state/CallViewModel.ts @@ -317,6 +317,7 @@ class ScreenShare { this.participant.asObservable(), encryptionSystem, liveKitRoom, + participant.isLocal, ); } diff --git a/src/state/MediaViewModel.ts b/src/state/MediaViewModel.ts index 4fdf1131..e3f244f9 100644 --- a/src/state/MediaViewModel.ts +++ b/src/state/MediaViewModel.ts @@ -207,14 +207,6 @@ export enum EncryptionStatus { } abstract class BaseMediaViewModel extends ViewModel { - /** - * Whether the media belongs to the local user. - */ - public readonly local: Observable = 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(); private readonly localVolumeAdjustment = new Subject(); private readonly localVolumeCommit = new Subject(); @@ -538,6 +533,7 @@ export class ScreenShareViewModel extends BaseMediaViewModel { participant: Observable, encryptionSystem: EncryptionSystem, livekitRoom: LivekitRoom, + public readonly local: boolean, ) { super( id,