forked from mystiq/hydrogen-web
fix isMuted logic in view model
This commit is contained in:
parent
be04eeded0
commit
6394138c4a
1 changed files with 12 additions and 12 deletions
|
@ -67,14 +67,6 @@ export class CallViewModel extends ViewModel<Options> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
get isCameraMuted(): boolean {
|
|
||||||
return this.call.muteSettings.camera;
|
|
||||||
}
|
|
||||||
|
|
||||||
get isMicrophoneMuted(): boolean {
|
|
||||||
return this.call.muteSettings.microphone;
|
|
||||||
}
|
|
||||||
|
|
||||||
async toggleVideo() {
|
async toggleVideo() {
|
||||||
this.call.setMuted(this.call.muteSettings.toggleCamera());
|
this.call.setMuted(this.call.muteSettings.toggleCamera());
|
||||||
}
|
}
|
||||||
|
@ -95,11 +87,11 @@ class OwnMemberViewModel extends ViewModel<OwnMemberOptions> implements IStreamV
|
||||||
}
|
}
|
||||||
|
|
||||||
get isCameraMuted(): boolean {
|
get isCameraMuted(): boolean {
|
||||||
return this.call.muteSettings.camera ?? !!getStreamVideoTrack(this.stream);
|
return isMuted(this.call.muteSettings.camera, !!getStreamVideoTrack(this.stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
get isMicrophoneMuted(): boolean {
|
get isMicrophoneMuted(): boolean {
|
||||||
return this.call.muteSettings.microphone ?? !!getStreamAudioTrack(this.stream);
|
return isMuted(this.call.muteSettings.microphone, !!getStreamAudioTrack(this.stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
get avatarLetter(): string {
|
get avatarLetter(): string {
|
||||||
|
@ -135,11 +127,11 @@ export class CallMemberViewModel extends ViewModel<MemberOptions> implements ISt
|
||||||
}
|
}
|
||||||
|
|
||||||
get isCameraMuted(): boolean {
|
get isCameraMuted(): boolean {
|
||||||
return this.member.remoteMuteSettings?.camera ?? !getStreamVideoTrack(this.stream);
|
return isMuted(this.member.remoteMuteSettings?.camera, !!getStreamVideoTrack(this.stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
get isMicrophoneMuted(): boolean {
|
get isMicrophoneMuted(): boolean {
|
||||||
return this.member.remoteMuteSettings?.microphone ?? !getStreamAudioTrack(this.stream);
|
return isMuted(this.member.remoteMuteSettings?.microphone, !!getStreamAudioTrack(this.stream));
|
||||||
}
|
}
|
||||||
|
|
||||||
get avatarLetter(): string {
|
get avatarLetter(): string {
|
||||||
|
@ -178,3 +170,11 @@ export interface IStreamViewModel extends AvatarSource, ViewModel {
|
||||||
get isCameraMuted(): boolean;
|
get isCameraMuted(): boolean;
|
||||||
get isMicrophoneMuted(): boolean;
|
get isMicrophoneMuted(): boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isMuted(muted: boolean | undefined, hasTrack: boolean) {
|
||||||
|
if (muted) {
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return !hasTrack;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue