forked from Toumassa/lib-jitsi-meet
-
Notifications
You must be signed in to change notification settings - Fork 0
/
JitsiParticipant.js
182 lines (149 loc) · 4.17 KB
/
JitsiParticipant.js
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
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/* global Strophe */
/**
* Represents a participant in (a member of) a conference.
* @param jid the conference XMPP jid
* @param conference
* @param displayName
* @param isHidden indicates if this participant is a hidden participant
*/
function JitsiParticipant(jid, conference, displayName, isHidden){
this._jid = jid;
this._id = Strophe.getResourceFromJid(jid);
this._conference = conference;
this._displayName = displayName;
this._supportsDTMF = false;
this._tracks = [];
this._role = 'none';
this._status = null;
this._availableDevices = {
audio: undefined,
video: undefined
};
this._isHidden = isHidden;
}
/**
* @returns {JitsiConference} The conference that this participant belongs to.
*/
JitsiParticipant.prototype.getConference = function() {
return this._conference;
};
/**
* @returns {Array.<JitsiTrack>} The list of media tracks for this participant.
*/
JitsiParticipant.prototype.getTracks = function() {
return this._tracks.slice();
};
/**
* @returns {String} The ID of this participant.
*/
JitsiParticipant.prototype.getId = function() {
return this._id;
};
/**
* @returns {String} The JID of this participant.
*/
JitsiParticipant.prototype.getJid = function() {
return this._jid;
};
/**
* @returns {String} The human-readable display name of this participant.
*/
JitsiParticipant.prototype.getDisplayName = function() {
return this._displayName;
};
/**
* @returns {String} The status of the participant.
*/
JitsiParticipant.prototype.getStatus = function () {
return this._status;
};
/**
* @returns {Boolean} Whether this participant is a moderator or not.
*/
JitsiParticipant.prototype.isModerator = function() {
return this._role === 'moderator';
};
/**
* @returns {Boolean} Whether this participant is a hidden participant. Some
* special system participants may want to join hidden (like for example the
* recorder).
*/
JitsiParticipant.prototype.isHidden = function() {
return this._isHidden;
};
// Gets a link to an etherpad instance advertised by the participant?
//JitsiParticipant.prototype.getEtherpad = function() {
//
//}
/*
* @returns {Boolean} Whether this participant has muted their audio.
*/
JitsiParticipant.prototype.isAudioMuted = function() {
return this.getTracks().reduce(function (track, isAudioMuted) {
return isAudioMuted && (track.isVideoTrack() || track.isMuted());
}, true);
};
/*
* @returns {Boolean} Whether this participant has muted their video.
*/
JitsiParticipant.prototype.isVideoMuted = function() {
return this.getTracks().reduce(function (track, isVideoMuted) {
return isVideoMuted && (track.isAudioTrack() || track.isMuted());
}, true);
};
/*
* @returns {???} The latest statistics reported by this participant
* (i.e. info used to populate the GSM bars)
* TODO: do we expose this or handle it internally?
*/
JitsiParticipant.prototype.getLatestStats = function() {
};
/**
* @returns {String} The role of this participant.
*/
JitsiParticipant.prototype.getRole = function() {
return this._role;
};
/*
* @returns {Boolean} Whether this participant is
* the conference focus (i.e. jicofo).
*/
JitsiParticipant.prototype.isFocus = function() {
};
/*
* @returns {Boolean} Whether this participant is
* a conference recorder (i.e. jirecon).
*/
JitsiParticipant.prototype.isRecorder = function() {
};
/*
* @returns {Boolean} Whether this participant is a SIP gateway (i.e. jigasi).
*/
JitsiParticipant.prototype.isSipGateway = function() {
};
/**
* @returns {Boolean} Whether this participant
* is currently sharing their screen.
*/
JitsiParticipant.prototype.isScreenSharing = function() {
};
/**
* @returns {String} The user agent of this participant
* (i.e. browser userAgent string).
*/
JitsiParticipant.prototype.getUserAgent = function() {
};
/**
* Kicks the participant from the conference (requires certain privileges).
*/
JitsiParticipant.prototype.kick = function() {
};
/**
* Asks this participant to mute themselves.
*/
JitsiParticipant.prototype.askToMute = function() {
};
JitsiParticipant.prototype.supportsDTMF = function () {
return this._supportsDTMF;
};
module.exports = JitsiParticipant;