From fb3ca90bc9441dfa781dffe4cb432f1dc9dbe659 Mon Sep 17 00:00:00 2001 From: Robert Long Date: Fri, 10 Sep 2021 16:06:26 -0700 Subject: [PATCH] Fix private method signatures --- src/webrtc/callFeed.ts | 6 +++++- src/webrtc/groupCall.ts | 28 ++++++++++++++-------------- src/webrtc/groupCallParticipant.ts | 16 ++++++++-------- 3 files changed, 27 insertions(+), 23 deletions(-) diff --git a/src/webrtc/callFeed.ts b/src/webrtc/callFeed.ts index 29a8a7668..56a7beffe 100644 --- a/src/webrtc/callFeed.ts +++ b/src/webrtc/callFeed.ts @@ -35,7 +35,7 @@ export class CallFeed extends EventEmitter { private analyser: AnalyserNode; private frequencyBinCount: Float32Array; private speakingThreshold = SPEAKING_THRESHOLD; - public speaking = false; + private speaking = false; private volumeLooperTimeout: number; constructor( @@ -110,6 +110,10 @@ export class CallFeed extends EventEmitter { return this.stream.getVideoTracks().length === 0 || this.videoMuted; } + public isSpeaking(): boolean { + return this.speaking; + } + /** * Replaces the current MediaStream with a new one. * This method should be only used by MatrixCall. diff --git a/src/webrtc/groupCall.ts b/src/webrtc/groupCall.ts index 3abb2dfb4..5c0f8b6b1 100644 --- a/src/webrtc/groupCall.ts +++ b/src/webrtc/groupCall.ts @@ -51,7 +51,7 @@ export class GroupCall extends EventEmitter { this.reEmitter = new ReEmitter(this); } - async initLocalParticipant() { + public async initLocalParticipant() { if (this.localParticipant) { return this.localParticipant; } @@ -89,7 +89,7 @@ export class GroupCall extends EventEmitter { return this.localParticipant; } - async enter() { + public async enter() { if (!this.localParticipant) { await this.initLocalParticipant(); } @@ -135,7 +135,7 @@ export class GroupCall extends EventEmitter { this.onActiveSpeakerLoop(); } - leave() { + public leave() { this.localParticipant = null; this.client.stopLocalMediaStream(); @@ -181,7 +181,7 @@ export class GroupCall extends EventEmitter { this.emit(GroupCallEvent.Left); } - isLocalVideoMuted() { + public isLocalVideoMuted() { if (this.localParticipant) { return this.localParticipant.isVideoMuted(); } @@ -189,7 +189,7 @@ export class GroupCall extends EventEmitter { return true; } - isMicrophoneMuted() { + public isMicrophoneMuted() { if (this.localParticipant) { return this.localParticipant.isAudioMuted(); } @@ -197,7 +197,7 @@ export class GroupCall extends EventEmitter { return true; } - setMicrophoneMuted(muted) { + public setMicrophoneMuted(muted) { if (this.localParticipant) { const usermediaFeed = this.localParticipant.usermediaFeed; @@ -227,7 +227,7 @@ export class GroupCall extends EventEmitter { this.emit(GroupCallEvent.LocalMuteStateChanged, muted, this.isLocalVideoMuted()); } - setLocalVideoMuted(muted) { + public setLocalVideoMuted(muted) { if (this.localParticipant) { const usermediaFeed = this.localParticipant.usermediaFeed; @@ -269,7 +269,7 @@ export class GroupCall extends EventEmitter { * Call presence */ - onPresenceLoop = () => { + private onPresenceLoop = () => { const userId = this.client.getUserId(); const currentMemberState = this.room.currentState.getStateEvents( "m.room.member", @@ -333,7 +333,7 @@ export class GroupCall extends EventEmitter { * as they are observed by the RoomState.members event. */ - processInitialCalls() { + private processInitialCalls() { const calls = this.client.callEventHandler.calls.values(); for (const call of calls) { @@ -341,7 +341,7 @@ export class GroupCall extends EventEmitter { } } - onIncomingCall = (call: MatrixCall) => { + private onIncomingCall = (call: MatrixCall) => { // The incoming calls may be for another room, which we will ignore. if (call.roomId !== this.room.roomId) { return; @@ -396,7 +396,7 @@ export class GroupCall extends EventEmitter { } }; - onRoomStateMembers = (_event, _state, member: RoomMember) => { + private onRoomStateMembers = (_event, _state, member: RoomMember) => { // The member events may be received for another room, which we will ignore. if (member.roomId !== this.room.roomId) { return; @@ -406,7 +406,7 @@ export class GroupCall extends EventEmitter { this.onMemberChanged(member); }; - onMemberChanged = (member: RoomMember) => { + private onMemberChanged = (member: RoomMember) => { // Don't process your own member. const localUserId = this.client.getUserId(); @@ -496,7 +496,7 @@ export class GroupCall extends EventEmitter { } }; - onActiveSpeakerLoop = () => { + private onActiveSpeakerLoop = () => { let topAvg; let nextActiveSpeaker; @@ -532,7 +532,7 @@ export class GroupCall extends EventEmitter { */ // TODO: move this elsewhere or get rid of the retry logic. Do we need it? - sendStateEventWithRetry( + private sendStateEventWithRetry( roomId: string, eventType: string, content: any, diff --git a/src/webrtc/groupCallParticipant.ts b/src/webrtc/groupCallParticipant.ts index fee3eb648..f0ecc255c 100644 --- a/src/webrtc/groupCallParticipant.ts +++ b/src/webrtc/groupCallParticipant.ts @@ -145,7 +145,7 @@ export class GroupCallParticipant extends EventEmitter { } }; - onCallFeedsChanged = () => { + private onCallFeedsChanged = () => { const nextUsermediaFeed = this.usermediaFeed; if (nextUsermediaFeed && nextUsermediaFeed !== this.initializedUsermediaFeed) { @@ -167,7 +167,7 @@ export class GroupCallParticipant extends EventEmitter { this.emit(GroupCallParticipantEvent.CallFeedsChanged); }; - initUserMediaFeed(callFeed: CallFeed) { + private initUserMediaFeed(callFeed: CallFeed) { this.initializedUsermediaFeed = callFeed; callFeed.setSpeakingThreshold(this.groupCall.speakingThreshold); callFeed.measureVolumeActivity(true); @@ -186,12 +186,12 @@ export class GroupCallParticipant extends EventEmitter { ); } - onCallReplaced = (newCall) => { + private onCallReplaced = (newCall) => { // TODO: Should we always reuse the sessionId? this.replaceCall(newCall, this.sessionId); }; - onCallHangup = () => { + private onCallHangup = () => { if (this.call.hangupReason === CallErrorCode.Replaced) { return; } @@ -215,17 +215,17 @@ export class GroupCallParticipant extends EventEmitter { this.groupCall.emit(GroupCallEvent.ParticipantsChanged, this.groupCall.participants); }; - onCallFeedSpeaking = (speaking: boolean) => { + private onCallFeedSpeaking = (speaking: boolean) => { this.emit(GroupCallParticipantEvent.Speaking, speaking); }; - onCallFeedVolumeChanged = (maxVolume: number) => { + private onCallFeedVolumeChanged = (maxVolume: number) => { this.activeSpeakerSamples.shift(); this.activeSpeakerSamples.push(maxVolume); this.emit(GroupCallParticipantEvent.VolumeChanged, maxVolume); }; - onCallFeedMuteStateChanged = (audioMuted: boolean, videoMuted: boolean) => { + private onCallFeedMuteStateChanged = (audioMuted: boolean, videoMuted: boolean) => { if (audioMuted) { this.activeSpeakerSamples = Array(this.groupCall.activeSpeakerSampleCount).fill( -Infinity, @@ -235,7 +235,7 @@ export class GroupCallParticipant extends EventEmitter { this.emit(GroupCallParticipantEvent.MuteStateChanged, audioMuted, videoMuted); }; - onCallDataChannel = (dataChannel: RTCDataChannel) => { + private onCallDataChannel = (dataChannel: RTCDataChannel) => { this.dataChannel = dataChannel; this.emit(GroupCallParticipantEvent.Datachannel, dataChannel); };