1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Doc public methods

Signed-off-by: Šimon Brandner <simon.bra.ag@gmail.com>
This commit is contained in:
Šimon Brandner
2021-03-10 09:13:21 +01:00
parent 530b60cbc2
commit 059430bd0a
2 changed files with 22 additions and 0 deletions

View File

@@ -401,10 +401,19 @@ export class MatrixCall extends EventEmitter {
return Boolean(this.opponentCaps && this.opponentCaps["m.call.transferee"]); return Boolean(this.opponentCaps && this.opponentCaps["m.call.transferee"]);
} }
/**
* Returns an array of all CallFeeds
* @returns {Array<CallFeed>} CallFeeds
*/
public getFeeds(): Array<CallFeed> { public getFeeds(): Array<CallFeed> {
return this.feeds; return this.feeds;
} }
/**
* Returns true if there are no incoming feeds,
* otherwise returns false
* @returns {boolean} no incoming feeds
*/
public noIncomingFeeds(): boolean { public noIncomingFeeds(): boolean {
return !this.feeds.some((feed) => !feed.isLocal()); return !this.feeds.some((feed) => !feed.isLocal());
} }

View File

@@ -35,17 +35,30 @@ export class CallFeed extends EventEmitter {
super() super()
} }
/**
* Returns true if CallFeed is local, otherwise returns false
* @returns {boolean} is local?
*/
public isLocal() { public isLocal() {
return this.userId === this.client.getUserId(); return this.userId === this.client.getUserId();
} }
// TODO: This should be later replaced by a method // TODO: This should be later replaced by a method
// that will also check if the remote is muted. // 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 { public isAudioOnly(): boolean {
// We assume only one video track // We assume only one video track
return !this.stream.getTracks().some((track) => track.kind === "video"); 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) { public setNewStream(newStream: MediaStream) {
this.stream = newStream; this.stream = newStream;
this.emit(CallFeedEvent.NewStream, this.stream); this.emit(CallFeedEvent.NewStream, this.stream);