Skip to content

Commit aa6b0f2

Browse files
authored
Merge branch 'master' into RTC
2 parents 5ce95dd + 9e28f50 commit aa6b0f2

36 files changed

+6047
-5105
lines changed

JitsiConference.ts

Lines changed: 2723 additions & 2571 deletions
Large diffs are not rendered by default.

JitsiConnection.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export interface IConnectionOptions {
2929
p2pStunServers: any[];
3030
serviceUrl: string;
3131
websocketKeepAlive?: number;
32-
websocketKeepAliveUrl?: number;
32+
websocketKeepAliveUrl?: string;
3333
xmppPing?: any;
3434
}
3535

@@ -135,7 +135,7 @@ export default class JitsiConnection {
135135
* @param args - Optional arguments to be passed to XMPP.disconnect
136136
* @returns Promise that resolves when the disconnect process is finished or rejects with an error.
137137
*/
138-
disconnect(...args: [string?]): Promise<void> {
138+
disconnect(...args: any): boolean | Promise<void> {
139139
// XXX Forward any arguments passed to JitsiConnection.disconnect to
140140
// XMPP.disconnect. For example, the caller of JitsiConnection.disconnect
141141
// may optionally pass the event which triggered the disconnect in order to

JitsiMediaDevices.ts

Lines changed: 50 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,15 @@ const VIDEO_PERMISSION_NAME = 'camera' as PermissionName;
1111

1212
/**
1313
* Media devices utilities for Jitsi.
14+
* @noInheritDoc
1415
*/
15-
class JitsiMediaDevices extends Listenable {
16+
export default class JitsiMediaDevices extends Listenable {
1617
private _initialized: boolean;
1718
private _permissions: { [key: string]: boolean; };
1819
private _permissionsApiSupported: Promise<boolean>;
1920

2021
/**
21-
* Initializes a {@code JitsiMediaDevices} object. There will be a single
22+
* Initializes a `JitsiMediaDevices` object. There will be a single
2223
* instance of this class.
2324
*/
2425
constructor() {
@@ -28,8 +29,55 @@ class JitsiMediaDevices extends Listenable {
2829
this._permissionsApiSupported = Promise.resolve(false);
2930
}
3031

32+
/**
33+
* Parses a PermissionState object and returns true for granted and false otherwise.
34+
*
35+
* @param {PermissionState} permissionStatus - The PermissionState object retrieved from the Permissions API.
36+
* @returns {boolean} - True for granted and false for denied.
37+
* @throws {TypeError}
38+
*/
39+
private _parsePermissionState(permissionStatus: PermissionStatus = {} as PermissionStatus): boolean {
40+
const status = permissionStatus.state;
41+
42+
if (typeof status !== 'string') {
43+
throw new TypeError();
44+
}
45+
46+
return status === PERMISSION_GRANTED_STATUS;
47+
}
48+
49+
/**
50+
* Updates the local granted/denied permissions cache. A permissions might be
51+
* granted, denied, or undefined. This is represented by having its media
52+
* type key set to `true` or `false` respectively.
53+
*
54+
* @param {Object} permissions - Object with the permissions.
55+
*/
56+
private _handlePermissionsChange(permissions: { [key: string]: boolean; }): void {
57+
const hasPermissionsChanged
58+
= [ MediaType.AUDIO, MediaType.VIDEO ]
59+
.some(type => type in permissions && permissions[type] !== this._permissions[type]);
60+
61+
if (hasPermissionsChanged) {
62+
this._permissions = {
63+
...this._permissions,
64+
...permissions
65+
};
66+
this.eventEmitter.emit(JitsiMediaDevicesEvents.PERMISSIONS_CHANGED, this._permissions);
67+
68+
if (this._permissions[MediaType.AUDIO] || this._permissions[MediaType.VIDEO]) {
69+
// Triggering device list update when the permissions are granted in order to update
70+
// the labels the devices.
71+
this.enumerateDevices(() => {
72+
// Empty callback - device list update triggered
73+
});
74+
}
75+
}
76+
}
77+
3178
/**
3279
* Initialize. Start listening for device changes and initialize permissions checks.
80+
* @internal
3381
*/
3482
init(): void {
3583
if (this._initialized) {
@@ -104,52 +152,6 @@ class JitsiMediaDevices extends Listenable {
104152
});
105153
}
106154

107-
/**
108-
* Parses a PermissionState object and returns true for granted and false otherwise.
109-
*
110-
* @param {PermissionState} permissionStatus - The PermissionState object retrieved from the Permissions API.
111-
* @returns {boolean} - True for granted and false for denied.
112-
* @throws {TypeError}
113-
*/
114-
_parsePermissionState(permissionStatus: PermissionStatus = {} as PermissionStatus): boolean {
115-
const status = permissionStatus.state;
116-
117-
if (typeof status !== 'string') {
118-
throw new TypeError();
119-
}
120-
121-
return status === PERMISSION_GRANTED_STATUS;
122-
}
123-
124-
/**
125-
* Updates the local granted/denied permissions cache. A permissions might be
126-
* granted, denied, or undefined. This is represented by having its media
127-
* type key set to {@code true} or {@code false} respectively.
128-
*
129-
* @param {Object} permissions - Object with the permissions.
130-
*/
131-
_handlePermissionsChange(permissions: { [key: string]: boolean; }): void {
132-
const hasPermissionsChanged
133-
= [ MediaType.AUDIO, MediaType.VIDEO ]
134-
.some(type => type in permissions && permissions[type] !== this._permissions[type]);
135-
136-
if (hasPermissionsChanged) {
137-
this._permissions = {
138-
...this._permissions,
139-
...permissions
140-
};
141-
this.eventEmitter.emit(JitsiMediaDevicesEvents.PERMISSIONS_CHANGED, this._permissions);
142-
143-
if (this._permissions[MediaType.AUDIO] || this._permissions[MediaType.VIDEO]) {
144-
// Triggering device list update when the permissions are granted in order to update
145-
// the labels the devices.
146-
this.enumerateDevices(() => {
147-
// Empty callback - device list update triggered
148-
});
149-
}
150-
}
151-
}
152-
153155
/**
154156
* Executes callback with list of media devices connected.
155157
* @param {function} callback
@@ -267,5 +269,3 @@ class JitsiMediaDevices extends Listenable {
267269
return RTC.setAudioOutputDevice(deviceId);
268270
}
269271
}
270-
271-
export default new JitsiMediaDevices();

JitsiMeetJS.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,16 @@ export interface IJoinConferenceOptions {
120120
tracks?: JitsiLocalTrack[];
121121
}
122122

123+
const mediaDevices = new JitsiMediaDevices();
124+
123125
/**
124-
* The public API of the Jitsi Meet library (a.k.a. {@code JitsiMeetJS}).
126+
* The public API of the Jitsi Meet library (a.k.a. `JitsiMeetJS`).
125127
*/
126-
export default {
128+
const JitsiMeetJS = {
127129
JitsiConnection,
128130

129131
/**
130-
* {@code ProxyConnectionService} is used to connect a remote peer to a local Jitsi participant without going
132+
* `ProxyConnectionService` is used to connect a remote peer to a local Jitsi participant without going
131133
* through a Jitsi conference. It is currently used for room integration development, specifically wireless
132134
* screensharing. Its API is experimental and will likely change; usage of it is advised against.
133135
*/
@@ -373,7 +375,7 @@ export default {
373375
// @ts-ignore
374376
logger.info(`This appears to be ${browser.getName()}, ver: ${browser.getVersion()}`);
375377

376-
JitsiMediaDevices.init();
378+
mediaDevices.init();
377379
Settings.init(options.externalStorage);
378380
Statistics.init(options);
379381

@@ -423,8 +425,8 @@ export default {
423425
* Returns whether the current execution environment supports WebRTC (for
424426
* use within this library).
425427
*
426-
* @returns {boolean} {@code true} if WebRTC is supported in the current
427-
* execution environment (for use within this library); {@code false},
428+
* @returns {boolean} `true` if WebRTC is supported in the current
429+
* execution environment (for use within this library); `false`,
428430
* otherwise.
429431
*/
430432
isWebRtcSupported() {
@@ -521,7 +523,7 @@ export default {
521523
},
522524

523525
logLevels: Logger.levels,
524-
mediaDevices: JitsiMediaDevices as unknown,
526+
mediaDevices,
525527

526528
/**
527529
* Removes global logging transport from the library logging framework.
@@ -629,7 +631,7 @@ export default {
629631
* Informs lib-jitsi-meet about the current network status.
630632
*
631633
* @param {object} state - The network info state.
632-
* @param {boolean} state.isOnline - {@code true} if the internet connectivity is online or {@code false}
634+
* @param {boolean} state.isOnline - `true` if the internet connectivity is online or `false`
633635
* otherwise.
634636
*/
635637
setNetworkInfo({ isOnline }) {
@@ -646,3 +648,5 @@ export default {
646648
},
647649
version: COMMIT_HASH
648650
};
651+
652+
export default JitsiMeetJS;

JitsiParticipant.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ export default class JitsiParticipant {
5252
/**
5353
* Initializes a new JitsiParticipant instance.
5454
*
55-
* @constructor
5655
* @param jid the conference XMPP jid
5756
* @param conference
5857
* @param displayName
@@ -391,8 +390,8 @@ export default class JitsiParticipant {
391390
/**
392391
* Sets the value of a property of this participant, and fires an event if
393392
* the value has changed.
394-
* @name the name of the property.
395-
* @value the value to set.
393+
* @param {string} name the name of the property.
394+
* @param {any} value the value to set.
396395
*/
397396
setProperty(name: string, value: any): void {
398397
const oldValue = this._properties.get(name);

JitsiTrackError.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export default class JitsiTrackError extends Error {
5151
public gum?: IGum;
5252

5353
/**
54-
* @constructor
5554
* @param {IGumError|string} error - error object or error name
5655
* @param {IGumOptions|string} [options] - getUserMedia constraints object or error message
5756
* @param {DeviceType[]} [devices] - list of getUserMedia requested devices

0 commit comments

Comments
 (0)