@whereby.com/media 7.0.0 → 7.0.1
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/index.cjs +31 -11
- package/dist/index.d.cts +251 -249
- package/dist/index.d.mts +251 -249
- package/dist/index.d.ts +251 -249
- package/dist/index.mjs +31 -11
- package/dist/legacy-esm.js +31 -11
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -245,6 +245,7 @@ class Logger {
|
|
|
245
245
|
}
|
|
246
246
|
}
|
|
247
247
|
|
|
248
|
+
const logger$b = new Logger();
|
|
248
249
|
const AUDIO_SETTINGS = {
|
|
249
250
|
codecOptions: {
|
|
250
251
|
opusDtx: true,
|
|
@@ -419,7 +420,14 @@ function getIsCodecDecodingPowerEfficient(codec) {
|
|
|
419
420
|
}
|
|
420
421
|
function sortCodecsByPowerEfficiency(codecs) {
|
|
421
422
|
return __awaiter(this, void 0, void 0, function* () {
|
|
422
|
-
|
|
423
|
+
let codecPowerEfficiencyEntries;
|
|
424
|
+
try {
|
|
425
|
+
codecPowerEfficiencyEntries = yield Promise.all(codecs.map(({ mimeType }) => getIsCodecDecodingPowerEfficient(mimeType).then((val) => [mimeType, val])));
|
|
426
|
+
}
|
|
427
|
+
catch (error) {
|
|
428
|
+
logger$b.error(error);
|
|
429
|
+
return codecs;
|
|
430
|
+
}
|
|
423
431
|
const codecPowerEfficiencies = Object.fromEntries(codecPowerEfficiencyEntries);
|
|
424
432
|
const sorted = codecs.sort((a, b) => {
|
|
425
433
|
const aPowerEfficient = codecPowerEfficiencies[a.mimeType];
|
|
@@ -2553,6 +2561,9 @@ class P2pRtcManager {
|
|
|
2553
2561
|
this._features = features || {};
|
|
2554
2562
|
this._isAudioOnlyMode = false;
|
|
2555
2563
|
this._closed = false;
|
|
2564
|
+
this._fetchMediaServersTimer = null;
|
|
2565
|
+
this._stopCameraTimeout = null;
|
|
2566
|
+
this._icePublicIPGatheringTimeoutID = null;
|
|
2556
2567
|
this.offerOptions = { offerToReceiveAudio: true, offerToReceiveVideo: true };
|
|
2557
2568
|
this._audioTrackOnEnded = () => {
|
|
2558
2569
|
rtcStats.sendEvent("audio_ended", { unloading: unloading$1 });
|
|
@@ -2754,6 +2765,7 @@ class P2pRtcManager {
|
|
|
2754
2765
|
message: answer,
|
|
2755
2766
|
});
|
|
2756
2767
|
})).catch) === null || _b === void 0 ? void 0 : _b.call(_a, (e) => {
|
|
2768
|
+
logger$6.error(e);
|
|
2757
2769
|
this.analytics.numPcOnOfferFailure++;
|
|
2758
2770
|
});
|
|
2759
2771
|
}),
|
|
@@ -3161,11 +3173,12 @@ class P2pRtcManager {
|
|
|
3161
3173
|
return session;
|
|
3162
3174
|
}
|
|
3163
3175
|
_maybeRestartIce(clientId, session) {
|
|
3176
|
+
var _a;
|
|
3164
3177
|
const pc = session.pc;
|
|
3165
3178
|
if (!(pc.iceConnectionState === "disconnected" || pc.iceConnectionState === "failed")) {
|
|
3166
3179
|
return;
|
|
3167
3180
|
}
|
|
3168
|
-
if (pc.localDescription.type === "offer") {
|
|
3181
|
+
if (((_a = pc.localDescription) === null || _a === void 0 ? void 0 : _a.type) === "offer") {
|
|
3169
3182
|
session.wasEverConnected = false;
|
|
3170
3183
|
session.relayCandidateSeen = false;
|
|
3171
3184
|
session.serverReflexiveCandidateSeen = false;
|
|
@@ -3244,7 +3257,7 @@ class P2pRtcManager {
|
|
|
3244
3257
|
}
|
|
3245
3258
|
if (rtpAbsCaptureTimeOn)
|
|
3246
3259
|
offer.sdp = addAbsCaptureTimeExtMap(offer.sdp);
|
|
3247
|
-
if (browserName$1 === "firefox") {
|
|
3260
|
+
if (browserName$1 === "firefox" && browserVersion < 128) {
|
|
3248
3261
|
offer.sdp = setCodecPreferenceSDP({
|
|
3249
3262
|
sdp: offer.sdp,
|
|
3250
3263
|
redOn,
|
|
@@ -3334,9 +3347,9 @@ class P2pRtcManager {
|
|
|
3334
3347
|
const connection = event.target;
|
|
3335
3348
|
switch (connection.iceGatheringState) {
|
|
3336
3349
|
case "gathering":
|
|
3337
|
-
if (this.
|
|
3338
|
-
clearTimeout(this.
|
|
3339
|
-
this.
|
|
3350
|
+
if (this._icePublicIPGatheringTimeoutID)
|
|
3351
|
+
clearTimeout(this._icePublicIPGatheringTimeoutID);
|
|
3352
|
+
this._icePublicIPGatheringTimeoutID = setTimeout(() => {
|
|
3340
3353
|
if (!session.publicHostCandidateSeen &&
|
|
3341
3354
|
!session.relayCandidateSeen &&
|
|
3342
3355
|
!session.serverReflexiveCandidateSeen) {
|
|
@@ -3346,9 +3359,9 @@ class P2pRtcManager {
|
|
|
3346
3359
|
}, ICE_PUBLIC_IP_GATHERING_TIMEOUT);
|
|
3347
3360
|
break;
|
|
3348
3361
|
case "complete":
|
|
3349
|
-
if (this.
|
|
3350
|
-
clearTimeout(this.
|
|
3351
|
-
this.
|
|
3362
|
+
if (this._icePublicIPGatheringTimeoutID)
|
|
3363
|
+
clearTimeout(this._icePublicIPGatheringTimeoutID);
|
|
3364
|
+
this._icePublicIPGatheringTimeoutID = null;
|
|
3352
3365
|
break;
|
|
3353
3366
|
}
|
|
3354
3367
|
};
|
|
@@ -3497,9 +3510,13 @@ class P2pRtcManager {
|
|
|
3497
3510
|
if (!["chrome", "safari"].includes(browserName$1)) {
|
|
3498
3511
|
return;
|
|
3499
3512
|
}
|
|
3513
|
+
if (this._stopCameraTimeout) {
|
|
3514
|
+
clearTimeout(this._stopCameraTimeout);
|
|
3515
|
+
this._stopCameraTimeout = null;
|
|
3516
|
+
}
|
|
3500
3517
|
if (enable === false) {
|
|
3501
3518
|
const stopCameraDelay = ((_a = localStream.getVideoTracks().find((t) => !t.enabled)) === null || _a === void 0 ? void 0 : _a.readyState) === "ended" ? 0 : 5000;
|
|
3502
|
-
setTimeout(() => {
|
|
3519
|
+
this._stopCameraTimeout = setTimeout(() => {
|
|
3503
3520
|
localStream.getVideoTracks().forEach((track) => {
|
|
3504
3521
|
if (track.enabled === false) {
|
|
3505
3522
|
track.stop();
|
|
@@ -5453,8 +5470,11 @@ class VegaRtcManager {
|
|
|
5453
5470
|
if (!["chrome", "safari"].includes(browserName)) {
|
|
5454
5471
|
return;
|
|
5455
5472
|
}
|
|
5456
|
-
if (
|
|
5473
|
+
if (this._stopCameraTimeout) {
|
|
5457
5474
|
clearTimeout(this._stopCameraTimeout);
|
|
5475
|
+
this._stopCameraTimeout = null;
|
|
5476
|
+
}
|
|
5477
|
+
if (!enable) {
|
|
5458
5478
|
const stopCameraDelay = ((_a = localStream.getVideoTracks().find((t) => !t.enabled)) === null || _a === void 0 ? void 0 : _a.readyState) === "ended" ? 0 : 5000;
|
|
5459
5479
|
this._stopCameraTimeout = setTimeout(() => {
|
|
5460
5480
|
localStream.getVideoTracks().forEach((track) => {
|