@whereby.com/media 9.6.1 → 9.7.0
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 +109 -27
- package/dist/index.d.cts +9 -3
- package/dist/index.d.mts +9 -3
- package/dist/index.d.ts +9 -3
- package/dist/index.mjs +109 -28
- package/dist/legacy-esm.js +109 -28
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2498,18 +2498,19 @@ function getMediaConstraints({ disableAEC, disableAGC, hd, lax, lowDataMode, pre
|
|
|
2498
2498
|
return constraints;
|
|
2499
2499
|
}
|
|
2500
2500
|
function getConstraints({ devices, videoId, audioId, options, type = "ideal" }) {
|
|
2501
|
-
const
|
|
2502
|
-
const
|
|
2503
|
-
const
|
|
2504
|
-
const
|
|
2501
|
+
const strict = !!devices;
|
|
2502
|
+
const audioDevices = devices === null || devices === void 0 ? void 0 : devices.filter((d) => d.kind === "audioinput");
|
|
2503
|
+
const videoDevices = devices === null || devices === void 0 ? void 0 : devices.filter((d) => d.kind === "videoinput");
|
|
2504
|
+
const useDefaultAudio = !audioId || (strict && !(audioDevices === null || audioDevices === void 0 ? void 0 : audioDevices.some((d) => d.deviceId === audioId)));
|
|
2505
|
+
const useDefaultVideo = !videoId || (strict && !(videoDevices === null || videoDevices === void 0 ? void 0 : videoDevices.some((d) => d.deviceId === videoId)));
|
|
2505
2506
|
const constraints = getMediaConstraints(Object.assign({ preferredDeviceIds: {
|
|
2506
2507
|
audioId: useDefaultAudio ? null : { [type]: audioId },
|
|
2507
2508
|
videoId: useDefaultVideo ? null : { [type]: videoId },
|
|
2508
2509
|
} }, options));
|
|
2509
|
-
if (audioId === false || !audioDevices.length) {
|
|
2510
|
+
if (audioId === false || (strict && !(audioDevices === null || audioDevices === void 0 ? void 0 : audioDevices.length))) {
|
|
2510
2511
|
delete constraints.audio;
|
|
2511
2512
|
}
|
|
2512
|
-
if (videoId === false || !videoDevices.length) {
|
|
2513
|
+
if (videoId === false || (strict && !(videoDevices === null || videoDevices === void 0 ? void 0 : videoDevices.length))) {
|
|
2513
2514
|
delete constraints.video;
|
|
2514
2515
|
}
|
|
2515
2516
|
return constraints;
|
|
@@ -7332,6 +7333,106 @@ function replaceTracksInStream(stream, newStream, only) {
|
|
|
7332
7333
|
replacedTracks.forEach((track) => stream.removeTrack(track));
|
|
7333
7334
|
return replacedTracks;
|
|
7334
7335
|
}
|
|
7336
|
+
function createGetUserMediaAttempts() {
|
|
7337
|
+
const attempts = [];
|
|
7338
|
+
const attempt = (c) => __awaiter(this, void 0, void 0, function* () {
|
|
7339
|
+
var _a, _b;
|
|
7340
|
+
try {
|
|
7341
|
+
const s = yield getUserMedia(c);
|
|
7342
|
+
attempts.push({ constraints: c, outcome: { ok: true } });
|
|
7343
|
+
return s;
|
|
7344
|
+
}
|
|
7345
|
+
catch (e) {
|
|
7346
|
+
attempts.push({
|
|
7347
|
+
constraints: c,
|
|
7348
|
+
outcome: Object.assign({ ok: false, errorName: (_a = e === null || e === void 0 ? void 0 : e.name) !== null && _a !== void 0 ? _a : "UnknownError", errorMessage: (_b = e === null || e === void 0 ? void 0 : e.message) !== null && _b !== void 0 ? _b : String(e) }, ((e === null || e === void 0 ? void 0 : e.constraint) && { constraint: e.constraint })),
|
|
7349
|
+
});
|
|
7350
|
+
throw e;
|
|
7351
|
+
}
|
|
7352
|
+
});
|
|
7353
|
+
const attachAttempts = (err) => {
|
|
7354
|
+
if (err)
|
|
7355
|
+
err.attempts = attempts;
|
|
7356
|
+
return err;
|
|
7357
|
+
};
|
|
7358
|
+
return { attempts, attempt, attachAttempts };
|
|
7359
|
+
}
|
|
7360
|
+
function getInitialStream(constraintOpt) {
|
|
7361
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7362
|
+
const { attempts, attempt, attachAttempts } = createGetUserMediaAttempts();
|
|
7363
|
+
let error;
|
|
7364
|
+
let stream;
|
|
7365
|
+
const opts = Object.assign(Object.assign({}, constraintOpt), { type: "exact" });
|
|
7366
|
+
try {
|
|
7367
|
+
stream = yield attempt(getConstraints(opts));
|
|
7368
|
+
return {
|
|
7369
|
+
stream,
|
|
7370
|
+
attempts,
|
|
7371
|
+
};
|
|
7372
|
+
}
|
|
7373
|
+
catch (e) {
|
|
7374
|
+
logger.error(e);
|
|
7375
|
+
error = e;
|
|
7376
|
+
}
|
|
7377
|
+
const acquireOneKind = (targetConstraint) => __awaiter(this, void 0, void 0, function* () {
|
|
7378
|
+
const retryOpts = Object.assign(Object.assign({}, opts), { options: Object.assign({}, opts.options) });
|
|
7379
|
+
let stream;
|
|
7380
|
+
let lastError = error;
|
|
7381
|
+
const ignoredConstraint = targetConstraint === "videoId" ? "audioId" : "videoId";
|
|
7382
|
+
if (retryOpts[ignoredConstraint] !== false) {
|
|
7383
|
+
retryOpts[ignoredConstraint] = false;
|
|
7384
|
+
try {
|
|
7385
|
+
stream = yield attempt(getConstraints(retryOpts));
|
|
7386
|
+
return stream;
|
|
7387
|
+
}
|
|
7388
|
+
catch (e) {
|
|
7389
|
+
logger.error(e);
|
|
7390
|
+
lastError = e;
|
|
7391
|
+
}
|
|
7392
|
+
}
|
|
7393
|
+
if ((lastError === null || lastError === void 0 ? void 0 : lastError.name) === "NotAllowedError") {
|
|
7394
|
+
return;
|
|
7395
|
+
}
|
|
7396
|
+
if (retryOpts[targetConstraint]) {
|
|
7397
|
+
retryOpts[targetConstraint] = null;
|
|
7398
|
+
try {
|
|
7399
|
+
stream = yield attempt(getConstraints(retryOpts));
|
|
7400
|
+
return stream;
|
|
7401
|
+
}
|
|
7402
|
+
catch (e) {
|
|
7403
|
+
logger.error(e);
|
|
7404
|
+
}
|
|
7405
|
+
}
|
|
7406
|
+
try {
|
|
7407
|
+
retryOpts.options.lax = true;
|
|
7408
|
+
stream = yield attempt(getConstraints(retryOpts));
|
|
7409
|
+
return stream;
|
|
7410
|
+
}
|
|
7411
|
+
catch (e) {
|
|
7412
|
+
logger.error(e);
|
|
7413
|
+
}
|
|
7414
|
+
});
|
|
7415
|
+
if (opts.videoId !== false) {
|
|
7416
|
+
stream = yield acquireOneKind("videoId");
|
|
7417
|
+
}
|
|
7418
|
+
if (opts.audioId !== false) {
|
|
7419
|
+
if (!stream) {
|
|
7420
|
+
stream = yield acquireOneKind("audioId");
|
|
7421
|
+
}
|
|
7422
|
+
else {
|
|
7423
|
+
const audioOnlyStream = yield acquireOneKind("audioId");
|
|
7424
|
+
if (audioOnlyStream) {
|
|
7425
|
+
const audioTrack = audioOnlyStream.getAudioTracks()[0];
|
|
7426
|
+
stream.addTrack(audioTrack);
|
|
7427
|
+
}
|
|
7428
|
+
}
|
|
7429
|
+
}
|
|
7430
|
+
if (!stream) {
|
|
7431
|
+
throw attachAttempts(error !== null && error !== void 0 ? error : new Error("Unknown error"));
|
|
7432
|
+
}
|
|
7433
|
+
return { error, stream, attempts };
|
|
7434
|
+
});
|
|
7435
|
+
}
|
|
7335
7436
|
function getStream(constraintOpt_1) {
|
|
7336
7437
|
return __awaiter(this, arguments, void 0, function* (constraintOpt, { replaceStream, fallback = true } = {}) {
|
|
7337
7438
|
var _a;
|
|
@@ -7339,25 +7440,10 @@ function getStream(constraintOpt_1) {
|
|
|
7339
7440
|
let newConstraints;
|
|
7340
7441
|
let retryConstraintOpt;
|
|
7341
7442
|
let stream = null;
|
|
7342
|
-
const attempts =
|
|
7443
|
+
const { attempts, attempt, attachAttempts } = createGetUserMediaAttempts();
|
|
7343
7444
|
const only = (constraintOpt.audioId === false && "video") || (constraintOpt.videoId === false && "audio");
|
|
7344
7445
|
const stopTracks = isMobile || only !== "video";
|
|
7345
7446
|
const constraints = getConstraints(constraintOpt);
|
|
7346
|
-
const attempt = (c) => __awaiter(this, void 0, void 0, function* () {
|
|
7347
|
-
var _a, _b;
|
|
7348
|
-
try {
|
|
7349
|
-
const s = yield getUserMedia(c);
|
|
7350
|
-
attempts.push({ constraints: c, outcome: { ok: true } });
|
|
7351
|
-
return s;
|
|
7352
|
-
}
|
|
7353
|
-
catch (e) {
|
|
7354
|
-
attempts.push({
|
|
7355
|
-
constraints: c,
|
|
7356
|
-
outcome: Object.assign({ ok: false, errorName: (_a = e === null || e === void 0 ? void 0 : e.name) !== null && _a !== void 0 ? _a : "UnknownError", errorMessage: (_b = e === null || e === void 0 ? void 0 : e.message) !== null && _b !== void 0 ? _b : String(e) }, ((e === null || e === void 0 ? void 0 : e.constraint) && { constraint: e.constraint })),
|
|
7357
|
-
});
|
|
7358
|
-
throw e;
|
|
7359
|
-
}
|
|
7360
|
-
});
|
|
7361
7447
|
const addDetails = (err, orgErr) => {
|
|
7362
7448
|
if (err) {
|
|
7363
7449
|
err.details = Object.assign({ constraints, constraint: err.constraint || (orgErr === null || orgErr === void 0 ? void 0 : orgErr.constraint), newConstraints,
|
|
@@ -7369,11 +7455,6 @@ function getStream(constraintOpt_1) {
|
|
|
7369
7455
|
return new Error("Unknown error");
|
|
7370
7456
|
}
|
|
7371
7457
|
};
|
|
7372
|
-
const attachAttempts = (err) => {
|
|
7373
|
-
if (err)
|
|
7374
|
-
err.attempts = attempts;
|
|
7375
|
-
return err;
|
|
7376
|
-
};
|
|
7377
7458
|
const getSingleStream = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
7378
7459
|
if (constraints.audio && constraints.video) {
|
|
7379
7460
|
try {
|
|
@@ -7647,6 +7728,7 @@ exports.getConstraints = getConstraints;
|
|
|
7647
7728
|
exports.getCurrentPeerConnections = getCurrentPeerConnections;
|
|
7648
7729
|
exports.getDeviceData = getDeviceData;
|
|
7649
7730
|
exports.getDisplayMedia = getDisplayMedia;
|
|
7731
|
+
exports.getInitialStream = getInitialStream;
|
|
7650
7732
|
exports.getIssuesAndMetrics = getIssuesAndMetrics;
|
|
7651
7733
|
exports.getMediaConstraints = getMediaConstraints;
|
|
7652
7734
|
exports.getMediaSettings = getMediaSettings;
|
package/dist/index.d.cts
CHANGED
|
@@ -603,8 +603,13 @@ type GetMediaConstraintsOptions = {
|
|
|
603
603
|
simulcast: boolean;
|
|
604
604
|
widescreen: boolean;
|
|
605
605
|
};
|
|
606
|
+
type GetInitialStreamOptions = {
|
|
607
|
+
videoId: false | string | null;
|
|
608
|
+
audioId: false | string | null;
|
|
609
|
+
options: Omit<GetMediaConstraintsOptions, "preferredDeviceIds">;
|
|
610
|
+
};
|
|
606
611
|
type GetConstraintsOptions = {
|
|
607
|
-
devices
|
|
612
|
+
devices?: MediaDeviceInfo[];
|
|
608
613
|
audioId?: boolean | string | null;
|
|
609
614
|
videoId?: boolean | string | null;
|
|
610
615
|
type?: "ideal" | "exact";
|
|
@@ -1387,6 +1392,7 @@ declare function getDeviceData({ audioTrack, videoTrack, devices, stoppedVideoTr
|
|
|
1387
1392
|
}): GetDeviceDataResult;
|
|
1388
1393
|
declare function stopStreamTracks(stream: MediaStream, only?: "audio" | "video" | false): void;
|
|
1389
1394
|
declare function replaceTracksInStream(stream: MediaStream, newStream: MediaStream, only: "audio" | "video" | false): MediaStreamTrack[];
|
|
1395
|
+
declare function getInitialStream(constraintOpt: GetInitialStreamOptions): Promise<GetStreamResult>;
|
|
1390
1396
|
declare function getStream(constraintOpt: GetConstraintsOptions, { replaceStream, fallback }?: GetStreamOptions): Promise<GetStreamResult>;
|
|
1391
1397
|
declare function hasGetDisplayMedia(): boolean;
|
|
1392
1398
|
declare function getDisplayMedia(constraints?: DisplayMediaStreamOptions, contentHint?: string): Promise<MediaStream>;
|
|
@@ -2153,5 +2159,5 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2153
2159
|
hasClient(clientId: string): boolean;
|
|
2154
2160
|
}
|
|
2155
2161
|
|
|
2156
|
-
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, FILE_SHARE_ERROR_CODES, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isFileShareError, isMobile, issueDetectorOrMetricEnabled, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, updateRenderedDimensions, variance };
|
|
2157
|
-
export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdateRequest, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatFileShare, ChatMessage, ChatMessageError, ChatMessageRemoved, ChatMessageRequest, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, ConnectionStatus, Credentials, FileShareErrorCode, FileUploadUrl, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, GetUserMediaAttempt, GetUserMediaAttemptOutcome, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockOnHoldEvent, KnockRejectedEvent, KnockResponse, KnockResponseSender, KnockRoomRequest, KnockerLeftEvent, LiveCaptionEvent, LiveCaptionsStartedEvent, LiveCaptionsStoppedEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, MediaPrefs, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
|
|
2162
|
+
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, FILE_SHARE_ERROR_CODES, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getInitialStream, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isFileShareError, isMobile, issueDetectorOrMetricEnabled, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, updateRenderedDimensions, variance };
|
|
2163
|
+
export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdateRequest, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatFileShare, ChatMessage, ChatMessageError, ChatMessageRemoved, ChatMessageRequest, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, ConnectionStatus, Credentials, FileShareErrorCode, FileUploadUrl, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetInitialStreamOptions, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, GetUserMediaAttempt, GetUserMediaAttemptOutcome, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockOnHoldEvent, KnockRejectedEvent, KnockResponse, KnockResponseSender, KnockRoomRequest, KnockerLeftEvent, LiveCaptionEvent, LiveCaptionsStartedEvent, LiveCaptionsStoppedEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, MediaPrefs, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
|
package/dist/index.d.mts
CHANGED
|
@@ -603,8 +603,13 @@ type GetMediaConstraintsOptions = {
|
|
|
603
603
|
simulcast: boolean;
|
|
604
604
|
widescreen: boolean;
|
|
605
605
|
};
|
|
606
|
+
type GetInitialStreamOptions = {
|
|
607
|
+
videoId: false | string | null;
|
|
608
|
+
audioId: false | string | null;
|
|
609
|
+
options: Omit<GetMediaConstraintsOptions, "preferredDeviceIds">;
|
|
610
|
+
};
|
|
606
611
|
type GetConstraintsOptions = {
|
|
607
|
-
devices
|
|
612
|
+
devices?: MediaDeviceInfo[];
|
|
608
613
|
audioId?: boolean | string | null;
|
|
609
614
|
videoId?: boolean | string | null;
|
|
610
615
|
type?: "ideal" | "exact";
|
|
@@ -1387,6 +1392,7 @@ declare function getDeviceData({ audioTrack, videoTrack, devices, stoppedVideoTr
|
|
|
1387
1392
|
}): GetDeviceDataResult;
|
|
1388
1393
|
declare function stopStreamTracks(stream: MediaStream, only?: "audio" | "video" | false): void;
|
|
1389
1394
|
declare function replaceTracksInStream(stream: MediaStream, newStream: MediaStream, only: "audio" | "video" | false): MediaStreamTrack[];
|
|
1395
|
+
declare function getInitialStream(constraintOpt: GetInitialStreamOptions): Promise<GetStreamResult>;
|
|
1390
1396
|
declare function getStream(constraintOpt: GetConstraintsOptions, { replaceStream, fallback }?: GetStreamOptions): Promise<GetStreamResult>;
|
|
1391
1397
|
declare function hasGetDisplayMedia(): boolean;
|
|
1392
1398
|
declare function getDisplayMedia(constraints?: DisplayMediaStreamOptions, contentHint?: string): Promise<MediaStream>;
|
|
@@ -2153,5 +2159,5 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2153
2159
|
hasClient(clientId: string): boolean;
|
|
2154
2160
|
}
|
|
2155
2161
|
|
|
2156
|
-
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, FILE_SHARE_ERROR_CODES, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isFileShareError, isMobile, issueDetectorOrMetricEnabled, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, updateRenderedDimensions, variance };
|
|
2157
|
-
export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdateRequest, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatFileShare, ChatMessage, ChatMessageError, ChatMessageRemoved, ChatMessageRequest, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, ConnectionStatus, Credentials, FileShareErrorCode, FileUploadUrl, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, GetUserMediaAttempt, GetUserMediaAttemptOutcome, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockOnHoldEvent, KnockRejectedEvent, KnockResponse, KnockResponseSender, KnockRoomRequest, KnockerLeftEvent, LiveCaptionEvent, LiveCaptionsStartedEvent, LiveCaptionsStoppedEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, MediaPrefs, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
|
|
2162
|
+
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, FILE_SHARE_ERROR_CODES, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getInitialStream, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isFileShareError, isMobile, issueDetectorOrMetricEnabled, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, updateRenderedDimensions, variance };
|
|
2163
|
+
export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdateRequest, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatFileShare, ChatMessage, ChatMessageError, ChatMessageRemoved, ChatMessageRequest, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, ConnectionStatus, Credentials, FileShareErrorCode, FileUploadUrl, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetInitialStreamOptions, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, GetUserMediaAttempt, GetUserMediaAttemptOutcome, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockOnHoldEvent, KnockRejectedEvent, KnockResponse, KnockResponseSender, KnockRoomRequest, KnockerLeftEvent, LiveCaptionEvent, LiveCaptionsStartedEvent, LiveCaptionsStoppedEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, MediaPrefs, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
|
package/dist/index.d.ts
CHANGED
|
@@ -603,8 +603,13 @@ type GetMediaConstraintsOptions = {
|
|
|
603
603
|
simulcast: boolean;
|
|
604
604
|
widescreen: boolean;
|
|
605
605
|
};
|
|
606
|
+
type GetInitialStreamOptions = {
|
|
607
|
+
videoId: false | string | null;
|
|
608
|
+
audioId: false | string | null;
|
|
609
|
+
options: Omit<GetMediaConstraintsOptions, "preferredDeviceIds">;
|
|
610
|
+
};
|
|
606
611
|
type GetConstraintsOptions = {
|
|
607
|
-
devices
|
|
612
|
+
devices?: MediaDeviceInfo[];
|
|
608
613
|
audioId?: boolean | string | null;
|
|
609
614
|
videoId?: boolean | string | null;
|
|
610
615
|
type?: "ideal" | "exact";
|
|
@@ -1387,6 +1392,7 @@ declare function getDeviceData({ audioTrack, videoTrack, devices, stoppedVideoTr
|
|
|
1387
1392
|
}): GetDeviceDataResult;
|
|
1388
1393
|
declare function stopStreamTracks(stream: MediaStream, only?: "audio" | "video" | false): void;
|
|
1389
1394
|
declare function replaceTracksInStream(stream: MediaStream, newStream: MediaStream, only: "audio" | "video" | false): MediaStreamTrack[];
|
|
1395
|
+
declare function getInitialStream(constraintOpt: GetInitialStreamOptions): Promise<GetStreamResult>;
|
|
1390
1396
|
declare function getStream(constraintOpt: GetConstraintsOptions, { replaceStream, fallback }?: GetStreamOptions): Promise<GetStreamResult>;
|
|
1391
1397
|
declare function hasGetDisplayMedia(): boolean;
|
|
1392
1398
|
declare function getDisplayMedia(constraints?: DisplayMediaStreamOptions, contentHint?: string): Promise<MediaStream>;
|
|
@@ -2153,5 +2159,5 @@ declare class VegaRtcManager implements RtcManager {
|
|
|
2153
2159
|
hasClient(clientId: string): boolean;
|
|
2154
2160
|
}
|
|
2155
2161
|
|
|
2156
|
-
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, FILE_SHARE_ERROR_CODES, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isFileShareError, isMobile, issueDetectorOrMetricEnabled, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, updateRenderedDimensions, variance };
|
|
2157
|
-
export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdateRequest, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatFileShare, ChatMessage, ChatMessageError, ChatMessageRemoved, ChatMessageRequest, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, ConnectionStatus, Credentials, FileShareErrorCode, FileUploadUrl, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, GetUserMediaAttempt, GetUserMediaAttemptOutcome, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockOnHoldEvent, KnockRejectedEvent, KnockResponse, KnockResponseSender, KnockRoomRequest, KnockerLeftEvent, LiveCaptionEvent, LiveCaptionsStartedEvent, LiveCaptionsStoppedEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, MediaPrefs, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
|
|
2162
|
+
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, FILE_SHARE_ERROR_CODES, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getInitialStream, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isFileShareError, isMobile, issueDetectorOrMetricEnabled, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, updateRenderedDimensions, variance };
|
|
2163
|
+
export type { AddCameraStreamOptions, AddSpotlightRequest, AudioEnableRequest, AudioEnableRequestedEvent, AudioEnabledEvent, BreakoutConfig, BreakoutGroupJoinedEvent, BreakoutSessionUpdateRequest, BreakoutSessionUpdatedEvent, BuildDeviceListOptions, CannotJoinUnclaimedRoomError, ChatFileShare, ChatMessage, ChatMessageError, ChatMessageRemoved, ChatMessageRequest, ClearableTimeout, ClientKickedEvent, ClientLeftEvent, ClientMetadataPayload, ClientMetadataReceivedEvent, ClientRole, ClientUnableToJoinEvent, CloudRecordingStartedEvent, Codec, ConnectionStatus, Credentials, FileShareErrorCode, FileUploadUrl, ForbiddenError, ForbiddenErrorNames, GetConstraintsOptions, GetDeviceDataResult, GetInitialStreamOptions, GetMediaConstraintsOptions, GetStreamOptions, GetStreamResult, GetUpdatedDevicesResult, GetUserMediaAttempt, GetUserMediaAttemptOutcome, HostPresenceControlsError, IdentifyDeviceRequest, InternalServerError, InvalidAssistantKeyError, IssuesAndMetricsByView, JoinRoomRequest, KnockAcceptedEvent, KnockOnHoldEvent, KnockRejectedEvent, KnockResponse, KnockResponseSender, KnockRoomRequest, KnockerLeftEvent, LiveCaptionEvent, LiveCaptionsStartedEvent, LiveCaptionsStoppedEvent, LiveTranscriptionStartedEvent, LiveTranscriptionStoppedEvent, MaxViewerLimitReachedError, MediaPrefs, Metric, NewClientEvent, OrganizationAssistantNotEnabledError, OrganizationAssistantNotFoundError, OrganizationPlanExhaustedError, RemoveScreenshareStreamOptions, RemoveSpotlightRequest, RoleName, RoomConcurrencyControlsError, RoomEmptyError, RoomFullError, RoomJoinPermissionDeniedError, RoomJoinedErrors, RoomJoinedEvent, RoomJoinedSuccess, RoomKnockedEvent, RoomLockedError, RoomLockedEvent, RoomMeetingTimeExhaustedError, RoomMode, RoomSessionEndedEvent, RtcClientConnectionStatusChangedPayload, RtcEventEmitter, RtcEvents, RtcLocalStreamTrackAddedPayload, RtcLocalStreamTrackRemovedPayload, RtcManager, RtcManagerCreatedPayload, RtcManagerOptions, RtcStreamAddedPayload, ScreenshareStartedEvent, ScreenshareStoppedEvent, SendClientMetadataRequest, SignalClient, SignalEvents, SignalIceCandidateMessage, SignalIceEndOfCandidatesMessage, SignalIceServer, SignalKnocker, SignalMediaServerConfig, SignalRTCSessionDescription, SignalReadyToReceiveOfferMessage, SignalRequests, SignalRoom, SignalSDPMessage, SignalSFUServer, SignalTurnServer, SocketConf, SocketManager, Spotlight, SpotlightAddedEvent, SpotlightRemovedEvent, StatsMonitorOptions, StatsMonitorState, StatsSubscription, TurnTransportProtocol, UniqueRoleAlreadyInRoomError, UpdatedDeviceInfo, UpdatedDevicesInfo, VegaConnectionOptions, VegaRtcManagerOptions, VideoEnableRequest, VideoEnableRequestedEvent, VideoEnabledEvent, WebRTCProvider };
|
package/dist/index.mjs
CHANGED
|
@@ -2478,18 +2478,19 @@ function getMediaConstraints({ disableAEC, disableAGC, hd, lax, lowDataMode, pre
|
|
|
2478
2478
|
return constraints;
|
|
2479
2479
|
}
|
|
2480
2480
|
function getConstraints({ devices, videoId, audioId, options, type = "ideal" }) {
|
|
2481
|
-
const
|
|
2482
|
-
const
|
|
2483
|
-
const
|
|
2484
|
-
const
|
|
2481
|
+
const strict = !!devices;
|
|
2482
|
+
const audioDevices = devices === null || devices === void 0 ? void 0 : devices.filter((d) => d.kind === "audioinput");
|
|
2483
|
+
const videoDevices = devices === null || devices === void 0 ? void 0 : devices.filter((d) => d.kind === "videoinput");
|
|
2484
|
+
const useDefaultAudio = !audioId || (strict && !(audioDevices === null || audioDevices === void 0 ? void 0 : audioDevices.some((d) => d.deviceId === audioId)));
|
|
2485
|
+
const useDefaultVideo = !videoId || (strict && !(videoDevices === null || videoDevices === void 0 ? void 0 : videoDevices.some((d) => d.deviceId === videoId)));
|
|
2485
2486
|
const constraints = getMediaConstraints(Object.assign({ preferredDeviceIds: {
|
|
2486
2487
|
audioId: useDefaultAudio ? null : { [type]: audioId },
|
|
2487
2488
|
videoId: useDefaultVideo ? null : { [type]: videoId },
|
|
2488
2489
|
} }, options));
|
|
2489
|
-
if (audioId === false || !audioDevices.length) {
|
|
2490
|
+
if (audioId === false || (strict && !(audioDevices === null || audioDevices === void 0 ? void 0 : audioDevices.length))) {
|
|
2490
2491
|
delete constraints.audio;
|
|
2491
2492
|
}
|
|
2492
|
-
if (videoId === false || !videoDevices.length) {
|
|
2493
|
+
if (videoId === false || (strict && !(videoDevices === null || videoDevices === void 0 ? void 0 : videoDevices.length))) {
|
|
2493
2494
|
delete constraints.video;
|
|
2494
2495
|
}
|
|
2495
2496
|
return constraints;
|
|
@@ -7312,6 +7313,106 @@ function replaceTracksInStream(stream, newStream, only) {
|
|
|
7312
7313
|
replacedTracks.forEach((track) => stream.removeTrack(track));
|
|
7313
7314
|
return replacedTracks;
|
|
7314
7315
|
}
|
|
7316
|
+
function createGetUserMediaAttempts() {
|
|
7317
|
+
const attempts = [];
|
|
7318
|
+
const attempt = (c) => __awaiter(this, void 0, void 0, function* () {
|
|
7319
|
+
var _a, _b;
|
|
7320
|
+
try {
|
|
7321
|
+
const s = yield getUserMedia(c);
|
|
7322
|
+
attempts.push({ constraints: c, outcome: { ok: true } });
|
|
7323
|
+
return s;
|
|
7324
|
+
}
|
|
7325
|
+
catch (e) {
|
|
7326
|
+
attempts.push({
|
|
7327
|
+
constraints: c,
|
|
7328
|
+
outcome: Object.assign({ ok: false, errorName: (_a = e === null || e === void 0 ? void 0 : e.name) !== null && _a !== void 0 ? _a : "UnknownError", errorMessage: (_b = e === null || e === void 0 ? void 0 : e.message) !== null && _b !== void 0 ? _b : String(e) }, ((e === null || e === void 0 ? void 0 : e.constraint) && { constraint: e.constraint })),
|
|
7329
|
+
});
|
|
7330
|
+
throw e;
|
|
7331
|
+
}
|
|
7332
|
+
});
|
|
7333
|
+
const attachAttempts = (err) => {
|
|
7334
|
+
if (err)
|
|
7335
|
+
err.attempts = attempts;
|
|
7336
|
+
return err;
|
|
7337
|
+
};
|
|
7338
|
+
return { attempts, attempt, attachAttempts };
|
|
7339
|
+
}
|
|
7340
|
+
function getInitialStream(constraintOpt) {
|
|
7341
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7342
|
+
const { attempts, attempt, attachAttempts } = createGetUserMediaAttempts();
|
|
7343
|
+
let error;
|
|
7344
|
+
let stream;
|
|
7345
|
+
const opts = Object.assign(Object.assign({}, constraintOpt), { type: "exact" });
|
|
7346
|
+
try {
|
|
7347
|
+
stream = yield attempt(getConstraints(opts));
|
|
7348
|
+
return {
|
|
7349
|
+
stream,
|
|
7350
|
+
attempts,
|
|
7351
|
+
};
|
|
7352
|
+
}
|
|
7353
|
+
catch (e) {
|
|
7354
|
+
logger.error(e);
|
|
7355
|
+
error = e;
|
|
7356
|
+
}
|
|
7357
|
+
const acquireOneKind = (targetConstraint) => __awaiter(this, void 0, void 0, function* () {
|
|
7358
|
+
const retryOpts = Object.assign(Object.assign({}, opts), { options: Object.assign({}, opts.options) });
|
|
7359
|
+
let stream;
|
|
7360
|
+
let lastError = error;
|
|
7361
|
+
const ignoredConstraint = targetConstraint === "videoId" ? "audioId" : "videoId";
|
|
7362
|
+
if (retryOpts[ignoredConstraint] !== false) {
|
|
7363
|
+
retryOpts[ignoredConstraint] = false;
|
|
7364
|
+
try {
|
|
7365
|
+
stream = yield attempt(getConstraints(retryOpts));
|
|
7366
|
+
return stream;
|
|
7367
|
+
}
|
|
7368
|
+
catch (e) {
|
|
7369
|
+
logger.error(e);
|
|
7370
|
+
lastError = e;
|
|
7371
|
+
}
|
|
7372
|
+
}
|
|
7373
|
+
if ((lastError === null || lastError === void 0 ? void 0 : lastError.name) === "NotAllowedError") {
|
|
7374
|
+
return;
|
|
7375
|
+
}
|
|
7376
|
+
if (retryOpts[targetConstraint]) {
|
|
7377
|
+
retryOpts[targetConstraint] = null;
|
|
7378
|
+
try {
|
|
7379
|
+
stream = yield attempt(getConstraints(retryOpts));
|
|
7380
|
+
return stream;
|
|
7381
|
+
}
|
|
7382
|
+
catch (e) {
|
|
7383
|
+
logger.error(e);
|
|
7384
|
+
}
|
|
7385
|
+
}
|
|
7386
|
+
try {
|
|
7387
|
+
retryOpts.options.lax = true;
|
|
7388
|
+
stream = yield attempt(getConstraints(retryOpts));
|
|
7389
|
+
return stream;
|
|
7390
|
+
}
|
|
7391
|
+
catch (e) {
|
|
7392
|
+
logger.error(e);
|
|
7393
|
+
}
|
|
7394
|
+
});
|
|
7395
|
+
if (opts.videoId !== false) {
|
|
7396
|
+
stream = yield acquireOneKind("videoId");
|
|
7397
|
+
}
|
|
7398
|
+
if (opts.audioId !== false) {
|
|
7399
|
+
if (!stream) {
|
|
7400
|
+
stream = yield acquireOneKind("audioId");
|
|
7401
|
+
}
|
|
7402
|
+
else {
|
|
7403
|
+
const audioOnlyStream = yield acquireOneKind("audioId");
|
|
7404
|
+
if (audioOnlyStream) {
|
|
7405
|
+
const audioTrack = audioOnlyStream.getAudioTracks()[0];
|
|
7406
|
+
stream.addTrack(audioTrack);
|
|
7407
|
+
}
|
|
7408
|
+
}
|
|
7409
|
+
}
|
|
7410
|
+
if (!stream) {
|
|
7411
|
+
throw attachAttempts(error !== null && error !== void 0 ? error : new Error("Unknown error"));
|
|
7412
|
+
}
|
|
7413
|
+
return { error, stream, attempts };
|
|
7414
|
+
});
|
|
7415
|
+
}
|
|
7315
7416
|
function getStream(constraintOpt_1) {
|
|
7316
7417
|
return __awaiter(this, arguments, void 0, function* (constraintOpt, { replaceStream, fallback = true } = {}) {
|
|
7317
7418
|
var _a;
|
|
@@ -7319,25 +7420,10 @@ function getStream(constraintOpt_1) {
|
|
|
7319
7420
|
let newConstraints;
|
|
7320
7421
|
let retryConstraintOpt;
|
|
7321
7422
|
let stream = null;
|
|
7322
|
-
const attempts =
|
|
7423
|
+
const { attempts, attempt, attachAttempts } = createGetUserMediaAttempts();
|
|
7323
7424
|
const only = (constraintOpt.audioId === false && "video") || (constraintOpt.videoId === false && "audio");
|
|
7324
7425
|
const stopTracks = isMobile || only !== "video";
|
|
7325
7426
|
const constraints = getConstraints(constraintOpt);
|
|
7326
|
-
const attempt = (c) => __awaiter(this, void 0, void 0, function* () {
|
|
7327
|
-
var _a, _b;
|
|
7328
|
-
try {
|
|
7329
|
-
const s = yield getUserMedia(c);
|
|
7330
|
-
attempts.push({ constraints: c, outcome: { ok: true } });
|
|
7331
|
-
return s;
|
|
7332
|
-
}
|
|
7333
|
-
catch (e) {
|
|
7334
|
-
attempts.push({
|
|
7335
|
-
constraints: c,
|
|
7336
|
-
outcome: Object.assign({ ok: false, errorName: (_a = e === null || e === void 0 ? void 0 : e.name) !== null && _a !== void 0 ? _a : "UnknownError", errorMessage: (_b = e === null || e === void 0 ? void 0 : e.message) !== null && _b !== void 0 ? _b : String(e) }, ((e === null || e === void 0 ? void 0 : e.constraint) && { constraint: e.constraint })),
|
|
7337
|
-
});
|
|
7338
|
-
throw e;
|
|
7339
|
-
}
|
|
7340
|
-
});
|
|
7341
7427
|
const addDetails = (err, orgErr) => {
|
|
7342
7428
|
if (err) {
|
|
7343
7429
|
err.details = Object.assign({ constraints, constraint: err.constraint || (orgErr === null || orgErr === void 0 ? void 0 : orgErr.constraint), newConstraints,
|
|
@@ -7349,11 +7435,6 @@ function getStream(constraintOpt_1) {
|
|
|
7349
7435
|
return new Error("Unknown error");
|
|
7350
7436
|
}
|
|
7351
7437
|
};
|
|
7352
|
-
const attachAttempts = (err) => {
|
|
7353
|
-
if (err)
|
|
7354
|
-
err.attempts = attempts;
|
|
7355
|
-
return err;
|
|
7356
|
-
};
|
|
7357
7438
|
const getSingleStream = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
7358
7439
|
if (constraints.audio && constraints.video) {
|
|
7359
7440
|
try {
|
|
@@ -7563,4 +7644,4 @@ var RtcEventNames;
|
|
|
7563
7644
|
RtcEventNames["stream_added"] = "stream_added";
|
|
7564
7645
|
})(RtcEventNames || (RtcEventNames = {}));
|
|
7565
7646
|
|
|
7566
|
-
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, FILE_SHARE_ERROR_CODES, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isFileShareError, isMobile, issueDetectorOrMetricEnabled, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, updateRenderedDimensions, variance };
|
|
7647
|
+
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, FILE_SHARE_ERROR_CODES, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getInitialStream, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isFileShareError, isMobile, issueDetectorOrMetricEnabled, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, updateRenderedDimensions, variance };
|
package/dist/legacy-esm.js
CHANGED
|
@@ -2478,18 +2478,19 @@ function getMediaConstraints({ disableAEC, disableAGC, hd, lax, lowDataMode, pre
|
|
|
2478
2478
|
return constraints;
|
|
2479
2479
|
}
|
|
2480
2480
|
function getConstraints({ devices, videoId, audioId, options, type = "ideal" }) {
|
|
2481
|
-
const
|
|
2482
|
-
const
|
|
2483
|
-
const
|
|
2484
|
-
const
|
|
2481
|
+
const strict = !!devices;
|
|
2482
|
+
const audioDevices = devices === null || devices === void 0 ? void 0 : devices.filter((d) => d.kind === "audioinput");
|
|
2483
|
+
const videoDevices = devices === null || devices === void 0 ? void 0 : devices.filter((d) => d.kind === "videoinput");
|
|
2484
|
+
const useDefaultAudio = !audioId || (strict && !(audioDevices === null || audioDevices === void 0 ? void 0 : audioDevices.some((d) => d.deviceId === audioId)));
|
|
2485
|
+
const useDefaultVideo = !videoId || (strict && !(videoDevices === null || videoDevices === void 0 ? void 0 : videoDevices.some((d) => d.deviceId === videoId)));
|
|
2485
2486
|
const constraints = getMediaConstraints(Object.assign({ preferredDeviceIds: {
|
|
2486
2487
|
audioId: useDefaultAudio ? null : { [type]: audioId },
|
|
2487
2488
|
videoId: useDefaultVideo ? null : { [type]: videoId },
|
|
2488
2489
|
} }, options));
|
|
2489
|
-
if (audioId === false || !audioDevices.length) {
|
|
2490
|
+
if (audioId === false || (strict && !(audioDevices === null || audioDevices === void 0 ? void 0 : audioDevices.length))) {
|
|
2490
2491
|
delete constraints.audio;
|
|
2491
2492
|
}
|
|
2492
|
-
if (videoId === false || !videoDevices.length) {
|
|
2493
|
+
if (videoId === false || (strict && !(videoDevices === null || videoDevices === void 0 ? void 0 : videoDevices.length))) {
|
|
2493
2494
|
delete constraints.video;
|
|
2494
2495
|
}
|
|
2495
2496
|
return constraints;
|
|
@@ -7312,6 +7313,106 @@ function replaceTracksInStream(stream, newStream, only) {
|
|
|
7312
7313
|
replacedTracks.forEach((track) => stream.removeTrack(track));
|
|
7313
7314
|
return replacedTracks;
|
|
7314
7315
|
}
|
|
7316
|
+
function createGetUserMediaAttempts() {
|
|
7317
|
+
const attempts = [];
|
|
7318
|
+
const attempt = (c) => __awaiter(this, void 0, void 0, function* () {
|
|
7319
|
+
var _a, _b;
|
|
7320
|
+
try {
|
|
7321
|
+
const s = yield getUserMedia(c);
|
|
7322
|
+
attempts.push({ constraints: c, outcome: { ok: true } });
|
|
7323
|
+
return s;
|
|
7324
|
+
}
|
|
7325
|
+
catch (e) {
|
|
7326
|
+
attempts.push({
|
|
7327
|
+
constraints: c,
|
|
7328
|
+
outcome: Object.assign({ ok: false, errorName: (_a = e === null || e === void 0 ? void 0 : e.name) !== null && _a !== void 0 ? _a : "UnknownError", errorMessage: (_b = e === null || e === void 0 ? void 0 : e.message) !== null && _b !== void 0 ? _b : String(e) }, ((e === null || e === void 0 ? void 0 : e.constraint) && { constraint: e.constraint })),
|
|
7329
|
+
});
|
|
7330
|
+
throw e;
|
|
7331
|
+
}
|
|
7332
|
+
});
|
|
7333
|
+
const attachAttempts = (err) => {
|
|
7334
|
+
if (err)
|
|
7335
|
+
err.attempts = attempts;
|
|
7336
|
+
return err;
|
|
7337
|
+
};
|
|
7338
|
+
return { attempts, attempt, attachAttempts };
|
|
7339
|
+
}
|
|
7340
|
+
function getInitialStream(constraintOpt) {
|
|
7341
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
7342
|
+
const { attempts, attempt, attachAttempts } = createGetUserMediaAttempts();
|
|
7343
|
+
let error;
|
|
7344
|
+
let stream;
|
|
7345
|
+
const opts = Object.assign(Object.assign({}, constraintOpt), { type: "exact" });
|
|
7346
|
+
try {
|
|
7347
|
+
stream = yield attempt(getConstraints(opts));
|
|
7348
|
+
return {
|
|
7349
|
+
stream,
|
|
7350
|
+
attempts,
|
|
7351
|
+
};
|
|
7352
|
+
}
|
|
7353
|
+
catch (e) {
|
|
7354
|
+
logger.error(e);
|
|
7355
|
+
error = e;
|
|
7356
|
+
}
|
|
7357
|
+
const acquireOneKind = (targetConstraint) => __awaiter(this, void 0, void 0, function* () {
|
|
7358
|
+
const retryOpts = Object.assign(Object.assign({}, opts), { options: Object.assign({}, opts.options) });
|
|
7359
|
+
let stream;
|
|
7360
|
+
let lastError = error;
|
|
7361
|
+
const ignoredConstraint = targetConstraint === "videoId" ? "audioId" : "videoId";
|
|
7362
|
+
if (retryOpts[ignoredConstraint] !== false) {
|
|
7363
|
+
retryOpts[ignoredConstraint] = false;
|
|
7364
|
+
try {
|
|
7365
|
+
stream = yield attempt(getConstraints(retryOpts));
|
|
7366
|
+
return stream;
|
|
7367
|
+
}
|
|
7368
|
+
catch (e) {
|
|
7369
|
+
logger.error(e);
|
|
7370
|
+
lastError = e;
|
|
7371
|
+
}
|
|
7372
|
+
}
|
|
7373
|
+
if ((lastError === null || lastError === void 0 ? void 0 : lastError.name) === "NotAllowedError") {
|
|
7374
|
+
return;
|
|
7375
|
+
}
|
|
7376
|
+
if (retryOpts[targetConstraint]) {
|
|
7377
|
+
retryOpts[targetConstraint] = null;
|
|
7378
|
+
try {
|
|
7379
|
+
stream = yield attempt(getConstraints(retryOpts));
|
|
7380
|
+
return stream;
|
|
7381
|
+
}
|
|
7382
|
+
catch (e) {
|
|
7383
|
+
logger.error(e);
|
|
7384
|
+
}
|
|
7385
|
+
}
|
|
7386
|
+
try {
|
|
7387
|
+
retryOpts.options.lax = true;
|
|
7388
|
+
stream = yield attempt(getConstraints(retryOpts));
|
|
7389
|
+
return stream;
|
|
7390
|
+
}
|
|
7391
|
+
catch (e) {
|
|
7392
|
+
logger.error(e);
|
|
7393
|
+
}
|
|
7394
|
+
});
|
|
7395
|
+
if (opts.videoId !== false) {
|
|
7396
|
+
stream = yield acquireOneKind("videoId");
|
|
7397
|
+
}
|
|
7398
|
+
if (opts.audioId !== false) {
|
|
7399
|
+
if (!stream) {
|
|
7400
|
+
stream = yield acquireOneKind("audioId");
|
|
7401
|
+
}
|
|
7402
|
+
else {
|
|
7403
|
+
const audioOnlyStream = yield acquireOneKind("audioId");
|
|
7404
|
+
if (audioOnlyStream) {
|
|
7405
|
+
const audioTrack = audioOnlyStream.getAudioTracks()[0];
|
|
7406
|
+
stream.addTrack(audioTrack);
|
|
7407
|
+
}
|
|
7408
|
+
}
|
|
7409
|
+
}
|
|
7410
|
+
if (!stream) {
|
|
7411
|
+
throw attachAttempts(error !== null && error !== void 0 ? error : new Error("Unknown error"));
|
|
7412
|
+
}
|
|
7413
|
+
return { error, stream, attempts };
|
|
7414
|
+
});
|
|
7415
|
+
}
|
|
7315
7416
|
function getStream(constraintOpt_1) {
|
|
7316
7417
|
return __awaiter(this, arguments, void 0, function* (constraintOpt, { replaceStream, fallback = true } = {}) {
|
|
7317
7418
|
var _a;
|
|
@@ -7319,25 +7420,10 @@ function getStream(constraintOpt_1) {
|
|
|
7319
7420
|
let newConstraints;
|
|
7320
7421
|
let retryConstraintOpt;
|
|
7321
7422
|
let stream = null;
|
|
7322
|
-
const attempts =
|
|
7423
|
+
const { attempts, attempt, attachAttempts } = createGetUserMediaAttempts();
|
|
7323
7424
|
const only = (constraintOpt.audioId === false && "video") || (constraintOpt.videoId === false && "audio");
|
|
7324
7425
|
const stopTracks = isMobile || only !== "video";
|
|
7325
7426
|
const constraints = getConstraints(constraintOpt);
|
|
7326
|
-
const attempt = (c) => __awaiter(this, void 0, void 0, function* () {
|
|
7327
|
-
var _a, _b;
|
|
7328
|
-
try {
|
|
7329
|
-
const s = yield getUserMedia(c);
|
|
7330
|
-
attempts.push({ constraints: c, outcome: { ok: true } });
|
|
7331
|
-
return s;
|
|
7332
|
-
}
|
|
7333
|
-
catch (e) {
|
|
7334
|
-
attempts.push({
|
|
7335
|
-
constraints: c,
|
|
7336
|
-
outcome: Object.assign({ ok: false, errorName: (_a = e === null || e === void 0 ? void 0 : e.name) !== null && _a !== void 0 ? _a : "UnknownError", errorMessage: (_b = e === null || e === void 0 ? void 0 : e.message) !== null && _b !== void 0 ? _b : String(e) }, ((e === null || e === void 0 ? void 0 : e.constraint) && { constraint: e.constraint })),
|
|
7337
|
-
});
|
|
7338
|
-
throw e;
|
|
7339
|
-
}
|
|
7340
|
-
});
|
|
7341
7427
|
const addDetails = (err, orgErr) => {
|
|
7342
7428
|
if (err) {
|
|
7343
7429
|
err.details = Object.assign({ constraints, constraint: err.constraint || (orgErr === null || orgErr === void 0 ? void 0 : orgErr.constraint), newConstraints,
|
|
@@ -7349,11 +7435,6 @@ function getStream(constraintOpt_1) {
|
|
|
7349
7435
|
return new Error("Unknown error");
|
|
7350
7436
|
}
|
|
7351
7437
|
};
|
|
7352
|
-
const attachAttempts = (err) => {
|
|
7353
|
-
if (err)
|
|
7354
|
-
err.attempts = attempts;
|
|
7355
|
-
return err;
|
|
7356
|
-
};
|
|
7357
7438
|
const getSingleStream = (e) => __awaiter(this, void 0, void 0, function* () {
|
|
7358
7439
|
if (constraints.audio && constraints.video) {
|
|
7359
7440
|
try {
|
|
@@ -7563,5 +7644,5 @@ var RtcEventNames;
|
|
|
7563
7644
|
RtcEventNames["stream_added"] = "stream_added";
|
|
7564
7645
|
})(RtcEventNames || (RtcEventNames = {}));
|
|
7565
7646
|
|
|
7566
|
-
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, FILE_SHARE_ERROR_CODES, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isFileShareError, isMobile, issueDetectorOrMetricEnabled, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, updateRenderedDimensions, variance };
|
|
7647
|
+
export { ADDITIONAL_SCREEN_SHARE_SETTINGS, AUDIO_SETTINGS, BandwidthTester, CAMERA_STREAM_ID, EVENTS, FILE_SHARE_ERROR_CODES, KNOCK_MESSAGES, KalmanFilter, Logger, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, SCREEN_SHARE_SETTINGS, SCREEN_SHARE_SIMULCAST_SETTINGS, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VIDEO_SETTINGS_HD, VIDEO_SETTINGS_SD, VIDEO_SETTINGS_VP9, VIDEO_SETTINGS_VP9_LOW_BANDWIDTH, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, external_stun_servers, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getInitialStream, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getMediasoupDeviceAsync, getNumFailedStatsReports, getNumFailedTrackSsrcLookups, getNumMissingTrackSsrcLookups, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isFileShareError, isMobile, issueDetectorOrMetricEnabled, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceTracksInStream, rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, sortCodecs, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, trackAnnotations, turnServerOverride, updateRenderedDimensions, variance };
|
|
7567
7648
|
//# sourceMappingURL=legacy-esm.js.map
|