@xmaxai/sdk 0.1.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/CHANGELOG.md +40 -0
- package/LICENSE +21 -0
- package/README.md +201 -0
- package/dist/chunk-67XSD3QJ.js +2673 -0
- package/dist/chunk-67XSD3QJ.js.map +1 -0
- package/dist/chunk-74ZZWUPI.js +992 -0
- package/dist/chunk-74ZZWUPI.js.map +1 -0
- package/dist/chunk-EGNRAZ5U.js +432 -0
- package/dist/chunk-EGNRAZ5U.js.map +1 -0
- package/dist/chunk-PLU2YVAS.js +414 -0
- package/dist/chunk-PLU2YVAS.js.map +1 -0
- package/dist/experimental/index.cjs +3897 -0
- package/dist/experimental/index.cjs.map +1 -0
- package/dist/experimental/index.d.cts +2 -0
- package/dist/experimental/index.d.ts +2 -0
- package/dist/experimental/index.js +5 -0
- package/dist/experimental/index.js.map +1 -0
- package/dist/index-BIUk_kvb.d.ts +350 -0
- package/dist/index-Dai62Sos.d.cts +350 -0
- package/dist/index.cjs +5109 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +235 -0
- package/dist/index.d.ts +235 -0
- package/dist/index.js +359 -0
- package/dist/index.js.map +1 -0
- package/dist/local-publish-diagnostics-ABLL56IT.js +79 -0
- package/dist/local-publish-diagnostics-ABLL56IT.js.map +1 -0
- package/dist/react/index.cjs +4304 -0
- package/dist/react/index.cjs.map +1 -0
- package/dist/react/index.d.cts +112 -0
- package/dist/react/index.d.ts +112 -0
- package/dist/react/index.js +817 -0
- package/dist/react/index.js.map +1 -0
- package/dist/rtc-manager-gYDkADGw.d.cts +412 -0
- package/dist/rtc-manager-gYDkADGw.d.ts +412 -0
- package/dist/video-file-stream-UXJ6TNIB.js +4 -0
- package/dist/video-file-stream-UXJ6TNIB.js.map +1 -0
- package/package.json +82 -0
|
@@ -0,0 +1,412 @@
|
|
|
1
|
+
type SDKLocale = 'en-US' | 'zh-CN';
|
|
2
|
+
|
|
3
|
+
type SDKMessages = Record<string, string>;
|
|
4
|
+
type SDKI18n = {
|
|
5
|
+
locale: SDKLocale;
|
|
6
|
+
t: (key: string, params?: Record<string, string | number | boolean | null | undefined>) => string;
|
|
7
|
+
};
|
|
8
|
+
declare function getDefaultMessages(locale: SDKLocale): SDKMessages;
|
|
9
|
+
declare function createSDKI18n(input?: {
|
|
10
|
+
locale?: SDKLocale;
|
|
11
|
+
messages?: Record<string, string>;
|
|
12
|
+
t?: SDKI18n['t'];
|
|
13
|
+
}): SDKI18n;
|
|
14
|
+
|
|
15
|
+
type XmaxErrorNotifier = (message: string, error?: unknown) => void;
|
|
16
|
+
|
|
17
|
+
/** Deployment region for the published package. */
|
|
18
|
+
type XmaxSdkRegion = "cn" | "global";
|
|
19
|
+
/** Region → official Open API v1 production base URL. */
|
|
20
|
+
declare const XMAX_OPEN_API_BASE_URLS: Record<XmaxSdkRegion, string>;
|
|
21
|
+
/**
|
|
22
|
+
* Official Xmax Open Platform production API base URL (Open API v1) for the
|
|
23
|
+
* region this package was built for:
|
|
24
|
+
* - `@xmaxai/sdk` (cn): https://cloud.xmax.22duck.cn/open/api/v1
|
|
25
|
+
* - `@xmaxai/sdk-global`: https://api.xmax.cloud/open/api/v1
|
|
26
|
+
*/
|
|
27
|
+
declare const XMAX_OPEN_API_PRODUCTION_BASE_URL: string;
|
|
28
|
+
declare const ACTIVE_STATUS = "ACTIVE";
|
|
29
|
+
interface ModelExtra {
|
|
30
|
+
room_id?: string;
|
|
31
|
+
bot_name?: string;
|
|
32
|
+
user_id?: string;
|
|
33
|
+
rtc_app_id?: string;
|
|
34
|
+
room_token?: string;
|
|
35
|
+
}
|
|
36
|
+
interface Session {
|
|
37
|
+
sessionUid: string;
|
|
38
|
+
userUid?: string;
|
|
39
|
+
modelTypeUid?: string;
|
|
40
|
+
modelTypeName?: string;
|
|
41
|
+
modelUid?: string;
|
|
42
|
+
modelExtra?: ModelExtra;
|
|
43
|
+
status?: string;
|
|
44
|
+
lastHeartbeatTimestamp?: string;
|
|
45
|
+
closeTimestamp?: string | null;
|
|
46
|
+
closeReason?: string | null;
|
|
47
|
+
createTimestamp?: string;
|
|
48
|
+
updateTimestamp?: string;
|
|
49
|
+
}
|
|
50
|
+
interface StsCredentials {
|
|
51
|
+
accessKeyId: string;
|
|
52
|
+
secretAccessKey: string;
|
|
53
|
+
sessionToken: string;
|
|
54
|
+
}
|
|
55
|
+
interface CosSts {
|
|
56
|
+
type: string;
|
|
57
|
+
bucket: string;
|
|
58
|
+
region: string;
|
|
59
|
+
endpoint: string;
|
|
60
|
+
prefix: string;
|
|
61
|
+
credentials: StsCredentials;
|
|
62
|
+
}
|
|
63
|
+
interface UploadImageResult {
|
|
64
|
+
key: string;
|
|
65
|
+
url: string;
|
|
66
|
+
raw: unknown;
|
|
67
|
+
sts: CosSts;
|
|
68
|
+
}
|
|
69
|
+
interface UploadVideoResult {
|
|
70
|
+
key: string;
|
|
71
|
+
url: string;
|
|
72
|
+
raw: unknown;
|
|
73
|
+
sts: CosSts;
|
|
74
|
+
}
|
|
75
|
+
interface RtcJoinInfo {
|
|
76
|
+
appId: string;
|
|
77
|
+
roomId: string;
|
|
78
|
+
userId: string;
|
|
79
|
+
token: string;
|
|
80
|
+
botName?: string;
|
|
81
|
+
}
|
|
82
|
+
interface XmaxLogEntry {
|
|
83
|
+
id: string;
|
|
84
|
+
level: "info" | "success" | "warn" | "error";
|
|
85
|
+
message: string;
|
|
86
|
+
data?: unknown;
|
|
87
|
+
timestamp: string;
|
|
88
|
+
}
|
|
89
|
+
interface ClientOptions {
|
|
90
|
+
apiKey: string;
|
|
91
|
+
/** Open API base URL, e.g. {@link XMAX_OPEN_API_PRODUCTION_BASE_URL}. */
|
|
92
|
+
baseUrl: string;
|
|
93
|
+
authToken?: string;
|
|
94
|
+
timeoutMs?: number;
|
|
95
|
+
locale?: SDKLocale;
|
|
96
|
+
i18n?: SDKI18n;
|
|
97
|
+
onError?: XmaxErrorNotifier;
|
|
98
|
+
}
|
|
99
|
+
declare class XmaxOpenClient {
|
|
100
|
+
private readonly apiKey;
|
|
101
|
+
private readonly authToken;
|
|
102
|
+
private readonly baseUrl;
|
|
103
|
+
private readonly timeoutMs;
|
|
104
|
+
private readonly i18n;
|
|
105
|
+
private readonly onError;
|
|
106
|
+
private stsCache;
|
|
107
|
+
private heartbeatIntervalId;
|
|
108
|
+
private suppressErrorNotification;
|
|
109
|
+
private teardownAbortController;
|
|
110
|
+
private readonly pendingRequestControllers;
|
|
111
|
+
constructor(options: ClientOptions);
|
|
112
|
+
private throwError;
|
|
113
|
+
/** Stop heartbeat, abort in-flight API requests, and suppress error toasts during teardown. */
|
|
114
|
+
beginTeardown(): void;
|
|
115
|
+
endTeardown(): void;
|
|
116
|
+
private isAbortError;
|
|
117
|
+
request<T>(method: string, path: string, body?: unknown): Promise<T>;
|
|
118
|
+
createSession(model: string): Promise<Session>;
|
|
119
|
+
getSession(sessionUid: string): Promise<Session>;
|
|
120
|
+
heartbeatSession(sessionUid: string): Promise<Session>;
|
|
121
|
+
closeSession(sessionUid: string): Promise<Session | null>;
|
|
122
|
+
getCosSts(forceRefresh?: boolean): Promise<CosSts>;
|
|
123
|
+
private uploadObject;
|
|
124
|
+
uploadImage(file: File): Promise<UploadImageResult>;
|
|
125
|
+
uploadVideo(file: File): Promise<UploadVideoResult>;
|
|
126
|
+
startHeartbeat(sessionUid: string, intervalMs?: number, onHeartbeat?: (session: Session) => void, onError?: (error: unknown) => void): void;
|
|
127
|
+
stopHeartbeat(): void;
|
|
128
|
+
getRtcJoinInfo(session: Session): RtcJoinInfo;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/** Max viewport width treated as mobile H5 (matches app `useIsMobile`). */
|
|
132
|
+
declare const MOBILE_PUBLISH_MAX_WIDTH_PX = 768;
|
|
133
|
+
declare const RTC_PUBLISH_FPS_WEB = 30;
|
|
134
|
+
declare const RTC_PUBLISH_FPS_MOBILE = 24;
|
|
135
|
+
/** @deprecated Use {@link resolveRtcPublishFps} — web default only. */
|
|
136
|
+
declare const RTC_PUBLISH_FPS = 30;
|
|
137
|
+
type ResolveRtcPublishFpsOptions = {
|
|
138
|
+
/** When set, skips viewport detection. */
|
|
139
|
+
mobile?: boolean;
|
|
140
|
+
/** Explicit fps override. */
|
|
141
|
+
fps?: number;
|
|
142
|
+
/** Upload/file publish — use detail encoding and higher max bitrate. */
|
|
143
|
+
highQuality?: boolean;
|
|
144
|
+
};
|
|
145
|
+
declare function isMobilePublishEnvironment(): boolean;
|
|
146
|
+
declare function resolveRtcPublishFps(options?: ResolveRtcPublishFpsOptions): number;
|
|
147
|
+
declare function resolveRtcPublishFrameIntervalS(options?: ResolveRtcPublishFpsOptions): number;
|
|
148
|
+
/** Web @ 30fps — use {@link resolveRtcPublishFrameIntervalS} when mobile-aware. */
|
|
149
|
+
declare const RTC_PUBLISH_FRAME_INTERVAL_S: number;
|
|
150
|
+
declare const RTC_PUBLISH_FRAME_INTERVAL_MS: number;
|
|
151
|
+
/** Tolerance when comparing media-time deltas (seconds). */
|
|
152
|
+
declare const MEDIA_TIME_EPSILON_S = 0.001;
|
|
153
|
+
/** Media time jumped backward beyond this threshold — treat as loop/seek reset. */
|
|
154
|
+
declare const MEDIA_TIME_LOOP_JUMP_S = 0.05;
|
|
155
|
+
|
|
156
|
+
interface RtcLogEntry {
|
|
157
|
+
level: "info" | "success" | "warn" | "error";
|
|
158
|
+
message: string;
|
|
159
|
+
data?: unknown;
|
|
160
|
+
}
|
|
161
|
+
interface RtcStateSnapshot {
|
|
162
|
+
roomId: string | null;
|
|
163
|
+
userId: string | null;
|
|
164
|
+
appId: string | null;
|
|
165
|
+
botUserId: string | null;
|
|
166
|
+
joined: boolean;
|
|
167
|
+
localVideoPublished: boolean;
|
|
168
|
+
remoteVideoUserId: string | null;
|
|
169
|
+
users: string[];
|
|
170
|
+
}
|
|
171
|
+
type RemoteSeiReceivedPayload = {
|
|
172
|
+
sei: string;
|
|
173
|
+
userId: string;
|
|
174
|
+
};
|
|
175
|
+
interface RtcManagerOptions {
|
|
176
|
+
onLog?: (entry: RtcLogEntry) => void;
|
|
177
|
+
onStateChange?: (state: RtcStateSnapshot) => void;
|
|
178
|
+
onSeiGateChange?: (state: {
|
|
179
|
+
expectedSei: string | null;
|
|
180
|
+
sei: string | null;
|
|
181
|
+
userId: string | null;
|
|
182
|
+
matched: boolean;
|
|
183
|
+
}) => void;
|
|
184
|
+
/** Fired for H.264 SEI received on a remote (non-local) stream — e.g. backend/bot output. */
|
|
185
|
+
onRemoteSeiReceived?: (payload: RemoteSeiReceivedPayload) => void;
|
|
186
|
+
/** Fired when remote output stops presenting new frames after playback had started. */
|
|
187
|
+
onRemoteOutputStalled?: (info: {
|
|
188
|
+
userId: string;
|
|
189
|
+
stallMs: number;
|
|
190
|
+
}) => void;
|
|
191
|
+
/** Fired after the remote player is mounted (used to forward MediaStream via onRemoteStream). */
|
|
192
|
+
onRemotePlayerMounted?: () => void;
|
|
193
|
+
debug?: boolean;
|
|
194
|
+
i18n?: SDKI18n;
|
|
195
|
+
}
|
|
196
|
+
type VideoSize = [number, number];
|
|
197
|
+
type RtcSessionSeiOptions = {
|
|
198
|
+
repeatCount?: number;
|
|
199
|
+
intervalMs?: number;
|
|
200
|
+
};
|
|
201
|
+
/** Cold publish: bootstrap already waits 3 frames — buffer before first start only. */
|
|
202
|
+
declare const PUBLISH_START_MIN_FRAMES = 5;
|
|
203
|
+
declare const PUBLISH_START_FRAME_TIMEOUT_MS = 800;
|
|
204
|
+
declare const PUBLISH_COLD_MIN_FRAMES = 12;
|
|
205
|
+
declare const PUBLISH_COLD_FRAME_TIMEOUT_MS = 1500;
|
|
206
|
+
/** Minimum publish duration before first start (encoder/network warmup). */
|
|
207
|
+
declare const PUBLISH_COLD_WARMUP_MS = 600;
|
|
208
|
+
/** Skip cold-start ensure when publish has been active this long. */
|
|
209
|
+
declare const PUBLISH_WARM_SKIP_MS = 800;
|
|
210
|
+
type LocalPublishReadyResult = {
|
|
211
|
+
ready: boolean;
|
|
212
|
+
reason: "sent-frame-rate" | "sent-bitrate" | "already-ready" | "not-published" | "timeout";
|
|
213
|
+
elapsedSincePublishMs: number;
|
|
214
|
+
};
|
|
215
|
+
declare class RtcManager {
|
|
216
|
+
private engine;
|
|
217
|
+
private leaveTask;
|
|
218
|
+
private readonly users;
|
|
219
|
+
private currentJoinInfo;
|
|
220
|
+
private joined;
|
|
221
|
+
private preserveRemoteDom;
|
|
222
|
+
private localVideoPublished;
|
|
223
|
+
private localVideoSourceType;
|
|
224
|
+
private shouldMirrorLocalPreview;
|
|
225
|
+
private externalVideoTrack;
|
|
226
|
+
private remoteVideoUserId;
|
|
227
|
+
private pendingRemoteVideoUserId;
|
|
228
|
+
private pendingRemoteVideoMediaType;
|
|
229
|
+
/** Subscribed to RTC media, but player may still be gated by SEI / container. */
|
|
230
|
+
private subscribedRemoteUserId;
|
|
231
|
+
private subscribedRemoteMediaType;
|
|
232
|
+
private readonly onLog;
|
|
233
|
+
private readonly onStateChange;
|
|
234
|
+
private readonly onSeiGateChange;
|
|
235
|
+
private readonly onRemoteSeiReceived;
|
|
236
|
+
private readonly onRemoteOutputStalled;
|
|
237
|
+
private onRemotePlayerMounted;
|
|
238
|
+
private localVideoContainer;
|
|
239
|
+
private remoteVideoContainer;
|
|
240
|
+
private expectedRemoteSei;
|
|
241
|
+
private lastRemoteSei;
|
|
242
|
+
private lastRemoteSeiUserId;
|
|
243
|
+
private localSeiMessage;
|
|
244
|
+
private localSeiRepeatCount;
|
|
245
|
+
private seiSendInterval;
|
|
246
|
+
private lastSeiSentAtMs;
|
|
247
|
+
private hasLoggedSeiSendFailure;
|
|
248
|
+
private seiSupport;
|
|
249
|
+
private hasLoggedSeiUnsupported;
|
|
250
|
+
private readonly debug;
|
|
251
|
+
private lastDebugSeiMatched;
|
|
252
|
+
private lastDebugRemoteSei;
|
|
253
|
+
private remoteFrameWatchStop;
|
|
254
|
+
private uploadPreviewLayoutObserverStop;
|
|
255
|
+
private remoteOutputRecoveryCooldownUntil;
|
|
256
|
+
private readonly i18n;
|
|
257
|
+
private joinedAtMs;
|
|
258
|
+
private publishStartedAtMs;
|
|
259
|
+
private lastRoomStartEventAtMs;
|
|
260
|
+
private localStreamStatsCount;
|
|
261
|
+
private firstNonZeroSentFrameRateAtMs;
|
|
262
|
+
private lastObservedSentFrameRate;
|
|
263
|
+
private publishReadyWaiters;
|
|
264
|
+
private stablePublishWaiters;
|
|
265
|
+
private publishReadyBufferTimer;
|
|
266
|
+
private seiGateFallbackTimer;
|
|
267
|
+
private seiMatchedDelayTimer;
|
|
268
|
+
private lastSentResolution;
|
|
269
|
+
private lastReceivedResolution;
|
|
270
|
+
private static readonly SEI_GATE_FALLBACK_MS;
|
|
271
|
+
private static readonly SEI_MATCHED_DISPLAY_DELAY_MS;
|
|
272
|
+
constructor(options?: RtcManagerOptions);
|
|
273
|
+
private emitSeiGateState;
|
|
274
|
+
setPreserveRemoteDom(preserve: boolean): void;
|
|
275
|
+
setOnRemotePlayerMounted(callback: RtcManagerOptions["onRemotePlayerMounted"]): void;
|
|
276
|
+
setLocalVideoContainer(container: HTMLElement | null): void;
|
|
277
|
+
setRemoteVideoContainer(container: HTMLElement | null): void;
|
|
278
|
+
/** Display-only gate: expect bot output SEI to match task id — no local SEI send, no start blocking. */
|
|
279
|
+
configureSessionSei(sessionId: string | null, _options?: RtcSessionSeiOptions): void;
|
|
280
|
+
private clearSeiGateFallbackTimer;
|
|
281
|
+
private clearSeiMatchedDelayTimer;
|
|
282
|
+
/** Show output if bot SEI never arrives — UI gate only, RTC bind is not blocked. */
|
|
283
|
+
private scheduleSeiGateFallback;
|
|
284
|
+
get snapshot(): RtcStateSnapshot;
|
|
285
|
+
getLocalVideoSize(): {
|
|
286
|
+
width: number;
|
|
287
|
+
height: number;
|
|
288
|
+
} | null;
|
|
289
|
+
join(joinInfo: RtcJoinInfo): Promise<void>;
|
|
290
|
+
startVideoPublishing(size?: VideoSize): Promise<void>;
|
|
291
|
+
startExternalVideoPublishing(track: MediaStreamTrack, encoderSize?: VideoSize, publishOptions?: ResolveRtcPublishFpsOptions): Promise<void>;
|
|
292
|
+
stopVideoPublishing(options?: {
|
|
293
|
+
preserveExternalTrack?: boolean;
|
|
294
|
+
}): Promise<void>;
|
|
295
|
+
leave(): Promise<void>;
|
|
296
|
+
/**
|
|
297
|
+
* Resolve whether to wait for input frames before start.
|
|
298
|
+
* Warm pipelines (restart / long-lived publish) skip — iOS sends start while frames already flow.
|
|
299
|
+
*/
|
|
300
|
+
resolveInputFrameWaitOptions(): {
|
|
301
|
+
minFrames: number;
|
|
302
|
+
timeoutMs: number;
|
|
303
|
+
minPublishMs: number;
|
|
304
|
+
} | null;
|
|
305
|
+
/**
|
|
306
|
+
* Wait until the published input track produces enough frames before sending start.
|
|
307
|
+
* Uses actual frame delivery instead of sentFrameRate (~2s Volcengine stats window).
|
|
308
|
+
*/
|
|
309
|
+
waitForPublishedInputFrames(options?: {
|
|
310
|
+
minFrames?: number;
|
|
311
|
+
timeoutMs?: number;
|
|
312
|
+
}): Promise<{
|
|
313
|
+
ready: boolean;
|
|
314
|
+
frameCount: number;
|
|
315
|
+
elapsedMs: number;
|
|
316
|
+
}>;
|
|
317
|
+
/**
|
|
318
|
+
* Before every start: ensure the publish track is producing frames.
|
|
319
|
+
* Cold — longer warmup; warm restart — quick sync (~200ms) so backend gets steady input after start.
|
|
320
|
+
*/
|
|
321
|
+
ensurePublishedInputBeforeStart(): Promise<void>;
|
|
322
|
+
/** @deprecated Use {@link ensurePublishedInputBeforeStart}. */
|
|
323
|
+
waitForRtcOutboundBeforeStart(options?: {
|
|
324
|
+
timeoutMs?: number;
|
|
325
|
+
}): Promise<LocalPublishReadyResult>;
|
|
326
|
+
/** @deprecated Use {@link waitForRtcOutboundBeforeStart}. */
|
|
327
|
+
waitForPublishedInputFramesBeforeStart(): Promise<{
|
|
328
|
+
ready: boolean;
|
|
329
|
+
frameCount: number;
|
|
330
|
+
elapsedMs: number;
|
|
331
|
+
rtcSendReady: boolean;
|
|
332
|
+
rtcSendReason?: LocalPublishReadyResult["reason"];
|
|
333
|
+
rtcSendElapsedMs?: number;
|
|
334
|
+
}>;
|
|
335
|
+
private waitForMinPublishDuration;
|
|
336
|
+
/**
|
|
337
|
+
* Subscribe to the bot output stream before start — iOS bindRemoteVideoRenderer runs pre-request.
|
|
338
|
+
*/
|
|
339
|
+
prepareRemoteVideoForGeneration(): Promise<void>;
|
|
340
|
+
/**
|
|
341
|
+
* Wait until outbound sentFrameRate reaches minFps and stays there for stableMs.
|
|
342
|
+
* Avoids starting while Volcengine encoder is still ramping (causes early dropped frames).
|
|
343
|
+
*/
|
|
344
|
+
waitForStableLocalPublishReady(options?: {
|
|
345
|
+
minFps?: number;
|
|
346
|
+
timeoutMs?: number;
|
|
347
|
+
stableMs?: number;
|
|
348
|
+
}): Promise<LocalPublishReadyResult>;
|
|
349
|
+
/**
|
|
350
|
+
* Wait until Volcengine reports non-zero sentFrameRate (~2s stats window).
|
|
351
|
+
* Prefer this over local track frame counts before start — backend only processes from start.
|
|
352
|
+
*/
|
|
353
|
+
waitForLocalPublishReady(options?: {
|
|
354
|
+
timeoutMs?: number;
|
|
355
|
+
}): Promise<LocalPublishReadyResult>;
|
|
356
|
+
sendRoomEvent(event: unknown): Promise<void>;
|
|
357
|
+
clearRemoteVideo(options?: {
|
|
358
|
+
preserveDom?: boolean;
|
|
359
|
+
}): void;
|
|
360
|
+
refreshRemoteVideoBinding(options?: {
|
|
361
|
+
force?: boolean;
|
|
362
|
+
}): Promise<void>;
|
|
363
|
+
private bindEngineEvents;
|
|
364
|
+
private emitState;
|
|
365
|
+
private ensureReadyForMessaging;
|
|
366
|
+
private bindLocalVideoPlayer;
|
|
367
|
+
private bindUploadPreviewLayout;
|
|
368
|
+
private clearUploadPreviewLayoutObserver;
|
|
369
|
+
/** Re-bind local preview after the container becomes visible or is resized (mobile H5). */
|
|
370
|
+
refreshLocalVideoPreview(options?: {
|
|
371
|
+
force?: boolean;
|
|
372
|
+
}): void;
|
|
373
|
+
private switchToExternalVideoSource;
|
|
374
|
+
private switchToInternalVideoSource;
|
|
375
|
+
private applyLocalVideoCaptureConfig;
|
|
376
|
+
private resolveEncoderMaxKbps;
|
|
377
|
+
private applyVideoEncoderPreference;
|
|
378
|
+
private attachRemoteVideo;
|
|
379
|
+
private ensureRemoteStreamSubscribed;
|
|
380
|
+
private bindRemoteVideoPlayerToContainer;
|
|
381
|
+
private mountRemoteVideoPlayer;
|
|
382
|
+
private startRemoteFrameWatch;
|
|
383
|
+
private stopRemoteFrameWatch;
|
|
384
|
+
private isRemoteSeiUser;
|
|
385
|
+
/** Always mount remote player — SEI gate is UI-only (see deriveOutputVisibility). */
|
|
386
|
+
private canRenderRemoteVideo;
|
|
387
|
+
/** Whether remote SEI matches the active task (display gate). */
|
|
388
|
+
private isSeiMatched;
|
|
389
|
+
/** Low-rate SEI until remote output SEI matches — avoids Volcengine sendSEIMessage timeouts. */
|
|
390
|
+
private startContinuousSeiSending;
|
|
391
|
+
private stopSeiSending;
|
|
392
|
+
private canSendLocalSeiNow;
|
|
393
|
+
private flushSeiMessage;
|
|
394
|
+
private ensureSeiSupport;
|
|
395
|
+
private normalizeSei;
|
|
396
|
+
private normalizeSeiRepeatCount;
|
|
397
|
+
private decodeSeiMessage;
|
|
398
|
+
private supportsVideo;
|
|
399
|
+
private clearVideoContainers;
|
|
400
|
+
private clearContainer;
|
|
401
|
+
private getRequiredContainer;
|
|
402
|
+
private emitRemotePlayerMounted;
|
|
403
|
+
private log;
|
|
404
|
+
private resolvePublishReadyWaiters;
|
|
405
|
+
private clearPublishReadyWaiters;
|
|
406
|
+
private notifyStablePublishWaiters;
|
|
407
|
+
private schedulePublishReadyWhenStable;
|
|
408
|
+
private logLocalStreamStats;
|
|
409
|
+
private debugLog;
|
|
410
|
+
}
|
|
411
|
+
|
|
412
|
+
export { ACTIVE_STATUS as A, XMAX_OPEN_API_PRODUCTION_BASE_URL as B, type ClientOptions as C, type XmaxLogEntry as D, type XmaxSdkRegion as E, createSDKI18n as F, getDefaultMessages as G, isMobilePublishEnvironment as H, resolveRtcPublishFps as I, resolveRtcPublishFrameIntervalS as J, type LocalPublishReadyResult as L, MEDIA_TIME_EPSILON_S as M, PUBLISH_COLD_FRAME_TIMEOUT_MS as P, type RtcStateSnapshot as R, type SDKLocale as S, type UploadImageResult as U, type XmaxErrorNotifier as X, type SDKI18n as a, XmaxOpenClient as b, type CosSts as c, MEDIA_TIME_LOOP_JUMP_S as d, MOBILE_PUBLISH_MAX_WIDTH_PX as e, type ModelExtra as f, PUBLISH_COLD_MIN_FRAMES as g, PUBLISH_COLD_WARMUP_MS as h, PUBLISH_START_FRAME_TIMEOUT_MS as i, PUBLISH_START_MIN_FRAMES as j, PUBLISH_WARM_SKIP_MS as k, RTC_PUBLISH_FPS as l, RTC_PUBLISH_FPS_MOBILE as m, RTC_PUBLISH_FPS_WEB as n, RTC_PUBLISH_FRAME_INTERVAL_MS as o, RTC_PUBLISH_FRAME_INTERVAL_S as p, type RemoteSeiReceivedPayload as q, type ResolveRtcPublishFpsOptions as r, type RtcJoinInfo as s, type RtcLogEntry as t, RtcManager as u, type SDKMessages as v, type Session as w, type StsCredentials as x, type UploadVideoResult as y, XMAX_OPEN_API_BASE_URLS as z };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"video-file-stream-UXJ6TNIB.js"}
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xmaxai/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Browser SDK for Xmax Open Platform — HTTP session, Volcengine RTC, and React bindings.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"author": "Xmax",
|
|
8
|
+
"keywords": [
|
|
9
|
+
"Xmax",
|
|
10
|
+
"rtc",
|
|
11
|
+
"realtime",
|
|
12
|
+
"video",
|
|
13
|
+
"ai",
|
|
14
|
+
"sdk"
|
|
15
|
+
],
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"main": "./dist/index.cjs",
|
|
18
|
+
"module": "./dist/index.js",
|
|
19
|
+
"types": "./dist/index.d.ts",
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"LICENSE",
|
|
23
|
+
"README.md",
|
|
24
|
+
"CHANGELOG.md"
|
|
25
|
+
],
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"import": "./dist/index.js",
|
|
30
|
+
"require": "./dist/index.cjs"
|
|
31
|
+
},
|
|
32
|
+
"./react": {
|
|
33
|
+
"types": "./dist/react/index.d.ts",
|
|
34
|
+
"import": "./dist/react/index.js",
|
|
35
|
+
"require": "./dist/react/index.cjs"
|
|
36
|
+
},
|
|
37
|
+
"./experimental": {
|
|
38
|
+
"types": "./dist/experimental/index.d.ts",
|
|
39
|
+
"import": "./dist/experimental/index.js",
|
|
40
|
+
"require": "./dist/experimental/index.cjs"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsup",
|
|
48
|
+
"build:cn": "XMAX_SDK_REGION=cn tsup",
|
|
49
|
+
"build:global": "XMAX_SDK_REGION=global tsup",
|
|
50
|
+
"dev": "tsup --watch",
|
|
51
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
52
|
+
"test": "vitest run",
|
|
53
|
+
"test:watch": "vitest",
|
|
54
|
+
"prepublishOnly": "npm run build && npm run test",
|
|
55
|
+
"publish:cn": "node scripts/publish-sdk.mjs cn",
|
|
56
|
+
"publish:global": "node scripts/publish-sdk.mjs global",
|
|
57
|
+
"publish:all": "npm run publish:cn && npm run publish:global"
|
|
58
|
+
},
|
|
59
|
+
"peerDependencies": {
|
|
60
|
+
"react": "^18",
|
|
61
|
+
"react-dom": "^18"
|
|
62
|
+
},
|
|
63
|
+
"peerDependenciesMeta": {
|
|
64
|
+
"react": {
|
|
65
|
+
"optional": true
|
|
66
|
+
},
|
|
67
|
+
"react-dom": {
|
|
68
|
+
"optional": true
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@volcengine/rtc": "^4.68.5",
|
|
73
|
+
"cos-js-sdk-v5": "^1.10.1"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@types/react": "^18",
|
|
77
|
+
"@types/react-dom": "^18",
|
|
78
|
+
"tsup": "^8.5.0",
|
|
79
|
+
"typescript": "^5.9.0",
|
|
80
|
+
"vitest": "^3.2.4"
|
|
81
|
+
}
|
|
82
|
+
}
|