-
Notifications
You must be signed in to change notification settings - Fork 253
Expand file tree
/
Copy pathtypes.ts
More file actions
147 lines (133 loc) · 3.78 KB
/
types.ts
File metadata and controls
147 lines (133 loc) · 3.78 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
import type { DataStream_Chunk, Encryption_Type } from '@livekit/protocol';
import type { Future } from './utils';
export type SimulationOptions = {
publish?: {
audio?: boolean;
video?: boolean;
useRealTracks?: boolean;
};
participants?: {
count?: number;
aspectRatios?: Array<number>;
audio?: boolean;
video?: boolean;
};
};
export interface SendTextOptions {
topic?: string;
// replyToMessageId?: string;
destinationIdentities?: Array<string>;
attachments?: Array<File>;
onProgress?: (progress: number) => void;
attributes?: Record<string, string>;
}
export interface StreamTextOptions {
topic?: string;
destinationIdentities?: Array<string>;
type?: 'create' | 'update';
streamId?: string;
version?: number;
attachedStreamIds?: Array<string>;
replyToStreamId?: string;
totalSize?: number;
attributes?: Record<string, string>;
}
export type StreamBytesOptions = {
name?: string;
topic?: string;
attributes?: Record<string, string>;
destinationIdentities?: Array<string>;
streamId?: string;
mimeType?: string;
totalSize?: number;
};
export type SendFileOptions = Pick<
StreamBytesOptions,
'topic' | 'mimeType' | 'destinationIdentities'
> & {
onProgress?: (progress: number) => void;
encryptionType?: Encryption_Type.NONE;
};
export type DataPublishOptions = {
/**
* whether to send this as reliable or lossy.
* For data that you need delivery guarantee (such as chat messages), use Reliable.
* For data that should arrive as quickly as possible, but you are ok with dropped
* packets, use Lossy.
*/
reliable?: boolean;
/**
* the identities of participants who will receive the message, will be sent to every one if empty
*/
destinationIdentities?: string[];
/** the topic under which the message gets published */
topic?: string;
};
export type LiveKitReactNativeInfo = {
// Corresponds to RN's PlatformOSType
platform: 'ios' | 'android' | 'windows' | 'macos' | 'web' | 'native';
devicePixelRatio: number;
};
export type SimulationScenario =
| 'signal-reconnect'
| 'speaker'
| 'node-failure'
| 'server-leave'
| 'migration'
| 'resume-reconnect'
| 'force-tcp'
| 'force-tls'
| 'full-reconnect'
// overrides server-side bandwidth estimator with set bandwidth
// this can be used to test application behavior when congested or
// to disable congestion control entirely (by setting bandwidth to 100Mbps)
| 'subscriber-bandwidth'
| 'disconnect-signal-on-resume'
| 'disconnect-signal-on-resume-no-messages'
// instructs the server to send a full reconnect reconnect action to the client
| 'leave-full-reconnect';
export type LoggerOptions = {
loggerName?: string;
loggerContextCb?: () => Record<string, unknown>;
};
export interface TranscriptionSegment {
id: string;
text: string;
language: string;
startTime: number;
endTime: number;
final: boolean;
firstReceivedTime: number;
lastReceivedTime: number;
}
export interface ChatMessage {
id: string;
timestamp: number;
message: string;
editTimestamp?: number;
attachedFiles?: Array<File>;
}
export interface StreamController<T extends DataStream_Chunk> {
info: BaseStreamInfo;
controller: ReadableStreamDefaultController<T>;
startTime: number;
endTime?: number;
sendingParticipantIdentity: string;
outOfBandFailureRejectingFuture: Future<never, Error>;
}
export interface BaseStreamInfo {
id: string;
mimeType: string;
topic: string;
timestamp: number;
/** total size in bytes for finite streams and undefined for streams of unknown size */
size?: number;
attributes?: Record<string, string>;
encryptionType: Encryption_Type;
}
export interface ByteStreamInfo extends BaseStreamInfo {
name: string;
}
export interface TextStreamInfo extends BaseStreamInfo {
attachedStreamIds?: Array<string>;
}