From 32830b93f12e9c37de2b3b0c511603f41ca1fc28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Sun, 4 Apr 2021 08:50:27 +0200 Subject: [PATCH] Rename audioOnly to videoMuted MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes more sense and will match a possible mute events MSC Signed-off-by: Šimon Brandner --- src/webrtc/callFeed.ts | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/webrtc/callFeed.ts b/src/webrtc/callFeed.ts index 78b37c7b4..1a934f0fa 100644 --- a/src/webrtc/callFeed.ts +++ b/src/webrtc/callFeed.ts @@ -53,13 +53,23 @@ export class CallFeed extends EventEmitter { return this.userId === this.client.getUserId(); } - // TODO: This should be later replaced by a method - // that will also check if the remote is muted. + // TODO: The two following methods should be later replaced + // by something that will also check if the remote is muted /** - * Returns true if there are no video tracks, otherwise returns false - * @returns {boolean} is audio only? + * Returns true if audio is muted or if there are no audio + * tracks, otherwise returns false + * @returns {boolean} is audio muted? */ - public isAudioOnly(): boolean { + public isAudioMuted(): boolean { + return !this.stream.getTracks().some((track) => track.kind === "audio"); + } + + /** + * Returns true video is muted or if there are no video + * tracks, otherwise returns false + * @returns {boolean} is video muted? + */ + public isVideoMuted(): boolean { // We assume only one video track return !this.stream.getTracks().some((track) => track.kind === "video"); }