From 059430bd0acaba419ac88a256ba23e696b8edb6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=A0imon=20Brandner?= Date: Wed, 10 Mar 2021 09:13:21 +0100 Subject: [PATCH] Doc public methods MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Šimon Brandner --- src/webrtc/call.ts | 9 +++++++++ src/webrtc/callFeed.ts | 13 +++++++++++++ 2 files changed, 22 insertions(+) diff --git a/src/webrtc/call.ts b/src/webrtc/call.ts index b07d9d832..25f8e8914 100644 --- a/src/webrtc/call.ts +++ b/src/webrtc/call.ts @@ -401,10 +401,19 @@ export class MatrixCall extends EventEmitter { return Boolean(this.opponentCaps && this.opponentCaps["m.call.transferee"]); } + /** + * Returns an array of all CallFeeds + * @returns {Array} CallFeeds + */ public getFeeds(): Array { return this.feeds; } + /** + * Returns true if there are no incoming feeds, + * otherwise returns false + * @returns {boolean} no incoming feeds + */ public noIncomingFeeds(): boolean { return !this.feeds.some((feed) => !feed.isLocal()); } diff --git a/src/webrtc/callFeed.ts b/src/webrtc/callFeed.ts index e65466dab..7ac29a384 100644 --- a/src/webrtc/callFeed.ts +++ b/src/webrtc/callFeed.ts @@ -35,17 +35,30 @@ export class CallFeed extends EventEmitter { super() } + /** + * Returns true if CallFeed is local, otherwise returns false + * @returns {boolean} is local? + */ public isLocal() { return this.userId === this.client.getUserId(); } // TODO: This should be later replaced by a method // 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? + */ public isAudioOnly(): boolean { // We assume only one video track return !this.stream.getTracks().some((track) => track.kind === "video"); } + /** + * Replaces the current MediaStream with a new one. + * This method should be only used by MatrixCall. + * @param newStream new stream with which to replace the current one + */ public setNewStream(newStream: MediaStream) { this.stream = newStream; this.emit(CallFeedEvent.NewStream, this.stream);