livekit-client 1.12.0 → 1.12.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +14 -0
- package/dist/livekit-client.e2ee.worker.js +1 -1
- package/dist/livekit-client.e2ee.worker.js.map +1 -1
- package/dist/livekit-client.e2ee.worker.mjs +59 -39
- package/dist/livekit-client.e2ee.worker.mjs.map +1 -1
- package/dist/livekit-client.esm.mjs +44 -17
- package/dist/livekit-client.esm.mjs.map +1 -1
- package/dist/livekit-client.umd.js +1 -1
- package/dist/livekit-client.umd.js.map +1 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts +0 -1
- package/dist/src/e2ee/worker/FrameCryptor.d.ts.map +1 -1
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts +8 -0
- package/dist/src/e2ee/worker/ParticipantKeyHandler.d.ts.map +1 -1
- package/dist/src/room/Room.d.ts.map +1 -1
- package/dist/src/room/participant/RemoteParticipant.d.ts +6 -4
- package/dist/src/room/participant/RemoteParticipant.d.ts.map +1 -1
- package/dist/src/room/track/create.d.ts.map +1 -1
- package/dist/src/utils/browserParser.d.ts +2 -0
- package/dist/src/utils/browserParser.d.ts.map +1 -1
- package/dist/ts4.2/src/e2ee/worker/FrameCryptor.d.ts +0 -1
- package/dist/ts4.2/src/e2ee/worker/ParticipantKeyHandler.d.ts +8 -0
- package/dist/ts4.2/src/room/participant/RemoteParticipant.d.ts +6 -4
- package/dist/ts4.2/src/utils/browserParser.d.ts +2 -0
- package/package.json +1 -1
- package/src/e2ee/worker/FrameCryptor.ts +12 -14
- package/src/e2ee/worker/ParticipantKeyHandler.ts +15 -0
- package/src/e2ee/worker/e2ee.worker.ts +12 -6
- package/src/room/Room.ts +17 -7
- package/src/room/participant/RemoteParticipant.ts +19 -15
- package/src/room/track/create.ts +9 -0
- package/src/utils/browserParser.ts +5 -0
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"FrameCryptor.d.ts","sourceRoot":"","sources":["../../../../src/e2ee/worker/FrameCryptor.ts"],"names":[],"mappings":"A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AG,IAAI;IACP,4BAA4B;IAC5B,GAAG,IAAI;IACP,sBAAsB;IACtB,OAAO,KAAK;IACZ,oBAAoB;IACpB,UAAU,KAAK;IACf,kBAAkB;IAClB,WAAW,KAAK;IAChB,uCAAuC;IACvC,OAAO,KAAK;IACZ,sBAAsB;IACtB,WAAW,KAAK;IAChB,oCAAoC;IACpC,UAAU,KAAK;IACf,0BAA0B;IAC1B,GAAG,KAAK;IAIR,qEAAqE;IACrE,SAAS,KAAK;IACd,4BAA4B;IAC5B,SAAS,KAAK;IACd,0FAA0F;IAC1F,eAAe,KAAK;CAGrB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,UAAU,GAAG,OAAO,CAK/F"}
|
@@ -15,6 +15,7 @@ export declare class ParticipantKeyHandler extends EventEmitter<ParticipantKeyHa
|
|
15
15
|
private keyProviderOptions;
|
16
16
|
private ratchetPromiseMap;
|
17
17
|
private participantId;
|
18
|
+
hasValidKey: boolean;
|
18
19
|
constructor(participantId: string | undefined, isEnabled: boolean, keyProviderOptions: KeyProviderOptions);
|
19
20
|
setEnabled(enabled: boolean): void;
|
20
21
|
/**
|
@@ -25,6 +26,13 @@ export declare class ParticipantKeyHandler extends EventEmitter<ParticipantKeyHa
|
|
25
26
|
* @param setKey
|
26
27
|
*/
|
27
28
|
ratchetKey(keyIndex?: number, setKey?: boolean): Promise<CryptoKey>;
|
29
|
+
/**
|
30
|
+
* takes in a key material with `deriveBits` and `deriveKey` set as key usages
|
31
|
+
* and derives encryption keys from the material and sets it on the key ring buffer
|
32
|
+
* together with the material
|
33
|
+
* also resets the valid key property and updates the currentKeyIndex
|
34
|
+
*/
|
35
|
+
setKey(material: CryptoKey, keyIndex?: number): Promise<void>;
|
28
36
|
/**
|
29
37
|
* takes in a key material with `deriveBits` and `deriveKey` set as key usages
|
30
38
|
* and derives encryption keys from the material and sets it on the key ring buffer
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"ParticipantKeyHandler.d.ts","sourceRoot":"","sources":["../../../../src/e2ee/worker/ParticipantKeyHandler.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AAGzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAM3F;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,YAAY,CAAC,8BAA8B,CAAC;IACrF,OAAO,CAAC,eAAe,CAAS;IAEhC,OAAO,CAAC,aAAa,CAAgB;IAErC,OAAO,CAAC,OAAO,CAAU;IAEzB,OAAO,CAAC,kBAAkB,CAAqB;IAE/C,OAAO,CAAC,iBAAiB,CAAkC;IAE3D,OAAO,CAAC,aAAa,CAAqB;
|
1
|
+
{"version":3,"file":"ParticipantKeyHandler.d.ts","sourceRoot":"","sources":["../../../../src/e2ee/worker/ParticipantKeyHandler.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AAGzC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,EAAE,8BAA8B,EAAE,MAAM,UAAU,CAAC;AAM3F;;;;;;;GAOG;AACH,qBAAa,qBAAsB,SAAQ,YAAY,CAAC,8BAA8B,CAAC;IACrF,OAAO,CAAC,eAAe,CAAS;IAEhC,OAAO,CAAC,aAAa,CAAgB;IAErC,OAAO,CAAC,OAAO,CAAU;IAEzB,OAAO,CAAC,kBAAkB,CAAqB;IAE/C,OAAO,CAAC,iBAAiB,CAAkC;IAE3D,OAAO,CAAC,aAAa,CAAqB;IAE1C,WAAW,EAAE,OAAO,CAAC;gBAGnB,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,SAAS,EAAE,OAAO,EAClB,kBAAkB,EAAE,kBAAkB;IAYxC,UAAU,CAAC,OAAO,EAAE,OAAO;IAI3B;;;;;;OAMG;IACH,UAAU,CAAC,QAAQ,CAAC,EAAE,MAAM,EAAE,MAAM,UAAO,GAAG,OAAO,CAAC,SAAS,CAAC;IA+BhE;;;;;OAKG;IACG,MAAM,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,SAAI;IAK9C;;;;;OAKG;IACG,kBAAkB,CAAC,QAAQ,EAAE,SAAS,EAAE,QAAQ,SAAI,EAAE,gBAAgB,UAAQ;IAS9E,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,gBAAgB,UAAQ;IAOpE,kBAAkB,CAAC,KAAK,EAAE,MAAM;IAKtC,SAAS;IAIT,kBAAkB;IAIlB;;;;OAIG;IACH,SAAS,CAAC,QAAQ,CAAC,EAAE,MAAM;CAG5B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"Room.d.ts","sourceRoot":"","sources":["../../../src/room/Room.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,gBAAgB,CAAC;AAKxB,OAAO,KAAK,EAEV,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,gBAAgB,EAGhB,qBAAqB,EAIrB,iBAAiB,EAKlB,MAAM,yBAAyB,CAAC;
|
1
|
+
{"version":3,"file":"Room.d.ts","sourceRoot":"","sources":["../../../src/room/Room.ts"],"names":[],"mappings":"AAAA,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,gBAAgB,CAAC;AAKxB,OAAO,KAAK,EAEV,mBAAmB,EACnB,kBAAkB,EAClB,WAAW,EACZ,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,eAAe,EACf,gBAAgB,EAGhB,qBAAqB,EAIrB,iBAAiB,EAKlB,MAAM,yBAAyB,CAAC;AAWjC,OAAO,SAAS,MAAM,aAAa,CAAC;AAWpC,OAAO,gBAAgB,MAAM,gCAAgC,CAAC;AAC9D,OAAO,KAAK,WAAW,MAAM,2BAA2B,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,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oteTrackPublication>;
|
13
13
|
tracks: Map<string, RemoteTrackPublication>;
|
14
14
|
signalClient: SignalClient;
|
15
|
-
private
|
15
|
+
private volumeMap;
|
16
16
|
private audioContext?;
|
17
17
|
private audioOutput?;
|
18
18
|
/** @internal */
|
@@ -23,14 +23,16 @@ export default class RemoteParticipant extends Participant {
|
|
23
23
|
getTrack(source: Track.Source): RemoteTrackPublication | undefined;
|
24
24
|
getTrackByName(name: string): RemoteTrackPublication | undefined;
|
25
25
|
/**
|
26
|
-
* sets the volume on the participant's
|
26
|
+
* sets the volume on the participant's audio track
|
27
|
+
* by default, this affects the microphone publication
|
28
|
+
* a different source can be passed in as a second argument
|
27
29
|
* if no track exists the volume will be applied when the microphone track is added
|
28
30
|
*/
|
29
|
-
setVolume(volume: number): void;
|
31
|
+
setVolume(volume: number, source?: Track.Source.Microphone | Track.Source.ScreenShareAudio): void;
|
30
32
|
/**
|
31
33
|
* gets the volume on the participant's microphone track
|
32
34
|
*/
|
33
|
-
getVolume(): number | undefined;
|
35
|
+
getVolume(source?: Track.Source.Microphone | Track.Source.ScreenShareAudio): number | undefined;
|
34
36
|
/** @internal */
|
35
37
|
addSubscribedMediaTrack(mediaTrack: MediaStreamTrack, sid: Track.SID, mediaStream: MediaStream, receiver?: RTCRtpReceiver, adaptiveStreamSettings?: AdaptiveStreamSettings, triesLeft?: number): RemoteTrackPublication | undefined;
|
36
38
|
/** @internal */
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"RemoteParticipant.d.ts","sourceRoot":"","sources":["../../../../src/room/participant/RemoteParticipant.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAE3D,OAAO,KAAK,EAAE,eAAe,EAAqB,MAAM,4BAA4B,CAAC;AAKrF,OAAO,sBAAsB,MAAM,iCAAiC,CAAC;AAErE,OAAO,EAAE,KAAK,EAAE,MAAM,g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,EAAE,KAAK,CAAC,GAAG,GAAG,sBAAsB,GAAG,SAAS;IAIvE,gBAAgB;IAChB,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO;IAmE1C,gBAAgB;IAChB,cAAc,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,aAAa,CAAC,EAAE,OAAO;IAiCtD;;OAEG;IACH,eAAe,CAAC,GAAG,EAAE,YAAY,GAAG,SAAS;IAO7C;;OAEG;IACG,cAAc,CAAC,MAAM,EAAE,kBAAkB;IAW/C,gBAAgB;IAChB,IAAI,CAAC,CAAC,SAAS,YAAY,CAAC,UAAU,CAAC,yBAAyB,CAAC,EAC/D,KAAK,EAAE,CAAC,EACR,GAAG,IAAI,EAAE,YAAY,CAAC,SAAS,CAAC,yBAAyB,EAAE,CAAC,CAAC,GAC5D,OAAO;CAIX"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/room/track/create.ts"],"names":[],"mappings":"AAIA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAGhD,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,WAAW,CAAC;AAGnB;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../../src/room/track/create.ts"],"names":[],"mappings":"AAIA,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAChD,OAAO,KAAK,UAAU,MAAM,cAAc,CAAC;AAC3C,OAAO,eAAe,MAAM,mBAAmB,CAAC;AAGhD,OAAO,KAAK,EACV,mBAAmB,EACnB,wBAAwB,EACxB,yBAAyB,EACzB,mBAAmB,EACpB,MAAM,WAAW,CAAC;AAGnB;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,OAAO,CAAC,EAAE,wBAAwB,GACjC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAoD5B;AAED;;;GAGG;AACH,wBAAsB,qBAAqB,CACzC,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,eAAe,CAAC,CAM1B;AAED,wBAAsB,qBAAqB,CACzC,OAAO,CAAC,EAAE,mBAAmB,GAC5B,OAAO,CAAC,eAAe,CAAC,CAM1B;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,CAAC,EAAE,yBAAyB,GAClC,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAwC5B"}
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"browserParser.d.ts","sourceRoot":"","sources":["../../../src/utils/browserParser.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;
|
1
|
+
{"version":3,"file":"browserParser.d.ts","sourceRoot":"","sources":["../../../src/utils/browserParser.ts"],"names":[],"mappings":"AAKA,MAAM,MAAM,iBAAiB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,CAAC;AAChE,MAAM,MAAM,YAAY,GAAG,KAAK,GAAG,OAAO,CAAC;AAE3C,MAAM,MAAM,cAAc,GAAG;IAC3B,IAAI,EAAE,iBAAiB,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,CAAC,EAAE,YAAY,CAAC;CACnB,CAAC;AAIF;;GAEG;AACH,wBAAgB,UAAU,CAAC,SAAS,CAAC,EAAE,MAAM,EAAE,KAAK,UAAO,8BAU1D"}
|
@@ -15,6 +15,7 @@ export declare class ParticipantKeyHandler extends EventEmitter<ParticipantKeyHa
|
|
15
15
|
private keyProviderOptions;
|
16
16
|
private ratchetPromiseMap;
|
17
17
|
private participantId;
|
18
|
+
hasValidKey: boolean;
|
18
19
|
constructor(participantId: string | undefined, isEnabled: boolean, keyProviderOptions: KeyProviderOptions);
|
19
20
|
setEnabled(enabled: boolean): void;
|
20
21
|
/**
|
@@ -25,6 +26,13 @@ export declare class ParticipantKeyHandler extends EventEmitter<ParticipantKeyHa
|
|
25
26
|
* @param setKey
|
26
27
|
*/
|
27
28
|
ratchetKey(keyIndex?: number, setKey?: boolean): Promise<CryptoKey>;
|
29
|
+
/**
|
30
|
+
* takes in a key material with `deriveBits` and `deriveKey` set as key usages
|
31
|
+
* and derives encryption keys from the material and sets it on the key ring buffer
|
32
|
+
* together with the material
|
33
|
+
* also resets the valid key property and updates the currentKeyIndex
|
34
|
+
*/
|
35
|
+
setKey(material: CryptoKey, keyIndex?: number): Promise<void>;
|
28
36
|
/**
|
29
37
|
* takes in a key material with `deriveBits` and `deriveKey` set as key usages
|
30
38
|
* and derives encryption keys from the material and sets it on the key ring buffer
|
@@ -12,7 +12,7 @@ export default class RemoteParticipant extends Participant {
|
|
12
12
|
videoTracks: Map<string, RemoteTrackPublication>;
|
13
13
|
tracks: Map<string, RemoteTrackPublication>;
|
14
14
|
signalClient: SignalClient;
|
15
|
-
private
|
15
|
+
private volumeMap;
|
16
16
|
private audioContext?;
|
17
17
|
private audioOutput?;
|
18
18
|
/** @internal */
|
@@ -23,14 +23,16 @@ export default class RemoteParticipant extends Participant {
|
|
23
23
|
getTrack(source: Track.Source): RemoteTrackPublication | undefined;
|
24
24
|
getTrackByName(name: string): RemoteTrackPublication | undefined;
|
25
25
|
/**
|
26
|
-
* sets the volume on the participant's
|
26
|
+
* sets the volume on the participant's audio track
|
27
|
+
* by default, this affects the microphone publication
|
28
|
+
* a different source can be passed in as a second argument
|
27
29
|
* if no track exists the volume will be applied when the microphone track is added
|
28
30
|
*/
|
29
|
-
setVolume(volume: number): void;
|
31
|
+
setVolume(volume: number, source?: Track.Source.Microphone | Track.Source.ScreenShareAudio): void;
|
30
32
|
/**
|
31
33
|
* gets the volume on the participant's microphone track
|
32
34
|
*/
|
33
|
-
getVolume(): number | undefined;
|
35
|
+
getVolume(source?: Track.Source.Microphone | Track.Source.ScreenShareAudio): number | undefined;
|
34
36
|
/** @internal */
|
35
37
|
addSubscribedMediaTrack(mediaTrack: MediaStreamTrack, sid: Track.SID, mediaStream: MediaStream, receiver?: RTCRtpReceiver, adaptiveStreamSettings?: AdaptiveStreamSettings, triesLeft?: number): RemoteTrackPublication | undefined;
|
36
38
|
/** @internal */
|
package/package.json
CHANGED
@@ -49,8 +49,6 @@ export class BaseFrameCryptor extends EventEmitter<CryptorCallbacks> {
|
|
49
49
|
export class FrameCryptor extends BaseFrameCryptor {
|
50
50
|
private sendCounts: Map<number, number>;
|
51
51
|
|
52
|
-
private isKeyInvalid = false;
|
53
|
-
|
54
52
|
private participantId: string | undefined;
|
55
53
|
|
56
54
|
private trackId: string | undefined;
|
@@ -270,16 +268,15 @@ export class FrameCryptor extends BaseFrameCryptor {
|
|
270
268
|
const data = new Uint8Array(encodedFrame.data);
|
271
269
|
const keyIndex = data[encodedFrame.data.byteLength - 1];
|
272
270
|
|
273
|
-
if (this.keys.getKeySet(keyIndex)) {
|
271
|
+
if (this.keys.getKeySet(keyIndex) && this.keys.hasValidKey) {
|
274
272
|
try {
|
275
273
|
const decodedFrame = await this.decryptFrame(encodedFrame, keyIndex);
|
276
274
|
if (decodedFrame) {
|
277
275
|
return controller.enqueue(decodedFrame);
|
278
276
|
}
|
279
|
-
this.isKeyInvalid = false;
|
280
277
|
} catch (error) {
|
281
278
|
if (error instanceof CryptorError && error.reason === CryptorErrorReason.InvalidKey) {
|
282
|
-
if (
|
279
|
+
if (this.keys.hasValidKey) {
|
283
280
|
workerLogger.warn('invalid key');
|
284
281
|
this.emit(
|
285
282
|
CryptorEvent.Error,
|
@@ -288,20 +285,12 @@ export class FrameCryptor extends BaseFrameCryptor {
|
|
288
285
|
CryptorErrorReason.InvalidKey,
|
289
286
|
),
|
290
287
|
);
|
291
|
-
this.
|
288
|
+
this.keys.hasValidKey = false;
|
292
289
|
}
|
293
290
|
} else {
|
294
291
|
workerLogger.warn('decoding frame failed', { error });
|
295
292
|
}
|
296
293
|
}
|
297
|
-
} else {
|
298
|
-
this.emit(
|
299
|
-
CryptorEvent.Error,
|
300
|
-
new CryptorError(
|
301
|
-
`key missing for participant ${this.participantId}`,
|
302
|
-
CryptorErrorReason.MissingKey,
|
303
|
-
),
|
304
|
-
);
|
305
294
|
}
|
306
295
|
|
307
296
|
return controller.enqueue(encodedFrame);
|
@@ -406,7 +395,16 @@ export class FrameCryptor extends BaseFrameCryptor {
|
|
406
395
|
this.keys.setKeyFromMaterial(initialMaterial.material, keyIndex);
|
407
396
|
}
|
408
397
|
|
398
|
+
this.keys.hasValidKey = false;
|
399
|
+
|
409
400
|
workerLogger.warn('maximum ratchet attempts exceeded, resetting key');
|
401
|
+
this.emit(
|
402
|
+
CryptorEvent.Error,
|
403
|
+
new CryptorError(
|
404
|
+
`valid key missing for participant ${this.participantId}`,
|
405
|
+
CryptorErrorReason.MissingKey,
|
406
|
+
),
|
407
|
+
);
|
410
408
|
}
|
411
409
|
} else {
|
412
410
|
throw new CryptorError(
|
@@ -28,6 +28,8 @@ export class ParticipantKeyHandler extends EventEmitter<ParticipantKeyHandlerCal
|
|
28
28
|
|
29
29
|
private participantId: string | undefined;
|
30
30
|
|
31
|
+
hasValidKey: boolean;
|
32
|
+
|
31
33
|
constructor(
|
32
34
|
participantId: string | undefined,
|
33
35
|
isEnabled: boolean,
|
@@ -40,6 +42,7 @@ export class ParticipantKeyHandler extends EventEmitter<ParticipantKeyHandlerCal
|
|
40
42
|
this.keyProviderOptions = keyProviderOptions;
|
41
43
|
this.ratchetPromiseMap = new Map();
|
42
44
|
this.participantId = participantId;
|
45
|
+
this.hasValidKey = false;
|
43
46
|
}
|
44
47
|
|
45
48
|
setEnabled(enabled: boolean) {
|
@@ -84,6 +87,17 @@ export class ParticipantKeyHandler extends EventEmitter<ParticipantKeyHandlerCal
|
|
84
87
|
return ratchetPromise;
|
85
88
|
}
|
86
89
|
|
90
|
+
/**
|
91
|
+
* takes in a key material with `deriveBits` and `deriveKey` set as key usages
|
92
|
+
* and derives encryption keys from the material and sets it on the key ring buffer
|
93
|
+
* together with the material
|
94
|
+
* also resets the valid key property and updates the currentKeyIndex
|
95
|
+
*/
|
96
|
+
async setKey(material: CryptoKey, keyIndex = 0) {
|
97
|
+
await this.setKeyFromMaterial(material, keyIndex);
|
98
|
+
this.hasValidKey = true;
|
99
|
+
}
|
100
|
+
|
87
101
|
/**
|
88
102
|
* takes in a key material with `deriveBits` and `deriveKey` set as key usages
|
89
103
|
* and derives encryption keys from the material and sets it on the key ring buffer
|
@@ -108,6 +122,7 @@ export class ParticipantKeyHandler extends EventEmitter<ParticipantKeyHandlerCal
|
|
108
122
|
|
109
123
|
async setCurrentKeyIndex(index: number) {
|
110
124
|
this.currentKeyIndex = index % this.cryptoKeyRing.length;
|
125
|
+
this.hasValidKey = true;
|
111
126
|
}
|
112
127
|
|
113
128
|
isEnabled() {
|
@@ -7,6 +7,7 @@ import type {
|
|
7
7
|
ErrorMessage,
|
8
8
|
KeyProviderOptions,
|
9
9
|
RatchetMessage,
|
10
|
+
RatchetRequestMessage,
|
10
11
|
} from '../types';
|
11
12
|
import { FrameCryptor } from './FrameCryptor';
|
12
13
|
import { ParticipantKeyHandler } from './ParticipantKeyHandler';
|
@@ -75,7 +76,7 @@ onmessage = (ev) => {
|
|
75
76
|
workerLogger.debug('set shared key');
|
76
77
|
setSharedKey(data.key, data.keyIndex);
|
77
78
|
} else if (data.participantId) {
|
78
|
-
getParticipantKeyHandler(data.participantId).
|
79
|
+
getParticipantKeyHandler(data.participantId).setKey(data.key, data.keyIndex);
|
79
80
|
} else {
|
80
81
|
workerLogger.error('no participant Id was provided and shared key usage is disabled');
|
81
82
|
}
|
@@ -92,13 +93,18 @@ onmessage = (ev) => {
|
|
92
93
|
});
|
93
94
|
break;
|
94
95
|
case 'ratchetRequest':
|
95
|
-
|
96
|
-
|
96
|
+
handleRatchetRequest(data);
|
97
97
|
default:
|
98
98
|
break;
|
99
99
|
}
|
100
100
|
};
|
101
101
|
|
102
|
+
async function handleRatchetRequest(data: RatchetRequestMessage['data']) {
|
103
|
+
const keyHandler = getParticipantKeyHandler(data.participantId);
|
104
|
+
await keyHandler.ratchetKey(data.keyIndex);
|
105
|
+
keyHandler.hasValidKey = true;
|
106
|
+
}
|
107
|
+
|
102
108
|
function getTrackCryptor(participantId: string, trackId: string) {
|
103
109
|
let cryptor = participantCryptors.find((c) => c.getTrackId() === trackId);
|
104
110
|
if (!cryptor) {
|
@@ -131,7 +137,7 @@ function getParticipantKeyHandler(participantId?: string) {
|
|
131
137
|
if (!keys) {
|
132
138
|
keys = new ParticipantKeyHandler(participantId, true, keyProviderOptions);
|
133
139
|
if (sharedKey) {
|
134
|
-
keys.
|
140
|
+
keys.setKey(sharedKey);
|
135
141
|
}
|
136
142
|
participantKeys.set(participantId, keys);
|
137
143
|
}
|
@@ -171,9 +177,9 @@ function setEncryptionEnabled(enable: boolean, participantId?: string) {
|
|
171
177
|
function setSharedKey(key: CryptoKey, index?: number) {
|
172
178
|
workerLogger.debug('setting shared key');
|
173
179
|
sharedKey = key;
|
174
|
-
publisherKeys?.
|
180
|
+
publisherKeys?.setKey(key, index);
|
175
181
|
for (const [, keyHandler] of participantKeys) {
|
176
|
-
keyHandler.
|
182
|
+
keyHandler.setKey(key, index);
|
177
183
|
}
|
178
184
|
}
|
179
185
|
|
package/src/room/Room.ts
CHANGED
@@ -33,6 +33,7 @@ import {
|
|
33
33
|
SubscriptionPermissionUpdate,
|
34
34
|
SubscriptionResponse,
|
35
35
|
} from '../proto/livekit_rtc';
|
36
|
+
import { getBrowser } from '../utils/browserParser';
|
36
37
|
import DeviceManager from './DeviceManager';
|
37
38
|
import RTCEngine from './RTCEngine';
|
38
39
|
import { RegionUrlProvider } from './RegionUrlProvider';
|
@@ -66,7 +67,6 @@ import {
|
|
66
67
|
createDummyVideoStreamTrack,
|
67
68
|
getEmptyAudioStreamTrack,
|
68
69
|
isCloud,
|
69
|
-
isSafari,
|
70
70
|
isWeb,
|
71
71
|
supportsSetSinkId,
|
72
72
|
unpackStreamId,
|
@@ -718,10 +718,10 @@ class Room extends EventEmitter<RoomEventCallbacks> {
|
|
718
718
|
async startAudio() {
|
719
719
|
await this.acquireAudioContext();
|
720
720
|
const elements: Array<HTMLMediaElement> = [];
|
721
|
-
|
722
|
-
if (
|
721
|
+
const browser = getBrowser();
|
722
|
+
if (browser && browser.os === 'iOS') {
|
723
723
|
/**
|
724
|
-
* iOS
|
724
|
+
* iOS blocks audio element playback if
|
725
725
|
* - user is not publishing audio themselves and
|
726
726
|
* - no other audio source is playing
|
727
727
|
*
|
@@ -732,6 +732,7 @@ class Room extends EventEmitter<RoomEventCallbacks> {
|
|
732
732
|
let dummyAudioEl = document.getElementById(audioId) as HTMLAudioElement | null;
|
733
733
|
if (!dummyAudioEl) {
|
734
734
|
dummyAudioEl = document.createElement('audio');
|
735
|
+
dummyAudioEl.id = audioId;
|
735
736
|
dummyAudioEl.autoplay = true;
|
736
737
|
dummyAudioEl.hidden = true;
|
737
738
|
const track = getEmptyAudioStreamTrack();
|
@@ -833,7 +834,7 @@ class Room extends EventEmitter<RoomEventCallbacks> {
|
|
833
834
|
} else if (kind === 'audiooutput') {
|
834
835
|
if (
|
835
836
|
(!supportsSetSinkId() && !this.options.expWebAudioMix) ||
|
836
|
-
(this.audioContext && !('setSinkId' in this.audioContext))
|
837
|
+
(this.options.expWebAudioMix && this.audioContext && !('setSinkId' in this.audioContext))
|
837
838
|
) {
|
838
839
|
throw new Error('cannot switch audio output, setSinkId not supported');
|
839
840
|
}
|
@@ -1303,13 +1304,22 @@ class Room extends EventEmitter<RoomEventCallbacks> {
|
|
1303
1304
|
) {
|
1304
1305
|
// override audio context with custom audio context if supplied by user
|
1305
1306
|
this.audioContext = this.options.expWebAudioMix.audioContext;
|
1306
|
-
|
1307
|
-
} else {
|
1307
|
+
} else if (!this.audioContext || this.audioContext.state === 'closed') {
|
1308
1308
|
// by using an AudioContext, it reduces lag on audio elements
|
1309
1309
|
// https://stackoverflow.com/questions/9811429/html5-audio-tag-on-safari-has-a-delay/54119854#54119854
|
1310
1310
|
this.audioContext = getNewAudioContext() ?? undefined;
|
1311
1311
|
}
|
1312
1312
|
|
1313
|
+
if (this.audioContext && this.audioContext.state === 'suspended') {
|
1314
|
+
// for iOS a newly created AudioContext is always in `suspended` state.
|
1315
|
+
// we try our best to resume the context here, if that doesn't work, we just continue with regular processing
|
1316
|
+
try {
|
1317
|
+
await this.audioContext.resume();
|
1318
|
+
} catch (e: any) {
|
1319
|
+
log.warn(e);
|
1320
|
+
}
|
1321
|
+
}
|
1322
|
+
|
1313
1323
|
if (this.options.expWebAudioMix) {
|
1314
1324
|
this.participants.forEach((participant) => participant.setAudioContext(this.audioContext));
|
1315
1325
|
}
|
@@ -24,7 +24,7 @@ export default class RemoteParticipant extends Participant {
|
|
24
24
|
|
25
25
|
signalClient: SignalClient;
|
26
26
|
|
27
|
-
private
|
27
|
+
private volumeMap: Map<Track.Source, number>;
|
28
28
|
|
29
29
|
private audioContext?: AudioContext;
|
30
30
|
|
@@ -48,6 +48,7 @@ export default class RemoteParticipant extends Participant {
|
|
48
48
|
this.tracks = new Map();
|
49
49
|
this.audioTracks = new Map();
|
50
50
|
this.videoTracks = new Map();
|
51
|
+
this.volumeMap = new Map();
|
51
52
|
}
|
52
53
|
|
53
54
|
protected addTrackPublication(publication: RemoteTrackPublication) {
|
@@ -102,12 +103,17 @@ export default class RemoteParticipant extends Participant {
|
|
102
103
|
}
|
103
104
|
|
104
105
|
/**
|
105
|
-
* sets the volume on the participant's
|
106
|
+
* sets the volume on the participant's audio track
|
107
|
+
* by default, this affects the microphone publication
|
108
|
+
* a different source can be passed in as a second argument
|
106
109
|
* if no track exists the volume will be applied when the microphone track is added
|
107
110
|
*/
|
108
|
-
setVolume(
|
109
|
-
|
110
|
-
|
111
|
+
setVolume(
|
112
|
+
volume: number,
|
113
|
+
source: Track.Source.Microphone | Track.Source.ScreenShareAudio = Track.Source.Microphone,
|
114
|
+
) {
|
115
|
+
this.volumeMap.set(source, volume);
|
116
|
+
const audioPublication = this.getTrack(source);
|
111
117
|
if (audioPublication && audioPublication.track) {
|
112
118
|
(audioPublication.track as RemoteAudioTrack).setVolume(volume);
|
113
119
|
}
|
@@ -116,12 +122,14 @@ export default class RemoteParticipant extends Participant {
|
|
116
122
|
/**
|
117
123
|
* gets the volume on the participant's microphone track
|
118
124
|
*/
|
119
|
-
getVolume(
|
120
|
-
|
125
|
+
getVolume(
|
126
|
+
source: Track.Source.Microphone | Track.Source.ScreenShareAudio = Track.Source.Microphone,
|
127
|
+
) {
|
128
|
+
const audioPublication = this.getTrack(source);
|
121
129
|
if (audioPublication && audioPublication.track) {
|
122
130
|
return (audioPublication.track as RemoteAudioTrack).getVolume();
|
123
131
|
}
|
124
|
-
return this.
|
132
|
+
return this.volumeMap.get(source);
|
125
133
|
}
|
126
134
|
|
127
135
|
/** @internal */
|
@@ -198,13 +206,9 @@ export default class RemoteParticipant extends Participant {
|
|
198
206
|
track.start();
|
199
207
|
|
200
208
|
publication.setTrack(track);
|
201
|
-
// set participant
|
202
|
-
if (
|
203
|
-
this.
|
204
|
-
track instanceof RemoteAudioTrack &&
|
205
|
-
track.source === Track.Source.Microphone
|
206
|
-
) {
|
207
|
-
track.setVolume(this.volume);
|
209
|
+
// set participant volumes on new audio tracks
|
210
|
+
if (this.volumeMap.has(publication.source) && track instanceof RemoteAudioTrack) {
|
211
|
+
track.setVolume(this.volumeMap.get(publication.source)!);
|
208
212
|
}
|
209
213
|
|
210
214
|
return publication;
|
package/src/room/track/create.ts
CHANGED
@@ -57,6 +57,15 @@ export async function createLocalTracks(
|
|
57
57
|
if (typeof conOrBool !== 'boolean') {
|
58
58
|
trackConstraints = conOrBool;
|
59
59
|
}
|
60
|
+
|
61
|
+
// update the constraints with the device id the user gave permissions to in the permission prompt
|
62
|
+
// otherwise each track restart (e.g. mute - unmute) will try to initialize the device again -> causing additional permission prompts
|
63
|
+
if (trackConstraints) {
|
64
|
+
trackConstraints.deviceId = mediaStreamTrack.getSettings().deviceId;
|
65
|
+
} else {
|
66
|
+
trackConstraints = { deviceId: mediaStreamTrack.getSettings().deviceId };
|
67
|
+
}
|
68
|
+
|
60
69
|
const track = mediaTrackToLocalTrack(mediaStreamTrack, trackConstraints);
|
61
70
|
if (track.kind === Track.Kind.Video) {
|
62
71
|
track.source = Track.Source.Camera;
|
@@ -4,10 +4,12 @@
|
|
4
4
|
const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i;
|
5
5
|
|
6
6
|
export type DetectableBrowser = 'Chrome' | 'Firefox' | 'Safari';
|
7
|
+
export type DetectableOS = 'iOS' | 'macOS';
|
7
8
|
|
8
9
|
export type BrowserDetails = {
|
9
10
|
name: DetectableBrowser;
|
10
11
|
version: string;
|
12
|
+
os?: DetectableOS;
|
11
13
|
};
|
12
14
|
|
13
15
|
let browserDetails: BrowserDetails | undefined;
|
@@ -34,6 +36,7 @@ const browsersList = [
|
|
34
36
|
const browser: BrowserDetails = {
|
35
37
|
name: 'Firefox',
|
36
38
|
version: getMatch(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i, ua),
|
39
|
+
os: ua.toLowerCase().includes('fxios') ? 'iOS' : undefined,
|
37
40
|
};
|
38
41
|
return browser;
|
39
42
|
},
|
@@ -44,6 +47,7 @@ const browsersList = [
|
|
44
47
|
const browser: BrowserDetails = {
|
45
48
|
name: 'Chrome',
|
46
49
|
version: getMatch(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i, ua),
|
50
|
+
os: ua.toLowerCase().includes('crios') ? 'iOS' : undefined,
|
47
51
|
};
|
48
52
|
|
49
53
|
return browser;
|
@@ -56,6 +60,7 @@ const browsersList = [
|
|
56
60
|
const browser: BrowserDetails = {
|
57
61
|
name: 'Safari',
|
58
62
|
version: getMatch(commonVersionIdentifier, ua),
|
63
|
+
os: ua.includes('Mobile/') ? 'iOS' : 'macOS',
|
59
64
|
};
|
60
65
|
|
61
66
|
return browser;
|