@daydreamlive/browser 0.1.0 → 0.2.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 +1200 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +141 -2
- package/dist/index.d.ts +141 -2
- package/dist/index.js +1199 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -8,12 +8,17 @@ interface BroadcastOptions {
|
|
|
8
8
|
stream: MediaStream;
|
|
9
9
|
reconnect?: ReconnectConfig;
|
|
10
10
|
video?: VideoConfig;
|
|
11
|
+
audio?: AudioConfig;
|
|
12
|
+
iceServers?: RTCIceServer[];
|
|
13
|
+
connectionTimeout?: number;
|
|
11
14
|
onStats?: (report: RTCStatsReport) => void;
|
|
12
15
|
statsIntervalMs?: number;
|
|
13
16
|
onResponse?: (response: Response) => WHIPResponseResult | void;
|
|
14
17
|
}
|
|
15
18
|
interface PlayerOptions {
|
|
16
19
|
reconnect?: ReconnectConfig;
|
|
20
|
+
iceServers?: RTCIceServer[];
|
|
21
|
+
connectionTimeout?: number;
|
|
17
22
|
onStats?: (report: RTCStatsReport) => void;
|
|
18
23
|
statsIntervalMs?: number;
|
|
19
24
|
}
|
|
@@ -22,17 +27,27 @@ interface ReconnectConfig {
|
|
|
22
27
|
maxAttempts?: number;
|
|
23
28
|
baseDelayMs?: number;
|
|
24
29
|
}
|
|
30
|
+
interface ReconnectInfo {
|
|
31
|
+
attempt: number;
|
|
32
|
+
maxAttempts: number;
|
|
33
|
+
delayMs: number;
|
|
34
|
+
}
|
|
25
35
|
interface VideoConfig {
|
|
26
36
|
bitrate?: number;
|
|
27
37
|
maxFramerate?: number;
|
|
28
38
|
}
|
|
39
|
+
interface AudioConfig {
|
|
40
|
+
bitrate?: number;
|
|
41
|
+
}
|
|
29
42
|
interface BroadcastEventMap {
|
|
30
43
|
stateChange: (state: BroadcastState) => void;
|
|
31
44
|
error: (error: DaydreamError) => void;
|
|
45
|
+
reconnect: (info: ReconnectInfo) => void;
|
|
32
46
|
}
|
|
33
47
|
interface PlayerEventMap {
|
|
34
48
|
stateChange: (state: PlayerState) => void;
|
|
35
49
|
error: (error: DaydreamError) => void;
|
|
50
|
+
reconnect: (info: ReconnectInfo) => void;
|
|
36
51
|
}
|
|
37
52
|
interface DaydreamError extends Error {
|
|
38
53
|
code: DaydreamErrorCode;
|
|
@@ -40,8 +55,78 @@ interface DaydreamError extends Error {
|
|
|
40
55
|
}
|
|
41
56
|
type DaydreamErrorCode = "NETWORK_ERROR" | "CONNECTION_FAILED" | "STREAM_NOT_FOUND" | "UNAUTHORIZED" | "UNKNOWN";
|
|
42
57
|
declare const DEFAULT_ICE_SERVERS: RTCIceServer[];
|
|
43
|
-
declare const DEFAULT_VIDEO_BITRATE =
|
|
58
|
+
declare const DEFAULT_VIDEO_BITRATE = 300000;
|
|
44
59
|
declare const DEFAULT_AUDIO_BITRATE = 64000;
|
|
60
|
+
type Ctx2D = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
61
|
+
type FitMode = "contain" | "cover";
|
|
62
|
+
type ContentHint = "detail" | "motion" | "";
|
|
63
|
+
type VideoSource = {
|
|
64
|
+
kind: "video";
|
|
65
|
+
element: HTMLVideoElement;
|
|
66
|
+
fit?: FitMode;
|
|
67
|
+
contentHint?: ContentHint;
|
|
68
|
+
};
|
|
69
|
+
type CanvasSource = {
|
|
70
|
+
kind: "canvas";
|
|
71
|
+
element: HTMLCanvasElement;
|
|
72
|
+
fit?: FitMode;
|
|
73
|
+
contentHint?: ContentHint;
|
|
74
|
+
};
|
|
75
|
+
type CustomSource = {
|
|
76
|
+
kind: "custom";
|
|
77
|
+
onStart?: (ctx: Ctx2D) => void | (() => void);
|
|
78
|
+
onFrame?: (ctx: Ctx2D, timestamp: number) => void;
|
|
79
|
+
};
|
|
80
|
+
type Source = VideoSource | CanvasSource | CustomSource;
|
|
81
|
+
type Size = {
|
|
82
|
+
width: number;
|
|
83
|
+
height: number;
|
|
84
|
+
dpr: number;
|
|
85
|
+
};
|
|
86
|
+
interface CompositorOptions {
|
|
87
|
+
width?: number;
|
|
88
|
+
height?: number;
|
|
89
|
+
fps?: number;
|
|
90
|
+
dpr?: number;
|
|
91
|
+
crossfadeMs?: number;
|
|
92
|
+
sendFps?: number;
|
|
93
|
+
keepalive?: boolean;
|
|
94
|
+
autoUnlockAudio?: boolean;
|
|
95
|
+
unlockEvents?: string[];
|
|
96
|
+
disableSilentAudio?: boolean;
|
|
97
|
+
onSendFpsChange?: (fps: number) => void;
|
|
98
|
+
}
|
|
99
|
+
type CompositorEvent = "activated" | "registered" | "unregistered";
|
|
100
|
+
interface CompositorEventMap {
|
|
101
|
+
activated: (id: string | null, source: Source | undefined) => void;
|
|
102
|
+
registered: (id: string, source: Source) => void;
|
|
103
|
+
unregistered: (id: string) => void;
|
|
104
|
+
}
|
|
105
|
+
interface Compositor$1 {
|
|
106
|
+
register(id: string, source: Source): void;
|
|
107
|
+
unregister(id: string): void;
|
|
108
|
+
get(id: string): Source | undefined;
|
|
109
|
+
has(id: string): boolean;
|
|
110
|
+
list(): Array<{
|
|
111
|
+
id: string;
|
|
112
|
+
source: Source;
|
|
113
|
+
}>;
|
|
114
|
+
activate(id: string): void;
|
|
115
|
+
deactivate(): void;
|
|
116
|
+
readonly activeId: string | null;
|
|
117
|
+
readonly stream: MediaStream;
|
|
118
|
+
resize(width: number, height: number, dpr?: number): void;
|
|
119
|
+
readonly size: Size;
|
|
120
|
+
setFps(fps: number): void;
|
|
121
|
+
readonly fps: number;
|
|
122
|
+
setSendFps(fps: number): void;
|
|
123
|
+
readonly sendFps: number;
|
|
124
|
+
addAudioTrack(track: MediaStreamTrack): void;
|
|
125
|
+
removeAudioTrack(trackId: string): void;
|
|
126
|
+
unlockAudio(): Promise<boolean>;
|
|
127
|
+
destroy(): void;
|
|
128
|
+
on<E extends CompositorEvent>(event: E, cb: CompositorEventMap[E]): () => void;
|
|
129
|
+
}
|
|
45
130
|
|
|
46
131
|
interface PeerConnectionFactory {
|
|
47
132
|
create(config: RTCConfiguration): RTCPeerConnection;
|
|
@@ -69,6 +154,7 @@ interface WHIPClientConfig {
|
|
|
69
154
|
videoBitrate?: number;
|
|
70
155
|
audioBitrate?: number;
|
|
71
156
|
maxFramerate?: number;
|
|
157
|
+
connectionTimeout?: number;
|
|
72
158
|
skipIceGathering?: boolean;
|
|
73
159
|
onStats?: (report: RTCStatsReport) => void;
|
|
74
160
|
statsIntervalMs?: number;
|
|
@@ -108,8 +194,10 @@ declare class Broadcast extends TypedEventEmitter<BroadcastEventMap> {
|
|
|
108
194
|
get state(): BroadcastState;
|
|
109
195
|
get whepUrl(): string | null;
|
|
110
196
|
get stream(): MediaStream;
|
|
197
|
+
get reconnectInfo(): ReconnectInfo | null;
|
|
111
198
|
connect(): Promise<void>;
|
|
112
199
|
stop(): Promise<void>;
|
|
200
|
+
setMaxFramerate(fps?: number): void;
|
|
113
201
|
replaceStream(newStream: MediaStream): Promise<void>;
|
|
114
202
|
private setupConnectionMonitoring;
|
|
115
203
|
private clearGraceTimeout;
|
|
@@ -121,6 +209,7 @@ declare class Broadcast extends TypedEventEmitter<BroadcastEventMap> {
|
|
|
121
209
|
interface WHEPClientConfig {
|
|
122
210
|
url: string;
|
|
123
211
|
iceServers?: RTCIceServer[];
|
|
212
|
+
connectionTimeout?: number;
|
|
124
213
|
onStats?: (report: RTCStatsReport) => void;
|
|
125
214
|
statsIntervalMs?: number;
|
|
126
215
|
peerConnectionFactory?: PeerConnectionFactory;
|
|
@@ -147,6 +236,7 @@ declare class Player extends TypedEventEmitter<PlayerEventMap> {
|
|
|
147
236
|
constructor(config: PlayerConfig);
|
|
148
237
|
get state(): PlayerState;
|
|
149
238
|
get stream(): MediaStream | null;
|
|
239
|
+
get reconnectInfo(): ReconnectInfo | null;
|
|
150
240
|
connect(): Promise<void>;
|
|
151
241
|
attachTo(video: HTMLVideoElement): void;
|
|
152
242
|
stop(): Promise<void>;
|
|
@@ -176,9 +266,58 @@ declare class UnauthorizedError extends BaseDaydreamError {
|
|
|
176
266
|
constructor(message: string, cause?: unknown);
|
|
177
267
|
}
|
|
178
268
|
|
|
269
|
+
declare class CompositorEventEmitter {
|
|
270
|
+
private listeners;
|
|
271
|
+
on<E extends CompositorEvent>(event: E, handler: CompositorEventMap[E]): () => void;
|
|
272
|
+
off<E extends CompositorEvent>(event: E, handler: CompositorEventMap[E]): void;
|
|
273
|
+
protected emit<E extends CompositorEvent>(event: E, ...args: Parameters<CompositorEventMap[E]>): void;
|
|
274
|
+
protected clearListeners(): void;
|
|
275
|
+
}
|
|
276
|
+
declare class Compositor extends CompositorEventEmitter implements Compositor$1 {
|
|
277
|
+
private readonly registry;
|
|
278
|
+
private readonly renderer;
|
|
279
|
+
private readonly scheduler;
|
|
280
|
+
private readonly audioManager;
|
|
281
|
+
private readonly visibilityHandler;
|
|
282
|
+
private _activeId;
|
|
283
|
+
private _fps;
|
|
284
|
+
private _sendFps;
|
|
285
|
+
private lastVisibleSendFps;
|
|
286
|
+
private outputStream;
|
|
287
|
+
private destroyed;
|
|
288
|
+
constructor(options?: CompositorOptions);
|
|
289
|
+
register(id: string, source: Source): void;
|
|
290
|
+
unregister(id: string): void;
|
|
291
|
+
get(id: string): Source | undefined;
|
|
292
|
+
has(id: string): boolean;
|
|
293
|
+
list(): Array<{
|
|
294
|
+
id: string;
|
|
295
|
+
source: Source;
|
|
296
|
+
}>;
|
|
297
|
+
activate(id: string): void;
|
|
298
|
+
deactivate(): void;
|
|
299
|
+
get activeId(): string | null;
|
|
300
|
+
get stream(): MediaStream;
|
|
301
|
+
resize(width: number, height: number, dpr?: number): void;
|
|
302
|
+
get size(): Size;
|
|
303
|
+
setFps(fps: number): void;
|
|
304
|
+
get fps(): number;
|
|
305
|
+
setSendFps(fps: number): void;
|
|
306
|
+
get sendFps(): number;
|
|
307
|
+
addAudioTrack(track: MediaStreamTrack): void;
|
|
308
|
+
removeAudioTrack(trackId: string): void;
|
|
309
|
+
unlockAudio(): Promise<boolean>;
|
|
310
|
+
destroy(): void;
|
|
311
|
+
private createOutputStream;
|
|
312
|
+
private recreateStream;
|
|
313
|
+
private applyVideoTrackConstraints;
|
|
314
|
+
private requestVideoTrackFrame;
|
|
315
|
+
}
|
|
316
|
+
declare function createCompositor(options?: CompositorOptions): Compositor;
|
|
317
|
+
|
|
179
318
|
declare const livepeerResponseHandler: (response: Response) => WHIPResponseResult;
|
|
180
319
|
type LivepeerBroadcastOptions = Omit<BroadcastOptions, "onResponse">;
|
|
181
320
|
declare function createBroadcast(options: LivepeerBroadcastOptions): Broadcast;
|
|
182
321
|
declare function createPlayer(whepUrl: string, options?: PlayerOptions): Player;
|
|
183
322
|
|
|
184
|
-
export { BaseDaydreamError, Broadcast, type BroadcastConfig, type BroadcastEventMap, type BroadcastOptions, type BroadcastState, ConnectionError, DEFAULT_AUDIO_BITRATE, DEFAULT_ICE_SERVERS, DEFAULT_VIDEO_BITRATE, type DaydreamError, type DaydreamErrorCode, type LivepeerBroadcastOptions, NetworkError, Player, type PlayerConfig, type PlayerEventMap, type PlayerOptions, type PlayerState, type ReconnectConfig, StreamNotFoundError, UnauthorizedError, type VideoConfig, type WHIPResponseResult, createBroadcast, createPlayer, livepeerResponseHandler };
|
|
323
|
+
export { type AudioConfig, BaseDaydreamError, Broadcast, type BroadcastConfig, type BroadcastEventMap, type BroadcastOptions, type BroadcastState, type CanvasSource, type Compositor$1 as Compositor, type CompositorEvent, type CompositorEventMap, type CompositorOptions, ConnectionError, type ContentHint, type Ctx2D, type CustomSource, DEFAULT_AUDIO_BITRATE, DEFAULT_ICE_SERVERS, DEFAULT_VIDEO_BITRATE, type DaydreamError, type DaydreamErrorCode, type FitMode, type LivepeerBroadcastOptions, NetworkError, Player, type PlayerConfig, type PlayerEventMap, type PlayerOptions, type PlayerState, type ReconnectConfig, type ReconnectInfo, type Size, type Source, StreamNotFoundError, UnauthorizedError, type VideoConfig, type VideoSource, type WHIPResponseResult, createBroadcast, createCompositor, createPlayer, livepeerResponseHandler };
|
package/dist/index.d.ts
CHANGED
|
@@ -8,12 +8,17 @@ interface BroadcastOptions {
|
|
|
8
8
|
stream: MediaStream;
|
|
9
9
|
reconnect?: ReconnectConfig;
|
|
10
10
|
video?: VideoConfig;
|
|
11
|
+
audio?: AudioConfig;
|
|
12
|
+
iceServers?: RTCIceServer[];
|
|
13
|
+
connectionTimeout?: number;
|
|
11
14
|
onStats?: (report: RTCStatsReport) => void;
|
|
12
15
|
statsIntervalMs?: number;
|
|
13
16
|
onResponse?: (response: Response) => WHIPResponseResult | void;
|
|
14
17
|
}
|
|
15
18
|
interface PlayerOptions {
|
|
16
19
|
reconnect?: ReconnectConfig;
|
|
20
|
+
iceServers?: RTCIceServer[];
|
|
21
|
+
connectionTimeout?: number;
|
|
17
22
|
onStats?: (report: RTCStatsReport) => void;
|
|
18
23
|
statsIntervalMs?: number;
|
|
19
24
|
}
|
|
@@ -22,17 +27,27 @@ interface ReconnectConfig {
|
|
|
22
27
|
maxAttempts?: number;
|
|
23
28
|
baseDelayMs?: number;
|
|
24
29
|
}
|
|
30
|
+
interface ReconnectInfo {
|
|
31
|
+
attempt: number;
|
|
32
|
+
maxAttempts: number;
|
|
33
|
+
delayMs: number;
|
|
34
|
+
}
|
|
25
35
|
interface VideoConfig {
|
|
26
36
|
bitrate?: number;
|
|
27
37
|
maxFramerate?: number;
|
|
28
38
|
}
|
|
39
|
+
interface AudioConfig {
|
|
40
|
+
bitrate?: number;
|
|
41
|
+
}
|
|
29
42
|
interface BroadcastEventMap {
|
|
30
43
|
stateChange: (state: BroadcastState) => void;
|
|
31
44
|
error: (error: DaydreamError) => void;
|
|
45
|
+
reconnect: (info: ReconnectInfo) => void;
|
|
32
46
|
}
|
|
33
47
|
interface PlayerEventMap {
|
|
34
48
|
stateChange: (state: PlayerState) => void;
|
|
35
49
|
error: (error: DaydreamError) => void;
|
|
50
|
+
reconnect: (info: ReconnectInfo) => void;
|
|
36
51
|
}
|
|
37
52
|
interface DaydreamError extends Error {
|
|
38
53
|
code: DaydreamErrorCode;
|
|
@@ -40,8 +55,78 @@ interface DaydreamError extends Error {
|
|
|
40
55
|
}
|
|
41
56
|
type DaydreamErrorCode = "NETWORK_ERROR" | "CONNECTION_FAILED" | "STREAM_NOT_FOUND" | "UNAUTHORIZED" | "UNKNOWN";
|
|
42
57
|
declare const DEFAULT_ICE_SERVERS: RTCIceServer[];
|
|
43
|
-
declare const DEFAULT_VIDEO_BITRATE =
|
|
58
|
+
declare const DEFAULT_VIDEO_BITRATE = 300000;
|
|
44
59
|
declare const DEFAULT_AUDIO_BITRATE = 64000;
|
|
60
|
+
type Ctx2D = CanvasRenderingContext2D | OffscreenCanvasRenderingContext2D;
|
|
61
|
+
type FitMode = "contain" | "cover";
|
|
62
|
+
type ContentHint = "detail" | "motion" | "";
|
|
63
|
+
type VideoSource = {
|
|
64
|
+
kind: "video";
|
|
65
|
+
element: HTMLVideoElement;
|
|
66
|
+
fit?: FitMode;
|
|
67
|
+
contentHint?: ContentHint;
|
|
68
|
+
};
|
|
69
|
+
type CanvasSource = {
|
|
70
|
+
kind: "canvas";
|
|
71
|
+
element: HTMLCanvasElement;
|
|
72
|
+
fit?: FitMode;
|
|
73
|
+
contentHint?: ContentHint;
|
|
74
|
+
};
|
|
75
|
+
type CustomSource = {
|
|
76
|
+
kind: "custom";
|
|
77
|
+
onStart?: (ctx: Ctx2D) => void | (() => void);
|
|
78
|
+
onFrame?: (ctx: Ctx2D, timestamp: number) => void;
|
|
79
|
+
};
|
|
80
|
+
type Source = VideoSource | CanvasSource | CustomSource;
|
|
81
|
+
type Size = {
|
|
82
|
+
width: number;
|
|
83
|
+
height: number;
|
|
84
|
+
dpr: number;
|
|
85
|
+
};
|
|
86
|
+
interface CompositorOptions {
|
|
87
|
+
width?: number;
|
|
88
|
+
height?: number;
|
|
89
|
+
fps?: number;
|
|
90
|
+
dpr?: number;
|
|
91
|
+
crossfadeMs?: number;
|
|
92
|
+
sendFps?: number;
|
|
93
|
+
keepalive?: boolean;
|
|
94
|
+
autoUnlockAudio?: boolean;
|
|
95
|
+
unlockEvents?: string[];
|
|
96
|
+
disableSilentAudio?: boolean;
|
|
97
|
+
onSendFpsChange?: (fps: number) => void;
|
|
98
|
+
}
|
|
99
|
+
type CompositorEvent = "activated" | "registered" | "unregistered";
|
|
100
|
+
interface CompositorEventMap {
|
|
101
|
+
activated: (id: string | null, source: Source | undefined) => void;
|
|
102
|
+
registered: (id: string, source: Source) => void;
|
|
103
|
+
unregistered: (id: string) => void;
|
|
104
|
+
}
|
|
105
|
+
interface Compositor$1 {
|
|
106
|
+
register(id: string, source: Source): void;
|
|
107
|
+
unregister(id: string): void;
|
|
108
|
+
get(id: string): Source | undefined;
|
|
109
|
+
has(id: string): boolean;
|
|
110
|
+
list(): Array<{
|
|
111
|
+
id: string;
|
|
112
|
+
source: Source;
|
|
113
|
+
}>;
|
|
114
|
+
activate(id: string): void;
|
|
115
|
+
deactivate(): void;
|
|
116
|
+
readonly activeId: string | null;
|
|
117
|
+
readonly stream: MediaStream;
|
|
118
|
+
resize(width: number, height: number, dpr?: number): void;
|
|
119
|
+
readonly size: Size;
|
|
120
|
+
setFps(fps: number): void;
|
|
121
|
+
readonly fps: number;
|
|
122
|
+
setSendFps(fps: number): void;
|
|
123
|
+
readonly sendFps: number;
|
|
124
|
+
addAudioTrack(track: MediaStreamTrack): void;
|
|
125
|
+
removeAudioTrack(trackId: string): void;
|
|
126
|
+
unlockAudio(): Promise<boolean>;
|
|
127
|
+
destroy(): void;
|
|
128
|
+
on<E extends CompositorEvent>(event: E, cb: CompositorEventMap[E]): () => void;
|
|
129
|
+
}
|
|
45
130
|
|
|
46
131
|
interface PeerConnectionFactory {
|
|
47
132
|
create(config: RTCConfiguration): RTCPeerConnection;
|
|
@@ -69,6 +154,7 @@ interface WHIPClientConfig {
|
|
|
69
154
|
videoBitrate?: number;
|
|
70
155
|
audioBitrate?: number;
|
|
71
156
|
maxFramerate?: number;
|
|
157
|
+
connectionTimeout?: number;
|
|
72
158
|
skipIceGathering?: boolean;
|
|
73
159
|
onStats?: (report: RTCStatsReport) => void;
|
|
74
160
|
statsIntervalMs?: number;
|
|
@@ -108,8 +194,10 @@ declare class Broadcast extends TypedEventEmitter<BroadcastEventMap> {
|
|
|
108
194
|
get state(): BroadcastState;
|
|
109
195
|
get whepUrl(): string | null;
|
|
110
196
|
get stream(): MediaStream;
|
|
197
|
+
get reconnectInfo(): ReconnectInfo | null;
|
|
111
198
|
connect(): Promise<void>;
|
|
112
199
|
stop(): Promise<void>;
|
|
200
|
+
setMaxFramerate(fps?: number): void;
|
|
113
201
|
replaceStream(newStream: MediaStream): Promise<void>;
|
|
114
202
|
private setupConnectionMonitoring;
|
|
115
203
|
private clearGraceTimeout;
|
|
@@ -121,6 +209,7 @@ declare class Broadcast extends TypedEventEmitter<BroadcastEventMap> {
|
|
|
121
209
|
interface WHEPClientConfig {
|
|
122
210
|
url: string;
|
|
123
211
|
iceServers?: RTCIceServer[];
|
|
212
|
+
connectionTimeout?: number;
|
|
124
213
|
onStats?: (report: RTCStatsReport) => void;
|
|
125
214
|
statsIntervalMs?: number;
|
|
126
215
|
peerConnectionFactory?: PeerConnectionFactory;
|
|
@@ -147,6 +236,7 @@ declare class Player extends TypedEventEmitter<PlayerEventMap> {
|
|
|
147
236
|
constructor(config: PlayerConfig);
|
|
148
237
|
get state(): PlayerState;
|
|
149
238
|
get stream(): MediaStream | null;
|
|
239
|
+
get reconnectInfo(): ReconnectInfo | null;
|
|
150
240
|
connect(): Promise<void>;
|
|
151
241
|
attachTo(video: HTMLVideoElement): void;
|
|
152
242
|
stop(): Promise<void>;
|
|
@@ -176,9 +266,58 @@ declare class UnauthorizedError extends BaseDaydreamError {
|
|
|
176
266
|
constructor(message: string, cause?: unknown);
|
|
177
267
|
}
|
|
178
268
|
|
|
269
|
+
declare class CompositorEventEmitter {
|
|
270
|
+
private listeners;
|
|
271
|
+
on<E extends CompositorEvent>(event: E, handler: CompositorEventMap[E]): () => void;
|
|
272
|
+
off<E extends CompositorEvent>(event: E, handler: CompositorEventMap[E]): void;
|
|
273
|
+
protected emit<E extends CompositorEvent>(event: E, ...args: Parameters<CompositorEventMap[E]>): void;
|
|
274
|
+
protected clearListeners(): void;
|
|
275
|
+
}
|
|
276
|
+
declare class Compositor extends CompositorEventEmitter implements Compositor$1 {
|
|
277
|
+
private readonly registry;
|
|
278
|
+
private readonly renderer;
|
|
279
|
+
private readonly scheduler;
|
|
280
|
+
private readonly audioManager;
|
|
281
|
+
private readonly visibilityHandler;
|
|
282
|
+
private _activeId;
|
|
283
|
+
private _fps;
|
|
284
|
+
private _sendFps;
|
|
285
|
+
private lastVisibleSendFps;
|
|
286
|
+
private outputStream;
|
|
287
|
+
private destroyed;
|
|
288
|
+
constructor(options?: CompositorOptions);
|
|
289
|
+
register(id: string, source: Source): void;
|
|
290
|
+
unregister(id: string): void;
|
|
291
|
+
get(id: string): Source | undefined;
|
|
292
|
+
has(id: string): boolean;
|
|
293
|
+
list(): Array<{
|
|
294
|
+
id: string;
|
|
295
|
+
source: Source;
|
|
296
|
+
}>;
|
|
297
|
+
activate(id: string): void;
|
|
298
|
+
deactivate(): void;
|
|
299
|
+
get activeId(): string | null;
|
|
300
|
+
get stream(): MediaStream;
|
|
301
|
+
resize(width: number, height: number, dpr?: number): void;
|
|
302
|
+
get size(): Size;
|
|
303
|
+
setFps(fps: number): void;
|
|
304
|
+
get fps(): number;
|
|
305
|
+
setSendFps(fps: number): void;
|
|
306
|
+
get sendFps(): number;
|
|
307
|
+
addAudioTrack(track: MediaStreamTrack): void;
|
|
308
|
+
removeAudioTrack(trackId: string): void;
|
|
309
|
+
unlockAudio(): Promise<boolean>;
|
|
310
|
+
destroy(): void;
|
|
311
|
+
private createOutputStream;
|
|
312
|
+
private recreateStream;
|
|
313
|
+
private applyVideoTrackConstraints;
|
|
314
|
+
private requestVideoTrackFrame;
|
|
315
|
+
}
|
|
316
|
+
declare function createCompositor(options?: CompositorOptions): Compositor;
|
|
317
|
+
|
|
179
318
|
declare const livepeerResponseHandler: (response: Response) => WHIPResponseResult;
|
|
180
319
|
type LivepeerBroadcastOptions = Omit<BroadcastOptions, "onResponse">;
|
|
181
320
|
declare function createBroadcast(options: LivepeerBroadcastOptions): Broadcast;
|
|
182
321
|
declare function createPlayer(whepUrl: string, options?: PlayerOptions): Player;
|
|
183
322
|
|
|
184
|
-
export { BaseDaydreamError, Broadcast, type BroadcastConfig, type BroadcastEventMap, type BroadcastOptions, type BroadcastState, ConnectionError, DEFAULT_AUDIO_BITRATE, DEFAULT_ICE_SERVERS, DEFAULT_VIDEO_BITRATE, type DaydreamError, type DaydreamErrorCode, type LivepeerBroadcastOptions, NetworkError, Player, type PlayerConfig, type PlayerEventMap, type PlayerOptions, type PlayerState, type ReconnectConfig, StreamNotFoundError, UnauthorizedError, type VideoConfig, type WHIPResponseResult, createBroadcast, createPlayer, livepeerResponseHandler };
|
|
323
|
+
export { type AudioConfig, BaseDaydreamError, Broadcast, type BroadcastConfig, type BroadcastEventMap, type BroadcastOptions, type BroadcastState, type CanvasSource, type Compositor$1 as Compositor, type CompositorEvent, type CompositorEventMap, type CompositorOptions, ConnectionError, type ContentHint, type Ctx2D, type CustomSource, DEFAULT_AUDIO_BITRATE, DEFAULT_ICE_SERVERS, DEFAULT_VIDEO_BITRATE, type DaydreamError, type DaydreamErrorCode, type FitMode, type LivepeerBroadcastOptions, NetworkError, Player, type PlayerConfig, type PlayerEventMap, type PlayerOptions, type PlayerState, type ReconnectConfig, type ReconnectInfo, type Size, type Source, StreamNotFoundError, UnauthorizedError, type VideoConfig, type VideoSource, type WHIPResponseResult, createBroadcast, createCompositor, createPlayer, livepeerResponseHandler };
|