Skip to content

Commit eb2154a

Browse files
authored
Merge branch 'jitsi:master' into proxyconnectionpc
2 parents 342b50a + 0df4517 commit eb2154a

File tree

77 files changed

+5378
-4180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5378
-4180
lines changed

JitsiConference.js renamed to JitsiConference.ts

Lines changed: 2777 additions & 2578 deletions
Large diffs are not rendered by default.

JitsiConferenceEventManager.js renamed to JitsiConferenceEventManager.ts

Lines changed: 103 additions & 92 deletions
Large diffs are not rendered by default.

JitsiConnection.ts

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,21 @@ const logger = getLogger('JitsiConnection');
1515

1616
export interface IConnectionOptions {
1717
analytics?: any;
18+
bridgeChannel?: {
19+
ignoreDomain?: string;
20+
preferSctp?: boolean;
21+
};
1822
disableFocus?: boolean;
1923
enableWebsocketResume: boolean;
2024
flags?: Record<string, any>;
25+
hosts: {
26+
domain: string;
27+
};
2128
name?: string;
2229
p2pStunServers: any[];
2330
serviceUrl: string;
2431
websocketKeepAlive?: number;
25-
websocketKeepAliveUrl?: number;
32+
websocketKeepAliveUrl?: string;
2633
xmppPing?: any;
2734
}
2835

@@ -44,8 +51,8 @@ export interface IAttachOptions {
4451
*/
4552
export default class JitsiConnection {
4653
private appID?: string;
47-
private token: string | null;
48-
private xmpp: XMPP;
54+
private token?: string;
55+
private _xmpp: XMPP;
4956
readonly options: IConnectionOptions;
5057

5158
/**
@@ -54,15 +61,15 @@ export default class JitsiConnection {
5461
* @param token - The JWT token used to authenticate with the server (optional).
5562
* @param options - Object with properties / settings related to connection with the server.
5663
*/
57-
constructor(appID: string, token: string | null, options: IConnectionOptions) {
64+
constructor(appID: string, token: Nullable<string>, options: IConnectionOptions) {
5865
this.appID = appID;
5966
this.token = token;
6067
this.options = options;
6168

6269
// Initialize the feature flags so that they are advertised through the disco-info.
6370
FeatureFlags.init(options.flags || {});
6471

65-
this.xmpp = new XMPP(options, token);
72+
this._xmpp = new XMPP(options, token);
6673

6774
this.addEventListener(JitsiConnectionEvents.CONNECTION_FAILED,
6875
(errType: string, msg: string, credentials: any, details: any) => {
@@ -128,7 +135,7 @@ export default class JitsiConnection {
128135
* @param args - Optional arguments to be passed to XMPP.disconnect
129136
* @returns Promise that resolves when the disconnect process is finished or rejects with an error.
130137
*/
131-
disconnect(...args: [string?]): Promise<void> {
138+
disconnect(...args: any): boolean | Promise<void> {
132139
// XXX Forward any arguments passed to JitsiConnection.disconnect to
133140
// XMPP.disconnect. For example, the caller of JitsiConnection.disconnect
134141
// may optionally pass the event which triggered the disconnect in order to
@@ -161,7 +168,7 @@ export default class JitsiConnection {
161168
* that will be created.
162169
* @returns The new conference object.
163170
*/
164-
initJitsiConference(name: string | null, options: Record<string, any>): JitsiConference {
171+
initJitsiConference(name: Nullable<string>, options: Record<string, any>): JitsiConference {
165172
return new JitsiConference({
166173
config: options,
167174
connection: this,
@@ -240,4 +247,12 @@ export default class JitsiConnection {
240247

241248
return data;
242249
}
250+
251+
/**
252+
* Get the XMPP instance.
253+
* @internal
254+
*/
255+
get xmpp(): XMPP {
256+
return this._xmpp;
257+
}
243258
}

JitsiMeetJS.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,7 @@ export default {
443443
async joinConference(
444444
roomName: string,
445445
appId: string = '',
446-
token: string | null = null,
446+
token: Nullable<string> = null,
447447
options: IJoinConferenceOptions = {}): Promise<JitsiConference> {
448448
const d = new Deferred();
449449
let connectionOptions = options.connectionOptions ?? {};

JitsiParticipant.ts

Lines changed: 27 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Strophe } from 'strophe.js';
22

33
import JitsiConference from './JitsiConference';
44
import * as JitsiConferenceEvents from './JitsiConferenceEvents';
5-
import JitsiTrack from './modules/RTC/JitsiTrack';
5+
import JitsiRemoteTrack from './modules/RTC/JitsiRemoteTrack';
66
import { MediaType } from './service/RTC/MediaType';
77

88
export interface ISourceInfo {
@@ -18,11 +18,7 @@ export default class JitsiParticipant {
1818
private _jid: string;
1919
private _id: string;
2020
private _conference: JitsiConference;
21-
private _displayName: string;
22-
private _supportsDTMF: boolean;
23-
private _tracks: JitsiTrack[];
2421
private _role: string;
25-
private _status?: string;
2622
private _hidden: boolean;
2723
private _statsID?: string;
2824
private _properties: Map<string, any>;
@@ -34,6 +30,22 @@ export default class JitsiParticipant {
3430
private _sources: Map<MediaType, Map<string, ISourceInfo>>;
3531
private _botType?: string;
3632
private _connectionJid?: string;
33+
/**
34+
* @internal
35+
*/
36+
_status?: string;
37+
/**
38+
* @internal
39+
*/
40+
_displayName: string;
41+
/**
42+
* @internal
43+
*/
44+
_supportsDTMF: boolean;
45+
/**
46+
* @internal
47+
*/
48+
_tracks: JitsiRemoteTrack[];
3749

3850
/* eslint-disable max-params */
3951

@@ -141,9 +153,9 @@ export default class JitsiParticipant {
141153
/**
142154
* Returns the bot type for the participant.
143155
*
144-
* @returns {string|undefined} - The bot type of the participant.
156+
* @returns {Optional<string>} - The bot type of the participant.
145157
*/
146-
getBotType(): string | undefined {
158+
getBotType(): Optional<string> {
147159
return this._botType;
148160
}
149161

@@ -158,9 +170,9 @@ export default class JitsiParticipant {
158170
/**
159171
* Returns the connection jid for the participant.
160172
*
161-
* @returns {string|undefined} - The connection jid of the participant.
173+
* @returns {Optional<string>} - The connection jid of the participant.
162174
*/
163-
getConnectionJid(): string | undefined {
175+
getConnectionJid(): Optional<string> {
164176
return this._connectionJid;
165177
}
166178

@@ -190,9 +202,9 @@ export default class JitsiParticipant {
190202
* Returns the XMPP identity. This is defined by your application in the
191203
* JWT `context` claims section.
192204
*
193-
* @returns {object|undefined} - XMPP user identity.
205+
* @returns {Optional<object>} - XMPP user identity.
194206
*/
195-
getIdentity(): object | undefined {
207+
getIdentity(): Optional<object> {
196208
return this._identity;
197209
}
198210

@@ -240,19 +252,19 @@ export default class JitsiParticipant {
240252
}
241253

242254
/**
243-
* @returns {Array.<JitsiTrack>} The list of media tracks for this
255+
* @returns {Array.<JitsiRemoteTrack>} The list of media tracks for this
244256
* participant.
245257
*/
246-
getTracks(): JitsiTrack[] {
258+
getTracks(): (JitsiRemoteTrack)[] {
247259
return this._tracks.slice();
248260
}
249261

250262
/**
251263
* @param {MediaType} mediaType
252-
* @returns {Array.<JitsiTrack>} an array of media tracks for this
264+
* @returns {Array.<JitsiRemoteTrack>} an array of media tracks for this
253265
* participant, for given media type.
254266
*/
255-
getTracksByMediaType(mediaType: MediaType): JitsiTrack[] {
267+
getTracksByMediaType(mediaType: MediaType): (JitsiRemoteTrack)[] {
256268
return this.getTracks().filter(track => track.getType() === mediaType);
257269
}
258270

JitsiParticipantEvents.js

Whitespace-only changes.

globals.d.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ export {};
33
declare global {
44
type Timeout = ReturnType<typeof setTimeout>;
55
interface Window {
6-
connectionTimes: any;
6+
JitsiMeetJS?: {
7+
app?: {
8+
connectionTimes?: Record<string, any>;
9+
};
10+
};
11+
connectionTimes?: Record<string, any>;
712
}
813
interface RTCRtpReceiver {
914
createEncodedStreams?: () => {

modules/RTC/BridgeChannel.ts

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { EventEmitter } from 'events';
55
import JitsiConference from '../../JitsiConference';
66
import { BridgeVideoType } from '../../service/RTC/BridgeVideoType';
77
import RTCEvents from '../../service/RTC/RTCEvents';
8+
import { IReceiverAudioSubscriptionMessage } from '../../service/RTC/ReceiverAudioSubscription';
89
import { SourceName } from '../../service/RTC/SignalingLayer';
910
import { createBridgeChannelClosedEvent } from '../../service/statistics/AnalyticsEvents';
1011
import ReceiverVideoConstraints from '../qualitycontrol/ReceiveVideoController';
@@ -19,11 +20,11 @@ const logger = getLogger('modules/RTC/BridgeChannel');
1920
*/
2021
export default class BridgeChannel {
2122

22-
private _channel: RTCDataChannel | WebSocket | null = null;
23+
private _channel: Nullable<RTCDataChannel | WebSocket> = null;
2324
private _conference: JitsiConference;
24-
private _connected: boolean | undefined = undefined;
25+
private _connected: Optional<boolean> = undefined;
2526
private _eventEmitter: EventEmitter;
26-
private _mode: 'datachannel' | 'websocket' | null = null;
27+
private _mode: Nullable<'datachannel' | 'websocket'> = null;
2728
private _areRetriesEnabled: boolean = false;
2829
private _closedFromClient: boolean = false;
2930
private _wsUrl?: string;
@@ -34,15 +35,15 @@ export default class BridgeChannel {
3435
* instance, or creates a WebSocket connection with the videobridge.
3536
* At least one of both, peerconnection or wsUrl parameters, must be
3637
* given.
37-
* @param {RTCPeerConnection} [peerconnection] WebRTC peer connection
38+
* @param {Nullable<RTCPeerConnection>} [peerconnection] WebRTC peer connection
3839
* instance.
39-
* @param {string} [wsUrl] WebSocket URL.
40+
* @param {Nullable<string>} [wsUrl] WebSocket URL.
4041
* @param {EventEmitter} emitter the EventEmitter instance to use for event emission.
4142
* @param {JitsiConference} conference the conference instance.
4243
*/
4344
constructor(
44-
peerconnection: RTCPeerConnection | null,
45-
wsUrl: string | null,
45+
peerconnection: Nullable<RTCPeerConnection>,
46+
wsUrl: Nullable<string>,
4647
emitter: EventEmitter,
4748
conference: JitsiConference
4849
) {
@@ -258,6 +259,21 @@ export default class BridgeChannel {
258259
});
259260
}
260261

262+
/**
263+
* Sends a message for audio subscription updates.
264+
*
265+
* @param {IReceiverAudioSubscriptionMessage} message - The audio subscription message.
266+
* @returns {void}
267+
*/
268+
sendReceiverAudioSubscriptionMessage(message: IReceiverAudioSubscriptionMessage): void {
269+
logger.info(`Sending ReceiverAudioSubscription with mode: ${message.mode}`
270+
+ ` and ${message.list?.length ? 'list=' + message.list.join(', ') : 'no list'}`);
271+
this._send({
272+
colibriClass: 'ReceiverAudioSubscription',
273+
...message
274+
});
275+
}
276+
261277
/**
262278
* Sends a 'ReceiverVideoConstraints' message via the bridge channel.
263279
*
@@ -293,7 +309,7 @@ export default class BridgeChannel {
293309
_handleChannel(channel: RTCDataChannel | WebSocket): void {
294310
const emitter = this._eventEmitter;
295311

296-
channel.onopen = (): void | null => {
312+
channel.onopen = (): Nullable<void> => {
297313
logger.info(`${this._mode} channel opened`);
298314

299315
this._connected = true;

0 commit comments

Comments
 (0)