livekit-client 2.9.0 → 2.9.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/livekit-client.esm.mjs +393 -75
- 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/connectionHelper/ConnectionCheck.d.ts +2 -0
- package/dist/src/connectionHelper/ConnectionCheck.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/Checker.d.ts +5 -2
- package/dist/src/connectionHelper/checks/Checker.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/cloudRegion.d.ts +17 -0
- package/dist/src/connectionHelper/checks/cloudRegion.d.ts.map +1 -0
- package/dist/src/connectionHelper/checks/connectionProtocol.d.ts +19 -0
- package/dist/src/connectionHelper/checks/connectionProtocol.d.ts.map +1 -0
- package/dist/src/connectionHelper/checks/publishAudio.d.ts.map +1 -1
- package/dist/src/connectionHelper/checks/publishVideo.d.ts +1 -0
- package/dist/src/connectionHelper/checks/publishVideo.d.ts.map +1 -1
- package/dist/src/index.d.ts +2 -2
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/room/StreamReader.d.ts +4 -4
- package/dist/src/room/StreamReader.d.ts.map +1 -1
- package/dist/src/room/StreamWriter.d.ts +3 -3
- package/dist/src/room/StreamWriter.d.ts.map +1 -1
- package/dist/src/room/participant/LocalParticipant.d.ts.map +1 -1
- package/dist/src/room/participant/publishUtils.d.ts.map +1 -1
- package/dist/src/room/track/LocalTrack.d.ts.map +1 -1
- package/dist/src/room/track/create.d.ts.map +1 -1
- package/dist/src/room/types.d.ts +0 -5
- package/dist/src/room/types.d.ts.map +1 -1
- package/dist/src/room/utils.d.ts +1 -0
- package/dist/src/room/utils.d.ts.map +1 -1
- package/dist/ts4.2/src/connectionHelper/ConnectionCheck.d.ts +2 -0
- package/dist/ts4.2/src/connectionHelper/checks/Checker.d.ts +5 -2
- package/dist/ts4.2/src/connectionHelper/checks/cloudRegion.d.ts +18 -0
- package/dist/ts4.2/src/connectionHelper/checks/connectionProtocol.d.ts +20 -0
- package/dist/ts4.2/src/connectionHelper/checks/publishVideo.d.ts +1 -0
- package/dist/ts4.2/src/index.d.ts +2 -2
- package/dist/ts4.2/src/room/StreamReader.d.ts +4 -4
- package/dist/ts4.2/src/room/StreamWriter.d.ts +3 -12
- package/dist/ts4.2/src/room/types.d.ts +0 -5
- package/dist/ts4.2/src/room/utils.d.ts +1 -0
- package/package.json +17 -17
- package/src/connectionHelper/ConnectionCheck.ts +15 -0
- package/src/connectionHelper/checks/Checker.ts +41 -8
- package/src/connectionHelper/checks/cloudRegion.ts +94 -0
- package/src/connectionHelper/checks/connectionProtocol.ts +149 -0
- package/src/connectionHelper/checks/publishAudio.ts +8 -0
- package/src/connectionHelper/checks/publishVideo.ts +52 -0
- package/src/index.ts +1 -1
- package/src/room/StreamReader.ts +9 -16
- package/src/room/StreamWriter.ts +4 -4
- package/src/room/participant/LocalParticipant.ts +9 -26
- package/src/room/participant/publishUtils.ts +4 -0
- package/src/room/track/LocalTrack.ts +5 -2
- package/src/room/track/create.ts +9 -5
- package/src/room/types.ts +0 -6
- package/src/room/utils.ts +16 -0
package/src/room/track/create.ts
CHANGED
@@ -2,7 +2,7 @@ import DeviceManager from '../DeviceManager';
|
|
2
2
|
import { audioDefaults, videoDefaults } from '../defaults';
|
3
3
|
import { DeviceUnsupportedError, TrackInvalidError } from '../errors';
|
4
4
|
import { mediaTrackToLocalTrack } from '../participant/publishUtils';
|
5
|
-
import { isAudioTrack, isSafari17, isVideoTrack } from '../utils';
|
5
|
+
import { isAudioTrack, isSafari17, isVideoTrack, unwrapConstraint } from '../utils';
|
6
6
|
import LocalAudioTrack from './LocalAudioTrack';
|
7
7
|
import type LocalTrack from './LocalTrack';
|
8
8
|
import LocalVideoTrack from './LocalVideoTrack';
|
@@ -68,10 +68,14 @@ export async function createLocalTracks(
|
|
68
68
|
|
69
69
|
// update the constraints with the device id the user gave permissions to in the permission prompt
|
70
70
|
// otherwise each track restart (e.g. mute - unmute) will try to initialize the device again -> causing additional permission prompts
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
trackConstraints
|
71
|
+
const newDeviceId = mediaStreamTrack.getSettings().deviceId;
|
72
|
+
if (
|
73
|
+
trackConstraints?.deviceId &&
|
74
|
+
unwrapConstraint(trackConstraints.deviceId) !== newDeviceId
|
75
|
+
) {
|
76
|
+
trackConstraints.deviceId = newDeviceId;
|
77
|
+
} else if (!trackConstraints) {
|
78
|
+
trackConstraints = { deviceId: newDeviceId };
|
75
79
|
}
|
76
80
|
|
77
81
|
const track = mediaTrackToLocalTrack(mediaStreamTrack, trackConstraints);
|
package/src/room/types.ts
CHANGED
package/src/room/utils.ts
CHANGED
@@ -625,3 +625,19 @@ export function isLocalParticipant(p: Participant): p is LocalParticipant {
|
|
625
625
|
export function isRemoteParticipant(p: Participant): p is RemoteParticipant {
|
626
626
|
return !p.isLocal;
|
627
627
|
}
|
628
|
+
|
629
|
+
export function splitUtf8(s: string, n: number): string[] {
|
630
|
+
// adapted from https://stackoverflow.com/a/6043797
|
631
|
+
const result: string[] = [];
|
632
|
+
while (s.length > n) {
|
633
|
+
let k = n;
|
634
|
+
// Move back to find the start of a UTF-8 character
|
635
|
+
while ((s.charCodeAt(k) & 0xc0) === 0x80) {
|
636
|
+
k--;
|
637
|
+
}
|
638
|
+
result.push(s.slice(0, k));
|
639
|
+
s = s.slice(k);
|
640
|
+
}
|
641
|
+
result.push(s);
|
642
|
+
return result;
|
643
|
+
}
|