1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
import { SDPStreamMetadataPurpose } from "./callEventTypes";
import { MatrixClient } from "../client";
import { RoomMember } from "../models/room-member";
import { TypedEventEmitter } from "../models/typed-event-emitter";
import { MatrixCall } from "./call";
export declare const SPEAKING_THRESHOLD = -60;
export interface ICallFeedOpts {
client: MatrixClient;
roomId?: string;
userId: string;
deviceId: string | undefined;
stream: MediaStream;
purpose: SDPStreamMetadataPurpose;
/**
* Whether or not the remote SDPStreamMetadata says audio is muted
*/
audioMuted: boolean;
/**
* Whether or not the remote SDPStreamMetadata says video is muted
*/
videoMuted: boolean;
/**
* The MatrixCall which is the source of this CallFeed
*/
call?: MatrixCall;
}
export declare enum CallFeedEvent {
NewStream = "new_stream",
MuteStateChanged = "mute_state_changed",
LocalVolumeChanged = "local_volume_changed",
VolumeChanged = "volume_changed",
ConnectedChanged = "connected_changed",
Speaking = "speaking",
Disposed = "disposed"
}
type EventHandlerMap = {
[CallFeedEvent.NewStream]: (stream: MediaStream) => void;
[CallFeedEvent.MuteStateChanged]: (audioMuted: boolean, videoMuted: boolean) => void;
[CallFeedEvent.LocalVolumeChanged]: (localVolume: number) => void;
[CallFeedEvent.VolumeChanged]: (volume: number) => void;
[CallFeedEvent.ConnectedChanged]: (connected: boolean) => void;
[CallFeedEvent.Speaking]: (speaking: boolean) => void;
[CallFeedEvent.Disposed]: () => void;
};
export declare class CallFeed extends TypedEventEmitter<CallFeedEvent, EventHandlerMap> {
stream: MediaStream;
sdpMetadataStreamId: string;
userId: string;
readonly deviceId: string | undefined;
purpose: SDPStreamMetadataPurpose;
speakingVolumeSamples: number[];
private client;
private call?;
private roomId?;
private audioMuted;
private videoMuted;
private localVolume;
private measuringVolumeActivity;
private audioContext?;
private analyser?;
private frequencyBinCount?;
private speakingThreshold;
private speaking;
private volumeLooperTimeout?;
private _disposed;
private _connected;
constructor(opts: ICallFeedOpts);
get connected(): boolean;
private set connected(value);
private get hasAudioTrack();
private updateStream;
private initVolumeMeasuring;
private onAddTrack;
private onCallState;
/**
* Returns callRoom member
* @returns member of the callRoom
*/
getMember(): RoomMember | null;
/**
* Returns true if CallFeed is local, otherwise returns false
* @returns is local?
*/
isLocal(): boolean;
/**
* Returns true if audio is muted or if there are no audio
* tracks, otherwise returns false
* @returns is audio muted?
*/
isAudioMuted(): boolean;
/**
* Returns true video is muted or if there are no video
* tracks, otherwise returns false
* @returns is video muted?
*/
isVideoMuted(): boolean;
isSpeaking(): boolean;
/**
* Replaces the current MediaStream with a new one.
* The stream will be different and new stream as remote parties are
* concerned, but this can be used for convenience locally to set up
* volume listeners automatically on the new stream etc.
* @param newStream - new stream with which to replace the current one
*/
setNewStream(newStream: MediaStream): void;
/**
* Set one or both of feed's internal audio and video video mute state
* Either value may be null to leave it as-is
* @param audioMuted - is the feed's audio muted?
* @param videoMuted - is the feed's video muted?
*/
setAudioVideoMuted(audioMuted: boolean | null, videoMuted: boolean | null): void;
/**
* Starts emitting volume_changed events where the emitter value is in decibels
* @param enabled - emit volume changes
*/
measureVolumeActivity(enabled: boolean): void;
setSpeakingThreshold(threshold: number): void;
private volumeLooper;
clone(): CallFeed;
dispose(): void;
get disposed(): boolean;
private set disposed(value);
getLocalVolume(): number;
setLocalVolume(localVolume: number): void;
}
export {};
//# sourceMappingURL=callFeed.d.ts.map
|