@livedigital/client 2.4.0-beta.2 → 2.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/package.json +1 -2
- package/src/engine/index.ts +13 -56
- package/src/engine/network/Socket.ts +4 -10
- package/dist/EnhancedEventEmitter.d.ts +0 -7
- package/dist/constants/events.d.ts +0 -54
- package/dist/constants/simulcastEncodings.d.ts +0 -9
- package/dist/constants/videoConstrains.d.ts +0 -18
- package/dist/engine/Logger.d.ts +0 -11
- package/dist/engine/Peer.d.ts +0 -56
- package/dist/engine/PeerConsumer.d.ts +0 -37
- package/dist/engine/PeerProducer.d.ts +0 -15
- package/dist/engine/handlers/ChannelEventHandler.d.ts +0 -8
- package/dist/engine/handlers/MediaSoupEventHandler.d.ts +0 -8
- package/dist/engine/index.d.ts +0 -58
- package/dist/engine/media/index.d.ts +0 -20
- package/dist/engine/media/tracks/AudioTrack.d.ts +0 -9
- package/dist/engine/media/tracks/BaseTrack.d.ts +0 -26
- package/dist/engine/media/tracks/PeerTrack.d.ts +0 -29
- package/dist/engine/media/tracks/TrackWithCodecOptions.d.ts +0 -4
- package/dist/engine/media/tracks/TrackWithEncodings.d.ts +0 -4
- package/dist/engine/media/tracks/VideoTrack.d.ts +0 -17
- package/dist/engine/network/LoadBalancerClient.d.ts +0 -13
- package/dist/engine/network/Socket.d.ts +0 -21
- package/dist/engine/network/index.d.ts +0 -24
- package/dist/engine/system/index.d.ts +0 -24
- package/dist/helpers/datetime.d.ts +0 -5
- package/dist/helpers/retry.d.ts +0 -10
- package/dist/index.d.ts +0 -32
- package/dist/index.es.js +0 -15
- package/dist/index.js +0 -15
- package/dist/types/common.d.ts +0 -211
- package/dist/types/network.d.ts +0 -8
- package/src/helpers/datetime.ts +0 -13
- package/src/helpers/retry.ts +0 -50
package/dist/types/common.d.ts
DELETED
|
@@ -1,211 +0,0 @@
|
|
|
1
|
-
import { MediaKind, RtpEncodingParameters, RtpParameters } from 'mediasoup-client/lib/types';
|
|
2
|
-
import AudioTrack from '../engine/media/tracks/AudioTrack';
|
|
3
|
-
import VideoTrack from '../engine/media/tracks/VideoTrack';
|
|
4
|
-
export declare type SocketResponse = {
|
|
5
|
-
success?: boolean;
|
|
6
|
-
error?: string;
|
|
7
|
-
errorCode?: string;
|
|
8
|
-
[key: string]: unknown;
|
|
9
|
-
};
|
|
10
|
-
export declare type ProduceParams = {
|
|
11
|
-
kind: MediaKind;
|
|
12
|
-
rtpParameters: RtpParameters;
|
|
13
|
-
appData: Record<string, unknown>;
|
|
14
|
-
};
|
|
15
|
-
export declare type TrackTransformParams = {
|
|
16
|
-
width?: number;
|
|
17
|
-
height?: number;
|
|
18
|
-
};
|
|
19
|
-
export declare type ProducerData = {
|
|
20
|
-
id: string;
|
|
21
|
-
kind: MediaKind;
|
|
22
|
-
peerId: string;
|
|
23
|
-
label: TrackLabel;
|
|
24
|
-
encodings: RtpEncodingParameters[];
|
|
25
|
-
trackTransformParams: TrackTransformParams;
|
|
26
|
-
maxSpatialLayer: number;
|
|
27
|
-
};
|
|
28
|
-
export declare type ConsumerData = {
|
|
29
|
-
producerData: ProducerData;
|
|
30
|
-
peerId: string;
|
|
31
|
-
appId: string;
|
|
32
|
-
channelId: string;
|
|
33
|
-
};
|
|
34
|
-
export declare type Role = 'audience' | 'host';
|
|
35
|
-
export declare type PeerResponse = {
|
|
36
|
-
id: string;
|
|
37
|
-
channelIds: string[];
|
|
38
|
-
appId: string;
|
|
39
|
-
producers: ProducerData[];
|
|
40
|
-
uid?: string;
|
|
41
|
-
appData: Record<string, unknown>;
|
|
42
|
-
role: Role;
|
|
43
|
-
};
|
|
44
|
-
export declare type AvailableMediaDevices = {
|
|
45
|
-
video: MediaDeviceInfo[];
|
|
46
|
-
audio: MediaDeviceInfo[];
|
|
47
|
-
};
|
|
48
|
-
export declare type JoinChannelParams = {
|
|
49
|
-
channelId: string;
|
|
50
|
-
appId: string;
|
|
51
|
-
sdkSecret: string;
|
|
52
|
-
role: Role;
|
|
53
|
-
uid?: string;
|
|
54
|
-
appData?: Record<string, unknown>;
|
|
55
|
-
};
|
|
56
|
-
export declare type ChannelEvent = {
|
|
57
|
-
eventName: string;
|
|
58
|
-
data: Record<string, unknown>;
|
|
59
|
-
};
|
|
60
|
-
export declare type VideoTrackConstraints = {
|
|
61
|
-
resolution?: {
|
|
62
|
-
width: {
|
|
63
|
-
ideal: number;
|
|
64
|
-
};
|
|
65
|
-
height: {
|
|
66
|
-
ideal: number;
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
frameRate?: number;
|
|
70
|
-
};
|
|
71
|
-
export declare type AudioTrackConstraints = {
|
|
72
|
-
autoGainControl?: boolean;
|
|
73
|
-
};
|
|
74
|
-
export declare type SetConsumerPriorityParams = {
|
|
75
|
-
consumerId: string;
|
|
76
|
-
priority: number;
|
|
77
|
-
};
|
|
78
|
-
export declare type PreferredLayersParams = {
|
|
79
|
-
spatialLayer: number;
|
|
80
|
-
temporalLayer?: number;
|
|
81
|
-
};
|
|
82
|
-
export declare type ChangePreferredLayersParams = {
|
|
83
|
-
consumerId: string;
|
|
84
|
-
peerId: string;
|
|
85
|
-
spatialLayer: number;
|
|
86
|
-
temporalLayer: number;
|
|
87
|
-
};
|
|
88
|
-
export declare enum ProducerKind {
|
|
89
|
-
VIDEO = "video",
|
|
90
|
-
AUDIO = "audio"
|
|
91
|
-
}
|
|
92
|
-
export declare type ConsumerScoreChangedPayload = {
|
|
93
|
-
score: number;
|
|
94
|
-
producerScore: number;
|
|
95
|
-
consumerId: string;
|
|
96
|
-
consumerPeerId: string;
|
|
97
|
-
kind: MediaKind;
|
|
98
|
-
};
|
|
99
|
-
export declare type ProducerScoreChangedPayload = {
|
|
100
|
-
scores: {
|
|
101
|
-
score: number;
|
|
102
|
-
ssrc: number;
|
|
103
|
-
rid?: string;
|
|
104
|
-
}[];
|
|
105
|
-
producerId: string;
|
|
106
|
-
kind: MediaKind;
|
|
107
|
-
};
|
|
108
|
-
export declare enum ConnectionQuality {
|
|
109
|
-
BAD = 1,
|
|
110
|
-
MEDIUM = 2,
|
|
111
|
-
GOOD = 3
|
|
112
|
-
}
|
|
113
|
-
export declare type EncoderConfig = {};
|
|
114
|
-
export declare type VideoCodec = 'h264' | 'vp8';
|
|
115
|
-
export declare type VideoEncoderConfig = EncoderConfig & {
|
|
116
|
-
preferredCodec?: VideoCodec;
|
|
117
|
-
encodings?: RtpEncodingParameters[];
|
|
118
|
-
videoGoogleStartBitrate?: number;
|
|
119
|
-
};
|
|
120
|
-
export declare type AudioEncoderConfig = EncoderConfig & {
|
|
121
|
-
enableFec?: boolean;
|
|
122
|
-
};
|
|
123
|
-
export declare type CreateTrackOptions = {
|
|
124
|
-
encoderConfig?: EncoderConfig;
|
|
125
|
-
deviceId?: string;
|
|
126
|
-
};
|
|
127
|
-
export declare type CreateVideoTrackOptions = CreateTrackOptions & {
|
|
128
|
-
width?: number;
|
|
129
|
-
height?: number;
|
|
130
|
-
frameRate?: number;
|
|
131
|
-
};
|
|
132
|
-
export declare type CreateCameraVideoTrackOptions = CreateVideoTrackOptions & {
|
|
133
|
-
encoderConfig?: VideoEncoderConfig;
|
|
134
|
-
};
|
|
135
|
-
export declare type CreateScreenVideoTrackOptions = CreateVideoTrackOptions & {
|
|
136
|
-
encoderConfig?: VideoEncoderConfig;
|
|
137
|
-
};
|
|
138
|
-
export declare type CreateMicrophoneAudioTrackOptions = CreateTrackOptions & {
|
|
139
|
-
encoderConfig?: AudioEncoderConfig;
|
|
140
|
-
};
|
|
141
|
-
export declare type CreateScreenAudioTrackOptions = CreateMicrophoneAudioTrackOptions & {
|
|
142
|
-
encoderConfig?: AudioEncoderConfig;
|
|
143
|
-
};
|
|
144
|
-
export declare type CreateScreenMediaOptions = {
|
|
145
|
-
video: CreateScreenVideoTrackOptions;
|
|
146
|
-
audio: CreateScreenAudioTrackOptions;
|
|
147
|
-
};
|
|
148
|
-
export declare type Track = VideoTrack | AudioTrack;
|
|
149
|
-
export declare enum TrackLabel {
|
|
150
|
-
Camera = "camera",
|
|
151
|
-
Microphone = "microphone",
|
|
152
|
-
ScreenVideo = "screen-video",
|
|
153
|
-
ScreenAudio = "screen-audio",
|
|
154
|
-
Unknown = "unknown"
|
|
155
|
-
}
|
|
156
|
-
export declare type StartTrackPayload = {
|
|
157
|
-
producerId: string;
|
|
158
|
-
consumerId?: string;
|
|
159
|
-
track: MediaStreamTrack;
|
|
160
|
-
label: TrackLabel;
|
|
161
|
-
};
|
|
162
|
-
export declare type EndTrackPayload = {
|
|
163
|
-
producerId: string;
|
|
164
|
-
kind: MediaKind;
|
|
165
|
-
label: TrackLabel;
|
|
166
|
-
};
|
|
167
|
-
export declare type PayloadOfPublishedMedia = {
|
|
168
|
-
producerId: string;
|
|
169
|
-
kind: MediaKind;
|
|
170
|
-
label: TrackLabel;
|
|
171
|
-
};
|
|
172
|
-
export declare type PayloadOfUnpublishedMedia = PayloadOfPublishedMedia;
|
|
173
|
-
export declare type ChangePreferredLayersPayload = PreferredLayersParams & {
|
|
174
|
-
consumerId: string;
|
|
175
|
-
spatialLayer: number;
|
|
176
|
-
temporalLayer: number;
|
|
177
|
-
};
|
|
178
|
-
export declare type CreateVideoTrackParams = {
|
|
179
|
-
videoTrackOptions: {
|
|
180
|
-
deviceId?: string;
|
|
181
|
-
width?: {
|
|
182
|
-
max?: number;
|
|
183
|
-
min?: number;
|
|
184
|
-
ideal?: number;
|
|
185
|
-
};
|
|
186
|
-
height?: {
|
|
187
|
-
max?: number;
|
|
188
|
-
min?: number;
|
|
189
|
-
ideal?: number;
|
|
190
|
-
};
|
|
191
|
-
frameRate?: {
|
|
192
|
-
max?: number;
|
|
193
|
-
min?: number;
|
|
194
|
-
ideal?: number;
|
|
195
|
-
};
|
|
196
|
-
};
|
|
197
|
-
encoderConfig: VideoEncoderConfig;
|
|
198
|
-
transformParams: TransformParams;
|
|
199
|
-
};
|
|
200
|
-
export declare type SpatialLayerParams = RtpEncodingParameters & TransformParams;
|
|
201
|
-
export declare type ProducerRequestMaxSpatialLayer = {
|
|
202
|
-
producerId: string;
|
|
203
|
-
spatialLayer: number;
|
|
204
|
-
};
|
|
205
|
-
export declare type ProducerSetMaxSpatialLayer = ProducerRequestMaxSpatialLayer & {
|
|
206
|
-
peerId: string;
|
|
207
|
-
};
|
|
208
|
-
export declare type TransformParams = {
|
|
209
|
-
width?: number;
|
|
210
|
-
height?: number;
|
|
211
|
-
};
|
package/dist/types/network.d.ts
DELETED
package/src/helpers/datetime.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
class DefaultTimeProvider {
|
|
2
|
-
// eslint-disable-next-line class-methods-use-this
|
|
3
|
-
async sleepMs(ms: number): Promise<void> {
|
|
4
|
-
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
// eslint-disable-next-line class-methods-use-this
|
|
8
|
-
now(): Date {
|
|
9
|
-
return new Date(Date.now());
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
export default DefaultTimeProvider;
|
package/src/helpers/retry.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import DefaultTimeProvider from './datetime';
|
|
2
|
-
import Logger from '../engine/Logger';
|
|
3
|
-
|
|
4
|
-
export type RetryOpts = {
|
|
5
|
-
maxRetries?: number;
|
|
6
|
-
minBackoffDelayMs?: number;
|
|
7
|
-
maxBackoffDelayMs?: number;
|
|
8
|
-
actionName?: string; // human-readable action name for debug purposes
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const logger = new Logger('Retry');
|
|
12
|
-
const timeProvider = new DefaultTimeProvider();
|
|
13
|
-
|
|
14
|
-
const retryAsync = async <ReturnType>(
|
|
15
|
-
action: () => Promise<ReturnType>,
|
|
16
|
-
opts: RetryOpts = {},
|
|
17
|
-
): Promise<ReturnType> => {
|
|
18
|
-
const maxRetries = opts.maxRetries || 2;
|
|
19
|
-
const minBackoffDelayMs = opts.minBackoffDelayMs || 50;
|
|
20
|
-
let currentAttempt = 0;
|
|
21
|
-
let lastError;
|
|
22
|
-
|
|
23
|
-
while (currentAttempt < maxRetries) {
|
|
24
|
-
currentAttempt += 1;
|
|
25
|
-
|
|
26
|
-
try {
|
|
27
|
-
// eslint-disable-next-line no-await-in-loop
|
|
28
|
-
return await action();
|
|
29
|
-
} catch (err: unknown) {
|
|
30
|
-
lastError = err;
|
|
31
|
-
logger.warn('Action retry failed', currentAttempt, opts.actionName, err);
|
|
32
|
-
|
|
33
|
-
if (currentAttempt < maxRetries) {
|
|
34
|
-
const delay = 2 ** (currentAttempt - 1) * minBackoffDelayMs;
|
|
35
|
-
// eslint-disable-next-line no-await-in-loop
|
|
36
|
-
await timeProvider.sleepMs(Math.min(delay, opts.maxBackoffDelayMs ?? delay));
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
throw lastError;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const retry = async <ReturnType>(
|
|
45
|
-
action: () => ReturnType,
|
|
46
|
-
opts: RetryOpts = {},
|
|
47
|
-
): Promise<ReturnType> => retryAsync(async () => action(), opts);
|
|
48
|
-
|
|
49
|
-
export { retryAsync };
|
|
50
|
-
export default retry;
|