@whereby.com/media 1.17.2 → 1.17.3
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 +0 -148
- package/dist/index.d.cts +1 -2
- package/dist/index.d.mts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.mjs +1 -148
- package/dist/legacy-esm.js +1 -148
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2991,153 +2991,6 @@ function replaceTracksInStream(stream, newStream, only) {
|
|
|
2991
2991
|
});
|
|
2992
2992
|
return replacedTracks;
|
|
2993
2993
|
}
|
|
2994
|
-
function getTrack({ kind, deviceId, type, fallback = true, primerTrack, }) {
|
|
2995
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2996
|
-
const devId = (deviceId) => (type === "exact" ? { deviceId: { exact: deviceId } } : { deviceId });
|
|
2997
|
-
const constraints = {
|
|
2998
|
-
[kind]: deviceId ? devId(deviceId) : kind === "video" ? { facingMode: "user" } : true,
|
|
2999
|
-
};
|
|
3000
|
-
let stream;
|
|
3001
|
-
try {
|
|
3002
|
-
stream = yield getUserMedia(constraints);
|
|
3003
|
-
}
|
|
3004
|
-
catch (e) {
|
|
3005
|
-
if (!fallback) {
|
|
3006
|
-
e.details = { constraints, constraint: e.constraint };
|
|
3007
|
-
throw e;
|
|
3008
|
-
}
|
|
3009
|
-
if (primerTrack) {
|
|
3010
|
-
return primerTrack;
|
|
3011
|
-
}
|
|
3012
|
-
stream = yield getUserMedia({ [kind]: true });
|
|
3013
|
-
}
|
|
3014
|
-
return stream.getTracks()[0];
|
|
3015
|
-
});
|
|
3016
|
-
}
|
|
3017
|
-
function constrainTrack(track, constraints) {
|
|
3018
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3019
|
-
while (constraints.length) {
|
|
3020
|
-
try {
|
|
3021
|
-
yield track.applyConstraints(Object.assign({}, ...constraints));
|
|
3022
|
-
break;
|
|
3023
|
-
}
|
|
3024
|
-
catch (e) {
|
|
3025
|
-
const c = constraints.pop();
|
|
3026
|
-
logger$6.warn(`unable to apply ${JSON.stringify(c)}`, e);
|
|
3027
|
-
}
|
|
3028
|
-
}
|
|
3029
|
-
});
|
|
3030
|
-
}
|
|
3031
|
-
function getStream2(constraintOpt, additionalOpts = {}) {
|
|
3032
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3033
|
-
const { audioId, videoId, devices, type, options } = constraintOpt;
|
|
3034
|
-
const { replaceStream, fallback } = additionalOpts;
|
|
3035
|
-
const hasGrantedPermissions = !!devices.find((d) => d.label !== "");
|
|
3036
|
-
let audioPrimerTrack;
|
|
3037
|
-
let videoPrimerTrack;
|
|
3038
|
-
if (!hasGrantedPermissions) {
|
|
3039
|
-
try {
|
|
3040
|
-
const primerStream = yield getUserMedia({
|
|
3041
|
-
audio: constraintOpt.audioId !== false,
|
|
3042
|
-
video: constraintOpt.videoId !== false,
|
|
3043
|
-
});
|
|
3044
|
-
audioPrimerTrack = primerStream.getAudioTracks()[0];
|
|
3045
|
-
videoPrimerTrack = primerStream.getVideoTracks()[0];
|
|
3046
|
-
}
|
|
3047
|
-
catch (err) {
|
|
3048
|
-
if (err.name === "NotAllowedError") {
|
|
3049
|
-
throw err;
|
|
3050
|
-
}
|
|
3051
|
-
}
|
|
3052
|
-
}
|
|
3053
|
-
const getAudio = () => __awaiter(this, void 0, void 0, function* () {
|
|
3054
|
-
if (audioId === false)
|
|
3055
|
-
return false;
|
|
3056
|
-
if (replaceStream)
|
|
3057
|
-
stopStreamTracks(replaceStream, "audio");
|
|
3058
|
-
const audioTrack = yield getTrack({
|
|
3059
|
-
deviceId: audioId,
|
|
3060
|
-
type,
|
|
3061
|
-
kind: "audio",
|
|
3062
|
-
fallback,
|
|
3063
|
-
primerTrack: audioPrimerTrack,
|
|
3064
|
-
});
|
|
3065
|
-
if (audioPrimerTrack && audioTrack !== audioPrimerTrack) {
|
|
3066
|
-
audioPrimerTrack.stop();
|
|
3067
|
-
}
|
|
3068
|
-
const { disableAEC, disableAGC } = options;
|
|
3069
|
-
const changes = [];
|
|
3070
|
-
if (disableAGC) {
|
|
3071
|
-
changes.push({ autoGainControl: false });
|
|
3072
|
-
}
|
|
3073
|
-
if (disableAEC) {
|
|
3074
|
-
changes.push({ echoCancellation: false });
|
|
3075
|
-
}
|
|
3076
|
-
yield constrainTrack(audioTrack, changes);
|
|
3077
|
-
return audioTrack;
|
|
3078
|
-
});
|
|
3079
|
-
const getVideo = () => __awaiter(this, void 0, void 0, function* () {
|
|
3080
|
-
if (videoId === false)
|
|
3081
|
-
return false;
|
|
3082
|
-
if (replaceStream)
|
|
3083
|
-
stopStreamTracks(replaceStream, "video");
|
|
3084
|
-
const videoTrack = yield getTrack({
|
|
3085
|
-
deviceId: videoId,
|
|
3086
|
-
type,
|
|
3087
|
-
kind: "video",
|
|
3088
|
-
fallback,
|
|
3089
|
-
primerTrack: videoPrimerTrack,
|
|
3090
|
-
});
|
|
3091
|
-
if (videoPrimerTrack && videoTrack !== videoPrimerTrack) {
|
|
3092
|
-
videoPrimerTrack.stop();
|
|
3093
|
-
}
|
|
3094
|
-
const { lowDataMode, simulcast, usingAspectRatio16x9 } = options;
|
|
3095
|
-
const changes = [];
|
|
3096
|
-
if (lowDataMode) {
|
|
3097
|
-
changes.push({ frameRate: simulcast ? 30 : 15 });
|
|
3098
|
-
}
|
|
3099
|
-
if (usingAspectRatio16x9) {
|
|
3100
|
-
changes.push({ aspectRatio: 16 / 9 });
|
|
3101
|
-
}
|
|
3102
|
-
if (lowDataMode) {
|
|
3103
|
-
changes.push({ width: { max: simulcast ? 640 : 320 } });
|
|
3104
|
-
}
|
|
3105
|
-
else {
|
|
3106
|
-
changes.push({ width: { max: 1280 } });
|
|
3107
|
-
}
|
|
3108
|
-
yield constrainTrack(videoTrack, changes);
|
|
3109
|
-
return videoTrack;
|
|
3110
|
-
});
|
|
3111
|
-
const audioPromise = getAudio();
|
|
3112
|
-
const videoPromise = getVideo();
|
|
3113
|
-
let audioTrack;
|
|
3114
|
-
let videoTrack;
|
|
3115
|
-
let error;
|
|
3116
|
-
try {
|
|
3117
|
-
audioTrack = yield audioPromise;
|
|
3118
|
-
}
|
|
3119
|
-
catch (e) {
|
|
3120
|
-
error = e;
|
|
3121
|
-
if (type === "exact")
|
|
3122
|
-
throw e;
|
|
3123
|
-
}
|
|
3124
|
-
try {
|
|
3125
|
-
videoTrack = yield videoPromise;
|
|
3126
|
-
}
|
|
3127
|
-
catch (e) {
|
|
3128
|
-
error = e;
|
|
3129
|
-
if (type === "exact")
|
|
3130
|
-
throw e;
|
|
3131
|
-
}
|
|
3132
|
-
const newStream = new MediaStream([audioTrack, videoTrack].filter(Boolean));
|
|
3133
|
-
let replacedTracks;
|
|
3134
|
-
if (replaceStream) {
|
|
3135
|
-
const only = (audioId === false && "video") || (videoId === false && "audio") || "audio";
|
|
3136
|
-
replacedTracks = replaceTracksInStream(replaceStream, newStream, only);
|
|
3137
|
-
}
|
|
3138
|
-
return { stream: replaceStream || newStream, error, replacedTracks };
|
|
3139
|
-
});
|
|
3140
|
-
}
|
|
3141
2994
|
function getStream(constraintOpt, { replaceStream, fallback = true } = {}) {
|
|
3142
2995
|
var _a;
|
|
3143
2996
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -7127,7 +6980,6 @@ exports.getOptimalBitrate = getOptimalBitrate;
|
|
|
7127
6980
|
exports.getPeerConnectionIndex = getPeerConnectionIndex;
|
|
7128
6981
|
exports.getStats = getStats;
|
|
7129
6982
|
exports.getStream = getStream;
|
|
7130
|
-
exports.getStream2 = getStream2;
|
|
7131
6983
|
exports.getUpdatedDevices = getUpdatedDevices;
|
|
7132
6984
|
exports.getUpdatedStats = getUpdatedStats;
|
|
7133
6985
|
exports.getUserMedia = getUserMedia;
|
package/dist/index.d.cts
CHANGED
|
@@ -360,7 +360,6 @@ declare function getDeviceData({ audioTrack, videoTrack, devices, stoppedVideoTr
|
|
|
360
360
|
}): GetDeviceDataResult;
|
|
361
361
|
declare function stopStreamTracks(stream: MediaStream, only?: "audio" | "video" | false): void;
|
|
362
362
|
declare function replaceTracksInStream(stream: MediaStream, newStream: MediaStream, only: "audio" | "video" | false): MediaStreamTrack[];
|
|
363
|
-
declare function getStream2(constraintOpt: GetConstraintsOptions, additionalOpts?: GetStreamOptions): Promise<GetStreamResult>;
|
|
364
363
|
declare function getStream(constraintOpt: any, { replaceStream, fallback }?: GetStreamOptions): Promise<GetStreamResult>;
|
|
365
364
|
declare function hasGetDisplayMedia(): boolean;
|
|
366
365
|
declare function getDisplayMedia(constraints?: {
|
|
@@ -1508,4 +1507,4 @@ declare class RtcStream {
|
|
|
1508
1507
|
static getTypeFromId(id: string): string;
|
|
1509
1508
|
}
|
|
1510
1509
|
|
|
1511
|
-
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream,
|
|
1510
|
+
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
|
package/dist/index.d.mts
CHANGED
|
@@ -360,7 +360,6 @@ declare function getDeviceData({ audioTrack, videoTrack, devices, stoppedVideoTr
|
|
|
360
360
|
}): GetDeviceDataResult;
|
|
361
361
|
declare function stopStreamTracks(stream: MediaStream, only?: "audio" | "video" | false): void;
|
|
362
362
|
declare function replaceTracksInStream(stream: MediaStream, newStream: MediaStream, only: "audio" | "video" | false): MediaStreamTrack[];
|
|
363
|
-
declare function getStream2(constraintOpt: GetConstraintsOptions, additionalOpts?: GetStreamOptions): Promise<GetStreamResult>;
|
|
364
363
|
declare function getStream(constraintOpt: any, { replaceStream, fallback }?: GetStreamOptions): Promise<GetStreamResult>;
|
|
365
364
|
declare function hasGetDisplayMedia(): boolean;
|
|
366
365
|
declare function getDisplayMedia(constraints?: {
|
|
@@ -1508,4 +1507,4 @@ declare class RtcStream {
|
|
|
1508
1507
|
static getTypeFromId(id: string): string;
|
|
1509
1508
|
}
|
|
1510
1509
|
|
|
1511
|
-
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream,
|
|
1510
|
+
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
|
package/dist/index.d.ts
CHANGED
|
@@ -360,7 +360,6 @@ declare function getDeviceData({ audioTrack, videoTrack, devices, stoppedVideoTr
|
|
|
360
360
|
}): GetDeviceDataResult;
|
|
361
361
|
declare function stopStreamTracks(stream: MediaStream, only?: "audio" | "video" | false): void;
|
|
362
362
|
declare function replaceTracksInStream(stream: MediaStream, newStream: MediaStream, only: "audio" | "video" | false): MediaStreamTrack[];
|
|
363
|
-
declare function getStream2(constraintOpt: GetConstraintsOptions, additionalOpts?: GetStreamOptions): Promise<GetStreamResult>;
|
|
364
363
|
declare function getStream(constraintOpt: any, { replaceStream, fallback }?: GetStreamOptions): Promise<GetStreamResult>;
|
|
365
364
|
declare function hasGetDisplayMedia(): boolean;
|
|
366
365
|
declare function getDisplayMedia(constraints?: {
|
|
@@ -1508,4 +1507,4 @@ declare class RtcStream {
|
|
|
1508
1507
|
static getTypeFromId(id: string): string;
|
|
1509
1508
|
}
|
|
1510
1509
|
|
|
1511
|
-
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream,
|
|
1510
|
+
export { type AddSpotlightRequest, type AudioEnableRequest, type AudioEnableRequestedEvent, type AudioEnabledEvent, BandwidthTester, type BreakoutGroupJoinedEvent, type ChatMessage, type ClientKickedEvent, type ClientLeftEvent, type ClientMetadataPayload, type ClientMetadataReceivedEvent, type ClientRole, type ClientUnableToJoinEvent, type CloudRecordingStartedEvent, type Credentials, type CustomMediaStreamTrack, EVENTS, type GetConstraintsOptions, type GetDeviceDataResult, type GetMediaConstraintsOptions, type GetStreamOptions, type GetStreamResult, type GetUpdatedDevicesResult, type IdentifyDeviceRequest, type IssuesAndMetricsByView, type JoinRoomRequest, KNOCK_MESSAGES, KalmanFilter, type KnockAcceptedEvent, type KnockRejectedEvent, type KnockRoomRequest, type KnockerLeftEvent, type LiveTranscriptionStartedEvent, type LiveTranscriptionStoppedEvent, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, type NewClientEvent, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, type RemoveSpotlightRequest, type RoleName, type RoomJoinedEvent, type RoomKnockedEvent, type RoomLockedEvent, type RoomSessionEndedEvent, type RtcClientConnectionStatusChangedPayload, RtcEventNames, type RtcEvents, type RtcLocalStreamTrackAddedPayload, type RtcLocalStreamTrackRemovedPayload, type RtcManager, type RtcManagerCreatedPayload, RtcManagerDispatcher, RtcStream, type RtcStreamAddedPayload, STREAM_TYPES, type ScreenshareStartedEvent, type ScreenshareStoppedEvent, type SendClientMetadataRequest, ServerSocket, Session, SfuV2Parser, type SignalClient, type SignalEvents, type SignalKnocker, type SignalRequests, type SocketConf, type SocketManager, type Spotlight, type SpotlightAddedEvent, type SpotlightRemovedEvent, type StatsMonitorOptions, type StatsMonitorState, TYPES, type TurnTransportProtocol, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, type VideoEnableRequest, type VideoEnableRequestedEvent, type VideoEnabledEvent, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, _default as rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
|
package/dist/index.mjs
CHANGED
|
@@ -2970,153 +2970,6 @@ function replaceTracksInStream(stream, newStream, only) {
|
|
|
2970
2970
|
});
|
|
2971
2971
|
return replacedTracks;
|
|
2972
2972
|
}
|
|
2973
|
-
function getTrack({ kind, deviceId, type, fallback = true, primerTrack, }) {
|
|
2974
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2975
|
-
const devId = (deviceId) => (type === "exact" ? { deviceId: { exact: deviceId } } : { deviceId });
|
|
2976
|
-
const constraints = {
|
|
2977
|
-
[kind]: deviceId ? devId(deviceId) : kind === "video" ? { facingMode: "user" } : true,
|
|
2978
|
-
};
|
|
2979
|
-
let stream;
|
|
2980
|
-
try {
|
|
2981
|
-
stream = yield getUserMedia(constraints);
|
|
2982
|
-
}
|
|
2983
|
-
catch (e) {
|
|
2984
|
-
if (!fallback) {
|
|
2985
|
-
e.details = { constraints, constraint: e.constraint };
|
|
2986
|
-
throw e;
|
|
2987
|
-
}
|
|
2988
|
-
if (primerTrack) {
|
|
2989
|
-
return primerTrack;
|
|
2990
|
-
}
|
|
2991
|
-
stream = yield getUserMedia({ [kind]: true });
|
|
2992
|
-
}
|
|
2993
|
-
return stream.getTracks()[0];
|
|
2994
|
-
});
|
|
2995
|
-
}
|
|
2996
|
-
function constrainTrack(track, constraints) {
|
|
2997
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2998
|
-
while (constraints.length) {
|
|
2999
|
-
try {
|
|
3000
|
-
yield track.applyConstraints(Object.assign({}, ...constraints));
|
|
3001
|
-
break;
|
|
3002
|
-
}
|
|
3003
|
-
catch (e) {
|
|
3004
|
-
const c = constraints.pop();
|
|
3005
|
-
logger$6.warn(`unable to apply ${JSON.stringify(c)}`, e);
|
|
3006
|
-
}
|
|
3007
|
-
}
|
|
3008
|
-
});
|
|
3009
|
-
}
|
|
3010
|
-
function getStream2(constraintOpt, additionalOpts = {}) {
|
|
3011
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3012
|
-
const { audioId, videoId, devices, type, options } = constraintOpt;
|
|
3013
|
-
const { replaceStream, fallback } = additionalOpts;
|
|
3014
|
-
const hasGrantedPermissions = !!devices.find((d) => d.label !== "");
|
|
3015
|
-
let audioPrimerTrack;
|
|
3016
|
-
let videoPrimerTrack;
|
|
3017
|
-
if (!hasGrantedPermissions) {
|
|
3018
|
-
try {
|
|
3019
|
-
const primerStream = yield getUserMedia({
|
|
3020
|
-
audio: constraintOpt.audioId !== false,
|
|
3021
|
-
video: constraintOpt.videoId !== false,
|
|
3022
|
-
});
|
|
3023
|
-
audioPrimerTrack = primerStream.getAudioTracks()[0];
|
|
3024
|
-
videoPrimerTrack = primerStream.getVideoTracks()[0];
|
|
3025
|
-
}
|
|
3026
|
-
catch (err) {
|
|
3027
|
-
if (err.name === "NotAllowedError") {
|
|
3028
|
-
throw err;
|
|
3029
|
-
}
|
|
3030
|
-
}
|
|
3031
|
-
}
|
|
3032
|
-
const getAudio = () => __awaiter(this, void 0, void 0, function* () {
|
|
3033
|
-
if (audioId === false)
|
|
3034
|
-
return false;
|
|
3035
|
-
if (replaceStream)
|
|
3036
|
-
stopStreamTracks(replaceStream, "audio");
|
|
3037
|
-
const audioTrack = yield getTrack({
|
|
3038
|
-
deviceId: audioId,
|
|
3039
|
-
type,
|
|
3040
|
-
kind: "audio",
|
|
3041
|
-
fallback,
|
|
3042
|
-
primerTrack: audioPrimerTrack,
|
|
3043
|
-
});
|
|
3044
|
-
if (audioPrimerTrack && audioTrack !== audioPrimerTrack) {
|
|
3045
|
-
audioPrimerTrack.stop();
|
|
3046
|
-
}
|
|
3047
|
-
const { disableAEC, disableAGC } = options;
|
|
3048
|
-
const changes = [];
|
|
3049
|
-
if (disableAGC) {
|
|
3050
|
-
changes.push({ autoGainControl: false });
|
|
3051
|
-
}
|
|
3052
|
-
if (disableAEC) {
|
|
3053
|
-
changes.push({ echoCancellation: false });
|
|
3054
|
-
}
|
|
3055
|
-
yield constrainTrack(audioTrack, changes);
|
|
3056
|
-
return audioTrack;
|
|
3057
|
-
});
|
|
3058
|
-
const getVideo = () => __awaiter(this, void 0, void 0, function* () {
|
|
3059
|
-
if (videoId === false)
|
|
3060
|
-
return false;
|
|
3061
|
-
if (replaceStream)
|
|
3062
|
-
stopStreamTracks(replaceStream, "video");
|
|
3063
|
-
const videoTrack = yield getTrack({
|
|
3064
|
-
deviceId: videoId,
|
|
3065
|
-
type,
|
|
3066
|
-
kind: "video",
|
|
3067
|
-
fallback,
|
|
3068
|
-
primerTrack: videoPrimerTrack,
|
|
3069
|
-
});
|
|
3070
|
-
if (videoPrimerTrack && videoTrack !== videoPrimerTrack) {
|
|
3071
|
-
videoPrimerTrack.stop();
|
|
3072
|
-
}
|
|
3073
|
-
const { lowDataMode, simulcast, usingAspectRatio16x9 } = options;
|
|
3074
|
-
const changes = [];
|
|
3075
|
-
if (lowDataMode) {
|
|
3076
|
-
changes.push({ frameRate: simulcast ? 30 : 15 });
|
|
3077
|
-
}
|
|
3078
|
-
if (usingAspectRatio16x9) {
|
|
3079
|
-
changes.push({ aspectRatio: 16 / 9 });
|
|
3080
|
-
}
|
|
3081
|
-
if (lowDataMode) {
|
|
3082
|
-
changes.push({ width: { max: simulcast ? 640 : 320 } });
|
|
3083
|
-
}
|
|
3084
|
-
else {
|
|
3085
|
-
changes.push({ width: { max: 1280 } });
|
|
3086
|
-
}
|
|
3087
|
-
yield constrainTrack(videoTrack, changes);
|
|
3088
|
-
return videoTrack;
|
|
3089
|
-
});
|
|
3090
|
-
const audioPromise = getAudio();
|
|
3091
|
-
const videoPromise = getVideo();
|
|
3092
|
-
let audioTrack;
|
|
3093
|
-
let videoTrack;
|
|
3094
|
-
let error;
|
|
3095
|
-
try {
|
|
3096
|
-
audioTrack = yield audioPromise;
|
|
3097
|
-
}
|
|
3098
|
-
catch (e) {
|
|
3099
|
-
error = e;
|
|
3100
|
-
if (type === "exact")
|
|
3101
|
-
throw e;
|
|
3102
|
-
}
|
|
3103
|
-
try {
|
|
3104
|
-
videoTrack = yield videoPromise;
|
|
3105
|
-
}
|
|
3106
|
-
catch (e) {
|
|
3107
|
-
error = e;
|
|
3108
|
-
if (type === "exact")
|
|
3109
|
-
throw e;
|
|
3110
|
-
}
|
|
3111
|
-
const newStream = new MediaStream([audioTrack, videoTrack].filter(Boolean));
|
|
3112
|
-
let replacedTracks;
|
|
3113
|
-
if (replaceStream) {
|
|
3114
|
-
const only = (audioId === false && "video") || (videoId === false && "audio") || "audio";
|
|
3115
|
-
replacedTracks = replaceTracksInStream(replaceStream, newStream, only);
|
|
3116
|
-
}
|
|
3117
|
-
return { stream: replaceStream || newStream, error, replacedTracks };
|
|
3118
|
-
});
|
|
3119
|
-
}
|
|
3120
2973
|
function getStream(constraintOpt, { replaceStream, fallback = true } = {}) {
|
|
3121
2974
|
var _a;
|
|
3122
2975
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -7045,4 +6898,4 @@ var RtcEventNames;
|
|
|
7045
6898
|
RtcEventNames["stream_added"] = "stream_added";
|
|
7046
6899
|
})(RtcEventNames || (RtcEventNames = {}));
|
|
7047
6900
|
|
|
7048
|
-
export { BandwidthTester, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, RtcStream, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream,
|
|
6901
|
+
export { BandwidthTester, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, RtcStream, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
|
package/dist/legacy-esm.js
CHANGED
|
@@ -2970,153 +2970,6 @@ function replaceTracksInStream(stream, newStream, only) {
|
|
|
2970
2970
|
});
|
|
2971
2971
|
return replacedTracks;
|
|
2972
2972
|
}
|
|
2973
|
-
function getTrack({ kind, deviceId, type, fallback = true, primerTrack, }) {
|
|
2974
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2975
|
-
const devId = (deviceId) => (type === "exact" ? { deviceId: { exact: deviceId } } : { deviceId });
|
|
2976
|
-
const constraints = {
|
|
2977
|
-
[kind]: deviceId ? devId(deviceId) : kind === "video" ? { facingMode: "user" } : true,
|
|
2978
|
-
};
|
|
2979
|
-
let stream;
|
|
2980
|
-
try {
|
|
2981
|
-
stream = yield getUserMedia(constraints);
|
|
2982
|
-
}
|
|
2983
|
-
catch (e) {
|
|
2984
|
-
if (!fallback) {
|
|
2985
|
-
e.details = { constraints, constraint: e.constraint };
|
|
2986
|
-
throw e;
|
|
2987
|
-
}
|
|
2988
|
-
if (primerTrack) {
|
|
2989
|
-
return primerTrack;
|
|
2990
|
-
}
|
|
2991
|
-
stream = yield getUserMedia({ [kind]: true });
|
|
2992
|
-
}
|
|
2993
|
-
return stream.getTracks()[0];
|
|
2994
|
-
});
|
|
2995
|
-
}
|
|
2996
|
-
function constrainTrack(track, constraints) {
|
|
2997
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
2998
|
-
while (constraints.length) {
|
|
2999
|
-
try {
|
|
3000
|
-
yield track.applyConstraints(Object.assign({}, ...constraints));
|
|
3001
|
-
break;
|
|
3002
|
-
}
|
|
3003
|
-
catch (e) {
|
|
3004
|
-
const c = constraints.pop();
|
|
3005
|
-
logger$6.warn(`unable to apply ${JSON.stringify(c)}`, e);
|
|
3006
|
-
}
|
|
3007
|
-
}
|
|
3008
|
-
});
|
|
3009
|
-
}
|
|
3010
|
-
function getStream2(constraintOpt, additionalOpts = {}) {
|
|
3011
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
3012
|
-
const { audioId, videoId, devices, type, options } = constraintOpt;
|
|
3013
|
-
const { replaceStream, fallback } = additionalOpts;
|
|
3014
|
-
const hasGrantedPermissions = !!devices.find((d) => d.label !== "");
|
|
3015
|
-
let audioPrimerTrack;
|
|
3016
|
-
let videoPrimerTrack;
|
|
3017
|
-
if (!hasGrantedPermissions) {
|
|
3018
|
-
try {
|
|
3019
|
-
const primerStream = yield getUserMedia({
|
|
3020
|
-
audio: constraintOpt.audioId !== false,
|
|
3021
|
-
video: constraintOpt.videoId !== false,
|
|
3022
|
-
});
|
|
3023
|
-
audioPrimerTrack = primerStream.getAudioTracks()[0];
|
|
3024
|
-
videoPrimerTrack = primerStream.getVideoTracks()[0];
|
|
3025
|
-
}
|
|
3026
|
-
catch (err) {
|
|
3027
|
-
if (err.name === "NotAllowedError") {
|
|
3028
|
-
throw err;
|
|
3029
|
-
}
|
|
3030
|
-
}
|
|
3031
|
-
}
|
|
3032
|
-
const getAudio = () => __awaiter(this, void 0, void 0, function* () {
|
|
3033
|
-
if (audioId === false)
|
|
3034
|
-
return false;
|
|
3035
|
-
if (replaceStream)
|
|
3036
|
-
stopStreamTracks(replaceStream, "audio");
|
|
3037
|
-
const audioTrack = yield getTrack({
|
|
3038
|
-
deviceId: audioId,
|
|
3039
|
-
type,
|
|
3040
|
-
kind: "audio",
|
|
3041
|
-
fallback,
|
|
3042
|
-
primerTrack: audioPrimerTrack,
|
|
3043
|
-
});
|
|
3044
|
-
if (audioPrimerTrack && audioTrack !== audioPrimerTrack) {
|
|
3045
|
-
audioPrimerTrack.stop();
|
|
3046
|
-
}
|
|
3047
|
-
const { disableAEC, disableAGC } = options;
|
|
3048
|
-
const changes = [];
|
|
3049
|
-
if (disableAGC) {
|
|
3050
|
-
changes.push({ autoGainControl: false });
|
|
3051
|
-
}
|
|
3052
|
-
if (disableAEC) {
|
|
3053
|
-
changes.push({ echoCancellation: false });
|
|
3054
|
-
}
|
|
3055
|
-
yield constrainTrack(audioTrack, changes);
|
|
3056
|
-
return audioTrack;
|
|
3057
|
-
});
|
|
3058
|
-
const getVideo = () => __awaiter(this, void 0, void 0, function* () {
|
|
3059
|
-
if (videoId === false)
|
|
3060
|
-
return false;
|
|
3061
|
-
if (replaceStream)
|
|
3062
|
-
stopStreamTracks(replaceStream, "video");
|
|
3063
|
-
const videoTrack = yield getTrack({
|
|
3064
|
-
deviceId: videoId,
|
|
3065
|
-
type,
|
|
3066
|
-
kind: "video",
|
|
3067
|
-
fallback,
|
|
3068
|
-
primerTrack: videoPrimerTrack,
|
|
3069
|
-
});
|
|
3070
|
-
if (videoPrimerTrack && videoTrack !== videoPrimerTrack) {
|
|
3071
|
-
videoPrimerTrack.stop();
|
|
3072
|
-
}
|
|
3073
|
-
const { lowDataMode, simulcast, usingAspectRatio16x9 } = options;
|
|
3074
|
-
const changes = [];
|
|
3075
|
-
if (lowDataMode) {
|
|
3076
|
-
changes.push({ frameRate: simulcast ? 30 : 15 });
|
|
3077
|
-
}
|
|
3078
|
-
if (usingAspectRatio16x9) {
|
|
3079
|
-
changes.push({ aspectRatio: 16 / 9 });
|
|
3080
|
-
}
|
|
3081
|
-
if (lowDataMode) {
|
|
3082
|
-
changes.push({ width: { max: simulcast ? 640 : 320 } });
|
|
3083
|
-
}
|
|
3084
|
-
else {
|
|
3085
|
-
changes.push({ width: { max: 1280 } });
|
|
3086
|
-
}
|
|
3087
|
-
yield constrainTrack(videoTrack, changes);
|
|
3088
|
-
return videoTrack;
|
|
3089
|
-
});
|
|
3090
|
-
const audioPromise = getAudio();
|
|
3091
|
-
const videoPromise = getVideo();
|
|
3092
|
-
let audioTrack;
|
|
3093
|
-
let videoTrack;
|
|
3094
|
-
let error;
|
|
3095
|
-
try {
|
|
3096
|
-
audioTrack = yield audioPromise;
|
|
3097
|
-
}
|
|
3098
|
-
catch (e) {
|
|
3099
|
-
error = e;
|
|
3100
|
-
if (type === "exact")
|
|
3101
|
-
throw e;
|
|
3102
|
-
}
|
|
3103
|
-
try {
|
|
3104
|
-
videoTrack = yield videoPromise;
|
|
3105
|
-
}
|
|
3106
|
-
catch (e) {
|
|
3107
|
-
error = e;
|
|
3108
|
-
if (type === "exact")
|
|
3109
|
-
throw e;
|
|
3110
|
-
}
|
|
3111
|
-
const newStream = new MediaStream([audioTrack, videoTrack].filter(Boolean));
|
|
3112
|
-
let replacedTracks;
|
|
3113
|
-
if (replaceStream) {
|
|
3114
|
-
const only = (audioId === false && "video") || (videoId === false && "audio") || "audio";
|
|
3115
|
-
replacedTracks = replaceTracksInStream(replaceStream, newStream, only);
|
|
3116
|
-
}
|
|
3117
|
-
return { stream: replaceStream || newStream, error, replacedTracks };
|
|
3118
|
-
});
|
|
3119
|
-
}
|
|
3120
2973
|
function getStream(constraintOpt, { replaceStream, fallback = true } = {}) {
|
|
3121
2974
|
var _a;
|
|
3122
2975
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -7045,5 +6898,5 @@ var RtcEventNames;
|
|
|
7045
6898
|
RtcEventNames["stream_added"] = "stream_added";
|
|
7046
6899
|
})(RtcEventNames || (RtcEventNames = {}));
|
|
7047
6900
|
|
|
7048
|
-
export { BandwidthTester, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, RtcStream, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream,
|
|
6901
|
+
export { BandwidthTester, EVENTS, KNOCK_MESSAGES, KalmanFilter, Logger, MAXIMUM_TURN_BANDWIDTH, MAXIMUM_TURN_BANDWIDTH_UNLIMITED, MEDIA_JITTER_BUFFER_TARGET, NoDevicesError, P2pRtcManager, PROTOCOL_ERRORS, PROTOCOL_EVENTS, PROTOCOL_REQUESTS, PROTOCOL_RESPONSES, RELAY_MESSAGES, ReconnectManager, RtcEventNames, RtcManagerDispatcher, RtcStream, STREAM_TYPES, ServerSocket, Session, SfuV2Parser, TYPES, VegaConnection, VegaMediaQualityMonitor, VegaRtcManager, addAbsCaptureTimeExtMap, addExtMap, assert, buildDeviceList, calculateStd, captureAudioSsrcMetrics, captureCandidatePairInfoMetrics, captureCommonSsrcMetrics, captureSsrcInfo, captureVideoSsrcMetrics, changeMediaDirection, cleanSdp, compareLocalDevices, createACFCalculator, createMicAnalyser, createWorker, deprioritizeH264, detectMicrophoneNotWorking, enumerate, filterMidExtension, filterMsidSemantic, fromLocation, generateByteString, getConstraints, getCurrentPeerConnections, getDeviceData, getDisplayMedia, getHandler, getIssuesAndMetrics, getMediaConstraints, getMediaSettings, getOptimalBitrate, getPeerConnectionIndex, getStats, getStream, getUpdatedDevices, getUpdatedStats, getUserMedia, hasGetDisplayMedia, ipRegex, isMobile, isRelayed, maybeRejectNoH264, maybeTurnOnly, modifyMediaCapabilities, removePeerConnection, replaceSSRCs, replaceTracksInStream, rtcManagerEvents, rtcStats, setClientProvider, setCodecPreferenceSDP, setPeerConnectionsForTests, setVideoBandwidthUsingSetParameters, standardDeviation, startPerformanceMonitor, stopStreamTracks, subscribeIssues, subscribeStats, variance };
|
|
7049
6902
|
//# sourceMappingURL=legacy-esm.js.map
|